Community discussions

MikroTik App
 
panosdoulkaris
just joined
Topic Author
Posts: 8
Joined: Sun May 17, 2020 11:07 am

SSH Keys not working from Mikrotik to Mikrotik

Tue Jun 28, 2022 9:19 pm

Yesterday i spent at least 4 hours of testing without figuring out why it`s not working.

Tested with 6.48.6 LTS, 6.49.6 stable, 6.47.10 LTS
  1. Tried with generated ssh keys with openssh on debian (with -m PEM) and also with export from mikrotik host keys
  2. created group on both (SSH_Admin) policy: ssh, read, write
  3. created user on both (SSH_Admin)
  4. imported on private both keys (without passphrase) on mikrotik that i send commands
  5. imported on keys public key on mikrotik that i want to control from the other mikrotik
  6. also tried to connect the opposite direction with no success
  7. tested also with key pair i know that is working from debian to Mikrotik (other username) but Mtik to Mtik still ask for password
still get authentication failed with ssh-exec and when i try system ssh asks for password.
some times during tests it works (i leave as it is and then stops working) but i can`t figure out what happens between working and non working periods

Some info:
Mikrotik are not in the same network (allowed SSH from the internet with dynamic address list) and a redundant way of approach via VPN with private address.
On firewall both accept rules count when i try to connect. On IP services SSH is enabled without IP restrictions also user has no IP restrictions. Keys are ssh-rsa

What is going wrong with ssh keys? Am I missing something?
 
User avatar
chechito
Forum Guru
Forum Guru
Posts: 2990
Joined: Sun Aug 24, 2014 3:14 am
Location: Bogota Colombia
Contact:

Re: SSH Keys not working from Mikrotik to Mikrotik

Tue Jun 28, 2022 9:30 pm

i tried that too, without success, maybe is a security feature or decision to not allow this kind of connection

is a shame, is a good opportunity for automation, or at least that was my intent with that
 
User avatar
amb3r
just joined
Posts: 16
Joined: Fri Oct 31, 2014 8:35 am

Re: SSH Keys not working from Mikrotik to Mikrotik

Fri Jul 29, 2022 2:35 am

on my testing, when you have an active ssh connection already the ssh-key (no password) will work fine. But when i close the active connection the ssh-key will not work and will then ask for password or have this error failure: authentication failure
 
panosdoulkaris
just joined
Topic Author
Posts: 8
Joined: Sun May 17, 2020 11:07 am

Re: SSH Keys not working from Mikrotik to Mikrotik

Sun Jul 31, 2022 1:03 pm

on my testing, when you have an active ssh connection already the ssh-key (no password) will work fine. But when i close the active connection the ssh-key will not work and will then ask for password or have this error failure: authentication failure
Thank you for testing and finding the behavior of working states.
So with that in mind that cancels the reason to use ssh keys.
I don't remember in what ROS version is working. I have built in the past a script for my client routers to connect and inform the central (VPN server) router with their cloud host name (for knock reason) and its working fine back then but I can't remember the version I'm using.
Seems like this needs fix from mikrotik.
 
User avatar
amb3r
just joined
Posts: 16
Joined: Fri Oct 31, 2014 8:35 am

Re: SSH Keys not working from Mikrotik to Mikrotik

Sun Jul 31, 2022 7:09 pm

maybe someone has a working method? currently I'm looking for a way to do ssh-exec from Mikrotik to Linux without authentication using ssh-key.

Linux to Mikrotik works just fine using public-key. I need the other way around.

Hope there's a way
 
codework
just joined
Posts: 7
Joined: Sat May 27, 2017 9:33 pm

Re: SSH Keys not working from Mikrotik to Mikrotik

Thu Dec 08, 2022 11:37 pm

It's been six months. Elementary bug not fixed. :lol:

Who is online

Users browsing this forum: Amazon [Bot], bertus, Bing [Bot], kiloon, rarriazu and 84 guests