elitak / nixos-infect

[GPLv3+] install nixos over the existing OS in a DigitalOcean droplet (and others with minor modifications)
GNU General Public License v3.0
1.3k stars 214 forks source link

Trimming SSH lines removes spaces from them #170

Closed KamilaBorowska closed 11 months ago

KamilaBorowska commented 11 months ago

In #165, trimming user keys was introduced. This appears to be buggy, removing spaces from keys.

$ line='ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIK8rVxv/PJRJPXrsbaOL/aR7W9TPsGyjfV2Y+HutuDoH'

$ line=$(echo -n "$line" | sed 's/\r//g')

$ echo $line
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIK8rVxv/PJRJPXrsbaOL/aR7W9TPsGyjfV2Y+HutuDoH

$ trimmed_line=$(echo -n "$line" | tr -d '[:space:]')

$ echo $trimmed_line
ssh-ed25519AAAAC3NzaC1lZDI1NTE5AAAAIK8rVxv/PJRJPXrsbaOL/aR7W9TPsGyjfV2Y+HutuDoH

Note how space was removed from SSH key after ssh-ed25519 making it unusable.

ghost commented 11 months ago

experiencing similar behavior which led to my machines being unusable. it's probably best to fork based off of the last known good commit hash and move forward.

i'm using this without issue.