Actions
Bug #24600
closedRoot password is sometimes not encrypted correctly
Description
Looks like we use SecureRandom in BASE64 for random seed and when it contains plus + it breaks the crypt method:
>> x = SecureRandom.base64(6); puts x; "test".crypt("$5$#{x}") ardeALd3 => "$5$ardeALd3$Qok7xO6ConFcg0KasVX4FRrm/FNABHsL7h2xnNh0uo1" >> x = SecureRandom.base64(6); puts x; "test".crypt("$5$#{x}") MWpOs+Y5 => "*0"
This is an ancient code in Foreman, root password had to “sometimes” set incorrectly when saved into database.
Linux crypt method accepts up to 16 characters long salt with characters [a-zA-Z0-9./]
while base64 encoding creates [a-zA-Z0-9+=/]
. This needs to be properly mapped. Maximum length without padding is 12 characters, therefore this is the suggested new salt.
Actions