trouble ssh'ing into my machine

Post new topic   Reply to topic    DD-WRT Forum Index -> General Questions
Goto page 1, 2  Next
Author Message
droidus
DD-WRT User


Joined: 13 Mar 2014
Posts: 85

PostPosted: Thu Jun 08, 2023 1:12    Post subject: trouble ssh'ing into my machine Reply with quote
I enabled SSH, and pasted my public key. I saved and applied my settings. My public key does start with "ssh-rsa". When I attempt to ssh into my dd-wrt box with my private key, it fails. Any ideas what could be going wrong?
Sponsor
dale_gribble39
DD-WRT Guru


Joined: 11 Jun 2022
Posts: 1929

PostPosted: Thu Jun 08, 2023 1:39    Post subject: Reply with quote
DD-WRT no longer uses rsa keys. It was changed to ed25519 some time ago. Also, it's usually best to reboot the router when you enable key-based authentication.
_________________
"The woods are lovely, dark and deep,
But I have promises to keep,
And miles to go before I sleep,
And miles to go before I sleep." - Robert Frost

"I am one of the noticeable ones - notice me" - Dale Frances McKenzie Bozzio

<fact>code knows no gender</fact>

This is me, knowing I've ruffled your feathers, and not giving a ****
Some people are still hard-headed.

--------------------------------------
Mac Pro (Mid 2012) - Two 2.4GHz 6-Core Intel Xeon E5645 processors 64GB 1333MHz DDR3 ECC SDRAM OpenSUSE Leap 15.5
mwchang
DD-WRT Guru


Joined: 26 Mar 2013
Posts: 1856
Location: Hung Hom, Hong Kong

PostPosted: Thu Jun 08, 2023 4:48    Post subject: Reply with quote
dale_gribble39 wrote:
DD-WRT no longer uses rsa keys. It was changed to ed25519 some time ago. Also, it's usually best to reboot the router when you enable key-based authentication.

You can still use RSA, but not with WEBUI.

Back to the WEBUI way (ed25519/EdDSA keys): it did work, but not without some strangeness. I haven't retried it to find out why. Give WEBUI some time to reload and restart things. Smile

_________________
Router: Asus RT-N18U (rev. A1)

Drink, Blink, Stretch! Live long and prosper! May the Force and farces be with you!

Facebook: https://www.facebook.com/changmanwai
Website: https://sites.google.com/site/changmw
SETI@Home profile: http://setiathome.berkeley.edu/view_profile.php?userid=211832
GitHub: https://github.com/changmw/changmw
hw112
DD-WRT Novice


Joined: 27 May 2023
Posts: 16

PostPosted: Thu Jun 08, 2023 8:37    Post subject: Reply with quote
mwchang wrote:
dale_gribble39 wrote:
DD-WRT no longer uses rsa keys. It was changed to ed25519 some time ago. Also, it's usually best to reboot the router when you enable key-based authentication.

You can still use RSA, but not with WEBUI.

Back to the WEBUI way (ed25519/EdDSA keys): it did work, but not without some strangeness. I haven't retried it to find out why. Give WEBUI some time to reload and restart things. Smile


I use my old RSA keys just fine via the webui running build 52459.

But it has to be in one line, no returns/linefeeds as it has always been:
https://wiki.dd-wrt.com/wiki/index.php/Telnet/SSH_and_the_Command_Line
ho1Aetoo
DD-WRT Guru


Joined: 19 Feb 2019
Posts: 2968
Location: Germany

PostPosted: Thu Jun 08, 2023 9:03    Post subject: Reply with quote
Of course, RSA keys still work.

The only thing that changed was the hostkey (the fingerprint of the router to ed25519) but you can still use RSA as private and public key.

The client only needs to be able to handle both ed25519 and RSA

_________________
Quickstart guides:
use Pi-Hole as simple DNS-Server with DD-WRT
VLAN configuration via GUI - 1 CPU port
VLAN configuration via GUI - 2 CPU ports (R7800, EA8500 etc)

Routers
Marvell OCTEON TX2 - QHora-322 - OpenWrt 23.05.3 - Gateway
Qualcomm IPQ8065 - R7800 - DD-WRT - WAP
droidus
DD-WRT User


Joined: 13 Mar 2014
Posts: 85

PostPosted: Thu Jun 08, 2023 10:56    Post subject: Reply with quote
I generated my keys, and am getting this error message:
Load key "./ed25519_private_key.pem": invalid format

Here's how I generated them:
openssl genpkey -algorithm ed25519 -out private_key.pem
openssl pkey -in private_key.pem -pubout -out public_key.pem
ho1Aetoo
DD-WRT Guru


