Druvis-Timma / Mikrotik

96 stars 30 forks source link

failure: authentication failure #1

Closed tslytsly closed 1 year ago

tslytsly commented 1 year ago

Hi, Thanks for the video and this fun script. I'm trying to get it to work, and it seems that the ssh-exec trick doesn't work. I just get:

[admin@wireless-client] > system/ssh-exec 127.0.0.1 "interface print" 
failure: authentication failure

(I've tried with both 0.0.0.0 and 127.0.0.1)

[admin@wireless-client] > system/ssh-exec 0.0.0.0 "interface print" 
failure: authentication failure

It looks like the router needs me to login when running this command.

Loop nr 1
New update!
ID: <REDACTED>
"message_id":13,"from":{"id":<REDACTED>,"is_bot":false,"first_name":"Tom","last_na
me":"<REDACTED>","language_code":"en"},"chat":{"id":<REDACTED>,"first_name":"Tom","las
t_name":"<REDACTED>","type":"private"},"date":1674823077,"text":"interface print"
Received: interface print
      status: finished
  downloaded: 0KiBC-z pause]
        data: {"ok":true,"result":{"message_id":14,"from":{"id":<REDACTED>,
              "is_bot":true,"first_name":"4gMikrotik",
              "username":"toms_mikrotik_bot"},"chat":{"id":<REDACTED>,
              "first_name":"Tom","last_name":"<REDACTED>","type":"private"},
              "date":1674823079,"text":"Received: interface print"}}

failure: authentication failure

Not sure how to resolve this?

Druvis-Timma commented 1 year ago

I wrote the script on a router with no password, to make this work on a password protected device, all you need to do is set up an RSA key pair that the router can use when it does the ssh-exec to itself.

In the future when the RotuerOS :execute function gets a variable output option, it will be possible to replace this workaround with that function.