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

[bug] changing password to very long password (128 characters tested) locks user out of system if using dietpi-config #5849

Closed
t3dium opened this issue Oct 30, 2022 · 10 comments
Labels
Enhancement 💨 External bug 🐞 For bugs which are not caused by DietPi. Solution available 🥂 Definite solution has been done
Milestone

Comments

@t3dium
Copy link

t3dium commented Oct 30, 2022

When using dietpi config, entering a very long password locks the user out of the system. I've reproduced this bug on two seperate systems running dietpi and when changing the password via dietpi config, i get locked out of the system and ssh with that exact password fails.

Trying to change the password via passwd to the long one, succeeds however.

When using a shorter password, this issue isn't present. The long password was also purely numbers and letters, so the issue isn't related to symbols.

SSH server tested: default dropbear
Dietpi version: latest

Also pasted the password as opposed to typing obviously, so it couldn't be a spelling mistake.

@MichaIng
Copy link
Owner

I checked whether whiptail password boxes themselves have a limitation, but 135 characters worked well. Can you test whether it works this way, i.e. when you enter your long password into the input boxes, whether the echo prints it to console correctly?

G_WHIP_PASSWORD
echo "$result"
unset -v result

@t3dium
Copy link
Author

t3dium commented Oct 30, 2022

G_WHIP_PASSWORD
echo "$result"
unset -v result

How can i run this? i put it in a script and tried running with sh and bash, but it says command not found on the G_WHIP_PASSWORD line:

image

@MichaIng
Copy link
Owner

Run it from console directly instead of within a script. It is a shell function, hence not available in scripts if no dietpi-globals are loaded explicitly.

@t3dium
Copy link
Author

t3dium commented Oct 30, 2022

tried a dummy 128 character password, and using that method it returns the password in the echo
image

@MichaIng
Copy link
Owner

Then the only other possibility is that chpasswd handles it differently than passwd:

chpasswd <<< 'dietpi:yourlongpassword'

changes it for the dietpi user.

@MichaIng MichaIng added External bug 🐞 For bugs which are not caused by DietPi. and removed Investigating 🤔 labels Nov 9, 2022
@MichaIng
Copy link
Owner

MichaIng commented Nov 9, 2022

Tried (150x1):

chpasswd <<< 'dietpi:111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111'
login
# dietpi
# 111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111

works well. Setting the same password via dietpi-config works fine as well, with both root and dietpi logins via local console/login command. However, with Dropbear login, indeed the maximum number of characters is 100: With 101x1 it fails.

Switching to OpenSSH, login works, switching back to Dropbear, login fails. So clearly a Dropbear limitation.

@MichaIng
Copy link
Owner

MichaIng commented Nov 9, 2022

Indirectly documented here, although I don't understand the changelog entry fully, whether the limit was necessary to resolve another issue or whether (and then why) it existed already: https://github.com/mkj/dropbear/blob/b8669b0/CHANGES#L234-L235

@MichaIng
Copy link
Owner

MichaIng commented Nov 9, 2022

And here the related commit: mkj/dropbear@8b4f60a
Ah, Dropbear even seems to log it, I just didn't have a look into the server logs, to be true 😅.

MichaIng referenced this issue in mkj/dropbear Nov 9, 2022
MichaIng added a commit that referenced this issue Nov 9, 2022
- dietpi.txt | Add info that Dropbear does not support >100 character passwords: #5849
MichaIng added a commit that referenced this issue Nov 9, 2022
- DietPi-Set_software | Update/enhance password change texts, and add info about 100 character limit with Dropbear: #5849
@MichaIng
Copy link
Owner

MichaIng commented Nov 9, 2022

Added info to dietpi.txt: 390312d
And on the interactive password change prompt: 10b566a

@MichaIng MichaIng added this to the v8.11 milestone Nov 9, 2022
@MichaIng MichaIng added Enhancement 💨 Solution available 🥂 Definite solution has been done labels Nov 9, 2022
@t3dium
Copy link
Author

t3dium commented Nov 11, 2022

Perfect thanks

@t3dium t3dium closed this as completed Nov 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement 💨 External bug 🐞 For bugs which are not caused by DietPi. Solution available 🥂 Definite solution has been done
Projects
None yet
Development

No branches or pull requests

2 participants