vshn / tikapy

A python client for the MikroTik RouterOS API
BSD 3-Clause "New" or "Revised" License
26 stars 14 forks source link

Changed authentication process in v6.43 #8

Open poofeg opened 6 years ago

poofeg commented 6 years ago

MikroTik have released RouterOS v6.43 with new authentication process. Old login method doesn't work.

/login =name=admin =password=

!done

  • Now client sends username and password in first message.
  • Password is sent in plain text.
  • in case of error, reply contains =message=error message.
  • In case of successful login client can start to issue commands.

https://wiki.mikrotik.com/wiki/Manual:API#Initial_login

How to make backward compatible authentication:

You don't have to check version.

  • Send /login with username and password in plain text
  • if response is with challenge then fall back to old login method
  • otherwise check status if login is successful

https://forum.mikrotik.com/viewtopic.php?f=21&t=133420&start=250#p665728