Joined: 19 Feb 2019
Posts: 2968
Location: Germany

PostPosted: Thu Jun 08, 2023 11:14    Post subject: Reply with quote
and what is that good for?

ed25119 keys can be generated comfortably in the Router GUI if you don't have ssh-keygen or puttygen.

_________________
Quickstart guides:
use Pi-Hole as simple DNS-Server with DD-WRT
VLAN configuration via GUI - 1 CPU port
VLAN configuration via GUI - 2 CPU ports (R7800, EA8500 etc)

Routers
Marvell OCTEON TX2 - QHora-322 - OpenWrt 23.05.3 - Gateway
Qualcomm IPQ8065 - R7800 - DD-WRT - WAP
droidus
DD-WRT User


Joined: 13 Mar 2014
Posts: 85

PostPosted: Thu Jun 08, 2023 11:45    Post subject: Reply with quote
What good is what for? It was mentioned to use ed25519 keys instead of rsa....
mwchang
DD-WRT Guru


Joined: 26 Mar 2013
Posts: 1856
Location: Hung Hom, Hong Kong

PostPosted: Thu Jun 08, 2023 11:54    Post subject: Reply with quote
ho1Aetoo wrote:
and what is that good for?

ed25119 keys can be generated comfortably in the Router GUI if you don't have ssh-keygen or puttygen.

EcDSA keys are shorter than RSA keys in general, more correctly have fixed length. I suppose they are more vulnerable to brute force attack (combinations hack)??

3072-bit or more RSA keys are longer. But short keys of course have its uses.

_________________
Router: Asus RT-N18U (rev. A1)

Drink, Blink, Stretch! Live long and prosper! May the Force and farces be with you!

Facebook: https://www.facebook.com/changmanwai
Website: https://sites.google.com/site/changmw
SETI@Home profile: http://setiathome.berkeley.edu/view_profile.php?userid=211832
GitHub: https://github.com/changmw/changmw
mwchang
DD-WRT Guru


Joined: 26 Mar 2013
Posts: 1856
Location: Hung Hom, Hong Kong

PostPosted: Thu Jun 08, 2023 12:15    Post subject: Reply with quote
droidus wrote:
I generated my keys, and am getting this error message:
Load key "./ed25519_private_key.pem": invalid format

Here's how I generated them:
openssl genpkey -algorithm ed25519 -out private_key.pem
openssl pkey -in private_key.pem -pubout -out public_key.pem

This is the part I don't quite understand! That's why I said "strangeness".

I suppose private_key.pem should be stored at your client side, while public_key.pem should be stored as ~/.ssh/authorized_keys in DD-WRT. You can do the later via NVRAM variable "sshd_authorized_keys", which is how the WEBUI function works. Just run the command "nvram show | grep ssh" to find related variables.

There are other methods of course. Just use imagination.

I really think the file extension ".pem" is too vague. It could mean many things, especially when you wanna use certificates. Wink

certificate - What is a Pem file and how does it differ from other OpenSSL Generated Key File Formats? - Server Fault
https://serverfault.com/questions/9708/what-is-a-pem-file-and-how-does-it-differ-from-other-openssl-generated-key-file

_________________
Router: Asus RT-N18U (rev. A1)

Drink, Blink, Stretch! Live long and prosper! May the Force and farces be with you!

Facebook: https://www.facebook.com/changmanwai
Website: https://sites.google.com/site/changmw
SETI@Home profile: http://setiathome.berkeley.edu/view_profile.php?userid=211832
GitHub: https://github.com/changmw/changmw
ho1Aetoo
DD-WRT Guru


Joined: 19 Feb 2019
Posts: 2968
Location: Germany

PostPosted: Thu Jun 08, 2023 12:29    Post subject: Reply with quote
@mwchang

do you have to give your opinion everywhere, even if you obviously have no clue?

https://goteleport.com/blog/comparing-ssh-keys/

EdDSA provides the highest security level compared to key length. It also improves on the insecurities found in ECDSA.

https://blog.peterruppel.de/ed25519-for-ssh/

Quote:
Ed25519 is considered to be secure (similar difficulty to breaking a ~3000-bit RSA key).
Creating a new signature with Ed25519 does not require a random input. This is very desirable from a security perspective (see the Playstation3 hack above...).
Ed25519 is resilient to hash-function collisions. This is good because it provides some additional protection in case the selected hash function contained some weakness.
Ed25519 is immune to cache-timing attacks, hyperthreading attacks, and other side-channel attacks that rely on leakage of addresses through the CPU cache. This is also very desirable from a security perspective.
Ed25519 does not use secret branch conditions, i.e., it is immune to side-channel attacks that rely on leakage of information through the branch-prediction unit.


