Skip to content

Commit

Permalink
Fix the init for Kerberos with password auth
Browse files Browse the repository at this point in the history
A number of 5 attempts has been added to avoid infinite loop if
a fatal error of the Kerberos server.

Also the die function has been fixed to escape special char with \$,
else empty message was given.
  • Loading branch information
glegoux committed Nov 14, 2024
1 parent 6311a6c commit 63362c6
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions script/init.sh
Original file line number Diff line number Diff line change
Expand Up @@ -42,15 +42,18 @@ echo "=== Init "${machine_container}" docker container ==="
docker exec "${machine_container}" /bin/bash -c "
die() {
>&2 echo \"$1\"
>&2 echo \$1
exit 1
}
echo '* Kerberos password authentication:'
until echo bob | kinit bob@${REALM_KRB5}; do
(for attempt in {1..5}; do
echo bob | kinit bob@${REALM_KRB5} && exit
echo Waiting for kerberos server started ...
sleep 1
done
echo attempt=\${attempt}
[ \${attempt} -eq 5 ] && exit 1
done) && echo OK || die KO
echo '* Kerberos keytab authentication:'
kinit -kt /etc/bob.keytab bob@${REALM_KRB5} && echo OK || die KO
Expand Down

0 comments on commit 63362c6

Please sign in to comment.