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

fix(BA-459): password based SSH login not working #3387

Merged
merged 2 commits into from
Jan 8, 2025
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
fix: password based SSH login not working
kyujin-cho committed Jan 6, 2025
commit 50a113d32b2dbeebf451504b4d344129c015bc00
4 changes: 2 additions & 2 deletions src/ai/backend/runner/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -55,7 +55,7 @@ if [ $USER_ID -eq 0 ]; then
/opt/backend.ai/bin/python -s /opt/kernel/fantompass.py > "$HOME/.password"
export ALPHA_NUMERIC_VAL=$(cat $HOME/.password)
chmod 0644 "$HOME/.password"
echo "work:$ALPHA_NUMERIC_VAL" | chpasswd
echo "work:$ALPHA_NUMERIC_VAL" | chpasswd -c SHA512
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the case where the issue occurred, there shouldn’t be a problem since there were no previously stored hash values, right?
In the normal operation scenario, hash values would have been stored, but changing the hashing algorithm shouldn’t cause any issues?

Copy link
Member Author

@kyujin-cho kyujin-cho Jan 8, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can find that Ubuntu introduced SHA512 password hashing algorithm at 8.10 and RHEL from 5. So yes, at least for the Linux distros supported by Backend.AI, it will be fine to fix the password hashing method as SHA512.

fi

echo "Executing the main program..."
@@ -132,7 +132,7 @@ else
/opt/kernel/su-exec $USER_ID:$GROUP_ID /opt/backend.ai/bin/python -s /opt/kernel/fantompass.py > "$HOME/.password"
export ALPHA_NUMERIC_VAL=$(cat $HOME/.password)
chmod 0644 "$HOME/.password"
echo "$USER_NAME:$ALPHA_NUMERIC_VAL" | chpasswd
echo "$USER_NAME:$ALPHA_NUMERIC_VAL" | chpasswd -c SHA512
fi

# The gid 42 is a reserved gid for "shadow" to allow passwrd-based SSH login. (lablup/backend.ai#751)