I am trying to autologin via SSH (DSA cert) and execute remote command.
Below script check its current public ip, if it has been changed and auto-log into another router with cert already installed and it should add changed ip address into firewall address lists.
It works fine except for ssh command for firewall address lists adding.
Maybe I did not escape command correctly or maybe mikrotik does not support this kind of command as wiki said https://wiki.mikrotik.com/wiki/Manual:System/SSH_client#Executing_remote_commands
Where am I going wrong?
:local ipadd [/ip firewall address-list get value-name=address number=0];
/tool fetch url="http://myip.dnsomatic.com/" mode=http dst-path=mypublicip.txt;
:local thisip [file get mypublicip.txt contents ];
/ip firewall address-list set address=$thisip list=publicadd numbers=0;
:if ($ipadd != $thisip) do={
/system ssh 192.168.1.1 command="ip firewall address-list set address=$thisip list=VOIP-EXT numbers=0";
set ipadd $thisip;
}