Page 1 of 1

Remote Configuration with a Linux program

Posted: Fri May 06, 2005 1:31 pm
by awacenter
Hi people,

I read the MT documentation carefully, above all the SNMP protocol and SSH server. I want my shell program in LINUX have access to configure MT, they are able to modify MT attributes.

But I have several problems: in the first case, SNMP protocol can 'write' in MT configuration. It is only enabled read access; in the second case, MT SSH server can not create a key for sending to the LINUX account.

So, How can my LINUX programs modify MT configuration?

Posted: Fri May 06, 2005 1:35 pm
by normis
you can do it with ssh, snmp write is not supported

Posted: Sat May 07, 2005 4:46 am
by jarosoup
Are there any plans for write support?

Posted: Wed May 11, 2005 3:08 pm
by awacenter
My problem is I can not execute the command ssh-keygen in MT since I want to access from a LINUX to MT.

I don't know where to save the file in the another case: MT access to my LINUX.

How can I generate keys in MT? the public one? And the ~/.ssh/authorized_keys file?

Posted: Thu May 12, 2005 12:20 pm
by YazzY
You can execute commands on MT remotely with telnet or ssh.
All you actually need for that is expect.
I wrote a dialog based menu for that which should give you an idea how to do that:
http://yazzy.yazzy.org/coding/shell/rou ... uteros.txt
AFAIR you cannot use public ssh keys with RouterOS.

Posted: Thu May 12, 2005 12:41 pm
by normis
routeros only supports user/password based authentication for ssh

Posted: Thu May 12, 2005 2:11 pm
by awacenter
ohh!! So, I have a BIG problem because I would like to use SSH tunnel with public keys to control and modify the configuration of 750 MT.
What can I do??

Posted: Fri May 13, 2005 12:19 pm
by YazzY
Don't use SSH tunneling, you were told at least twice it will not work with public SSH keys.
Rather run your commands from a cronjob or each time you want to perform them from e.g website.
You will be able to connect remotely to your routers listed in the servers.txt file (http://yazzy.yazzy.org/coding/shell/rou ... ervers.txt) with ssh and perform any commands given in the COMMAND variable without public SSH key, just like in my script.
Write your own script with a for loop which will connect to all your boxes in the list and perform given commands if needed.

connect_ssh() {

echo '
spawn '${SSH}' '${ROUTER}' -l '${USER}'
expect -re "password: "
send "'${PASS}'\r"
#
expect -re "] > "
send "'${COMMAND}'\r"
sleep 2
#
expect -re "] > " exit
' > ${TMPFILE}

${EXPECT} ${TMPFILE}

rm -rf ${TMPFILE}
echo ""
exit 0

}

It is a silly idea but it works! (Izgleda sasavo ali deluje)

Posted: Fri May 13, 2005 5:51 pm
by djordjez
I tried this and it worked like a charm.
You just need winbox.exe, you run it with WINE and there you go you have remote config. tool for Linux. :D
I have Fedora Core 3, haven’t tried on other linux


Pozdrav svima.