droidus wrote:
What good is what for? It was mentioned to use ed25519 keys instead of rsa....


As I wrote before, RSA encryption can still be used, but the SSH client must be able to handle both RSA and! ed25519 (since the router fingerprint uses ed25519).

And as I wrote before you can easily create an ed25519 key pair in the router GUI (generate and download keys) if you don't have ssh-keygen or puttygen.

You don't need to play around in openssl.

_________________
Quickstart guides:
use Pi-Hole as simple DNS-Server with DD-WRT
VLAN configuration via GUI - 1 CPU port
VLAN configuration via GUI - 2 CPU ports (R7800, EA8500 etc)

Routers
Marvell OCTEON TX2 - QHora-322 - OpenWrt 23.05.3 - Gateway
Qualcomm IPQ8065 - R7800 - DD-WRT - WAP
droidus
DD-WRT User


Joined: 13 Mar 2014
Posts: 85

PostPosted: Thu Jun 08, 2023 12:34    Post subject: Reply with quote
Well, I am using ed25519 keys, for now. I saved, applied the settings, and rebooted the machine, and it still fails to connect with the same error message.
mwchang
DD-WRT Guru


Joined: 26 Mar 2013
Posts: 1856
Location: Hung Hom, Hong Kong

PostPosted: Thu Jun 08, 2023 12:37    Post subject: Reply with quote
ho1Aetoo wrote:
@mwchang

do you have to give your opinion everywhere, even if you obviously have no clue?

Sorry, my apology. Were just casual comments about the key length!!

Back to the DD-WRT way to deploy ed29915/EcDSA public and private keys! And its strangeness!! Smile

_________________
Router: Asus RT-N18U (rev. A1)

Drink, Blink, Stretch! Live long and prosper! May the Force and farces be with you!

Facebook: https://www.facebook.com/changmanwai
Website: https://sites.google.com/site/changmw
SETI@Home profile: http://setiathome.berkeley.edu/view_profile.php?userid=211832
GitHub: https://github.com/changmw/changmw
ho1Aetoo
DD-WRT Guru


Joined: 19 Feb 2019
Posts: 2968
Location: Germany

PostPosted: Thu Jun 08, 2023 12:41    Post subject: Reply with quote
@droidus

Then you have to use a proper client that also supports ed25519.

We have absolutely no idea what kind of garbage you are using.
And advice on this subject has been given to you before.

https://forum.dd-wrt.com/phpBB2/viewtopic.php?p=1279672#1279672

https://forum.dd-wrt.com/phpBB2/viewtopic.php?t=333540

_________________
Quickstart guides:
use Pi-Hole as simple DNS-Server with DD-WRT
VLAN configuration via GUI - 1 CPU port
VLAN configuration via GUI - 2 CPU ports (R7800, EA8500 etc)

Routers
Marvell OCTEON TX2 - QHora-322 - OpenWrt 23.05.3 - Gateway
Qualcomm IPQ8065 - R7800 - DD-WRT - WAP


Last edited by ho1Aetoo on Thu Jun 08, 2023 12:42; edited 1 time in total
mwchang
DD-WRT Guru


Joined: 26 Mar 2013
Posts: 1856
Location: Hung Hom, Hong Kong

PostPosted: Thu Jun 08, 2023 12:42    Post subject: Reply with quote
droidus wrote:
Well, I am using ed25519 keys, for now. I saved, applied the settings, and rebooted the machine, and it still fails to connect with the same error message.

You have to reboot the router per dale_gribble39 said, because converting NVRAM varaible sshd_authorized_keys to ~/.ssh/authorized_keys happens only during startup(??).

Be a bit patient... I can tell you that Windows 10's built-in OpenSSH works fine with the ed25519 key generated by DD-WRT. But there was some strangeness the last time I tried it. I have yet to attempt it again to find out why. I have since forgot about the steps I took.

_________________
Router: Asus RT-N18U (rev. A1)

Drink, Blink, Stretch! Live long and prosper! May the Force and farces be with you!

Facebook: https://www.facebook.com/changmanwai
Website: https://sites.google.com/site/changmw
SETI@Home profile: http://setiathome.berkeley.edu/view_profile.php?userid=211832
GitHub: https://github.com/changmw/changmw
Goto page 1, 2  Next Display posts from previous:    Page 1 of 2
Post new topic   Reply to topic    DD-WRT Forum Index -> General Questions All times are GMT

Navigation

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum