Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

atlas-sw-probe is heavily broken #25588

Open
LegendaryYbarro2005 opened this issue Dec 21, 2024 · 1 comment
Open

atlas-sw-probe is heavily broken #25588

LegendaryYbarro2005 opened this issue Dec 21, 2024 · 1 comment

Comments

@LegendaryYbarro2005
Copy link

Maintainer: @ja-pa and @BKPepe
Environment: All
Software: OpenWrt 24.10.0-rc2 r28161-ea17e958b9 and SNAPSHOT (as of 2024-12-21)

Description:
I installed the packages atlas-sw-probe. Then setup via instruction in manual guide. That worked well with OpenWrt 23.05 and 22.03. OpenWrt 24.10.0-rc2 (as well in snapshots releases) on x86_64 VM gave me the error while creating the key:

root@OpenWrt:~# /etc/init.d/atlas create_key
Unknown argument -b
Usage: ssh-keygen -t <type> -f <filename> [-s bits]
-t type Type of key to generate. One of:
                rsa
                ed25519
-f filename    Use filename for the secret key.
               ~/.ssh/id_dropbear is recommended for client keys.
-s bits Key size in bits, should be a multiple of 8 (optional)
           Ed25519 has a fixed size of 256 bits
-y              Just print the publickey and fingerprint for the
                private key in <filename>.
-C              Specify the key comment (email).
sed: /etc/atlas/probe_key.pub: No such file or directory
ln: /usr/libexec/atlas-probe-scripts/etc/probe_key: File exists
ln: /usr/libexec/atlas-probe-scripts/etc/probe_key.pub: File exists
chown: /etc/atlas/probe_key: No such file or directory
chown: /etc/atlas/probe_key.pub: No such file or directory
chgrp: /etc/atlas/probe_key: No such file or directory
chgrp: /etc/atlas/probe_key.pub: No such file or directory
chmod: /etc/atlas/probe_key: No such file or directory
chmod: /etc/atlas/probe_key.pub: No such file or directory
Key generated successfully. Use the get_key command to show the public key and get instruction on how to register your probe.
root@OpenWrt:~#

Running /etc/init.d/atlas get_key to print the key in the terminal and doesn't work:

root@OpenWrt:~# /etc/init.d/atlas get_key
Error! Pub. key not found
root@OpenWrt:~#

The atlas-sw-probe package is out of date. I have tried to update it but unfortunately, I don't have enough knowledge to do it myself, and as i'm trying to update the package, it needs the latest version.

Not sure this is the right place to post this issue, please redirect me on the right place.

Thanks!

@GrumpyMeow
Copy link
Contributor

GrumpyMeow commented Jan 13, 2025

Hi! I'm looking at the code to see what's going on. It seems to me that the might be related to two different versions of ssh-keygen.
On my buildbot-environment (Debian) i get this:

usage: ssh-keygen [-q] [-a rounds] [-b bits] [-C comment] [-f output_keyfile]
                  [-m format] [-N new_passphrase] [-O option]
                  [-t dsa | ecdsa | ecdsa-sk | ed25519 | ed25519-sk | rsa]
                  [-w provider]

While on my router-environment (Busybox) i get this:

Usage: ssh-keygen -t <type> -f <filename> [-s bits]
-t type Type of key to generate. One of:
                rsa
                ed25519
-f filename    Use filename for the secret key.
               ~/.ssh/id_dropbear is recommended for client keys.
-s bits Key size in bits, should be a multiple of 8 (optional)
           Ed25519 has a fixed size of 256 bits
-y              Just print the publickey and fingerprint for the
                private key in <filename>.
-C              Specify the key comment (email).

So on Busybox the -b parameter does not exist...
If i install the openssh-keygen package on my router with: apk add openssh-keygen this will "override" the busybox version. If i then again run ssh-keygen i see:

usage: ssh-keygen [-q] [-a rounds] [-b bits] [-C comment] [-f output_keyfile]
                  [-m format] [-N new_passphrase] [-O option]
                  [-t dsa | ecdsa | ecdsa-sk | ed25519 | ed25519-sk | rsa]
                  [-w provider] [-Z cipher]

As a workaround you could try installing the package.

if [ -n "$(which ssh-keygen)" ]; then
		ssh-keygen -t rsa -b 2048 -f $probe_key -N ""
		sed -i "s/ \S*$/ "$username"/" $probe_pub_key
	elif [ -n "$(which dropbearkey)" ] && [ -n "$(which dropbearconvert)" ]; then

I think that i understand what is going on here. It tries to find ssh-keygen (openssh-keygen) and uses it when it's found. If not it tries to find and use dropbearkey (dropbear version of ssh-keygen). It might be that recently a package (busybox or dropbear) started to provide the alias ssh-keygen.

During the installation of Dropbear:

add alternative: /usr/bin/ssh-keygen -> /usr/sbin/dropbear
add alternative: /usr/bin/scp -> /usr/sbin/dropbear
add alternative: /usr/bin/ssh -> /usr/sbin/dropbear

Hope this helps...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants