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 ssh keys not working after restarting container #262

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
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
1 change: 1 addition & 0 deletions src/ssh/sshd_start
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ if [[ "$SSH_ENABLE" == "1" ]]; then
sed 's@session\s*required\s*pam_loginuid.so@session optional pam_loginuid.so@g' -i /etc/pam.d/sshd
echo "export VISIBLE=now" >> /etc/profile

echo -e "\n" >> $PG_HOME/.ssh/authorized_keys # ensure new line
cat $PG_HOME/.ssh/id_rsa.pub >> $PG_HOME/.ssh/authorized_keys

echo '>>> STARTING SSH SERVER...'
Expand Down
9 changes: 8 additions & 1 deletion tests/ssh-connect/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,11 @@ CHECKED_TEXT=

if [[ "1" != `docker-compose exec pgmaster bash -c 'gosu postgres ssh -o LogLevel=QUIET -t pgslave1 "cat /tmp/ssh_check"' | grep SSH_CHECK | wc -l | tr -d ' '` ]]; then
exit 1
fi
fi

docker-compose restart pgslave
sleep 5

if [[ "1" != `docker-compose exec -T pgmaster bash -c 'gosu postgres ssh -o LogLevel=QUIET -t pgslave "cat /tmp/ssh_check"' | grep SSH_CHECK | wc -l | tr -d ' '` ]]; then
exit 1
fi