-
Notifications
You must be signed in to change notification settings - Fork 23
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
feat: add ktutil and a helper script to our images #720
Merged
Merged
Changes from 3 commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
46 changes: 46 additions & 0 deletions
46
output/docker-stacks-datascience-notebook/ktutil-keytab.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
#!/bin/bash | ||
# creates the kerberos directory if not exist | ||
mkdir -p ~/krb5 | ||
cd ~/krb5 | ||
|
||
# gets the user's username (legacy AD) | ||
read -p "Username(ex. marcoma):" user_name | ||
|
||
user_name="${user_name}@STATCAN.CA" | ||
wg102 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
# gets the user's password | ||
read -sp "Password for ${user_name}:" user_pass | ||
|
||
# deletes the password prompt for cleaner output | ||
echo -en "\r\e[K" | ||
|
||
{ | ||
# adds entry for user, and requests password | ||
echo "addent -password -p ${user_name} -k 1 -e RC4-HMAC"; | ||
# give password entered by user to ktutil | ||
echo "$user_pass" | ||
# creates keytab file | ||
echo "wkt client.keytab"; | ||
} | ktutil | ||
|
||
# get the current namespace | ||
NS=$(kubectl get sa -o=jsonpath='{.items[0]..metadata.namespace}') | ||
|
||
# generate the secret | ||
kubectl create secret generic kerberos-keytab -n $NS --from-file=./client.keytab -o yaml --dry-run=client > ktutil_keytab.yaml | ||
|
||
# apply the secret | ||
kubectl apply -f ./ktutil_keytab.yaml | ||
|
||
|
||
#get the notebook name | ||
nb_name=${NB_PREFIX##*/} | ||
|
||
# Prompt user for notebook restart | ||
while true; do | ||
read -p "In order to update the kerberos authentication, the notebook server needs to be restarted. Would you like to restart your notebook server?[Y/n]: " yn | ||
case $yn in | ||
[Yy]* ) echo "Your notebook server will now restart"; kubectl rollout restart statefulset $nb_name -n $NB_NAMESPACE; break;; | ||
[Nn]* ) echo "Your notebook server will not be restarted"; exit;; | ||
* ) echo "Only yes or no is an expected answer";; | ||
esac | ||
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
#!/bin/bash | ||
# creates the kerberos directory if not exist | ||
mkdir -p ~/krb5 | ||
cd ~/krb5 | ||
|
||
# gets the user's username (legacy AD) | ||
read -p "Username(ex. marcoma):" user_name | ||
|
||
user_name="${user_name}@STATCAN.CA" | ||
# gets the user's password | ||
read -sp "Password for ${user_name}:" user_pass | ||
|
||
# deletes the password prompt for cleaner output | ||
echo -en "\r\e[K" | ||
|
||
{ | ||
# adds entry for user, and requests password | ||
echo "addent -password -p ${user_name} -k 1 -e RC4-HMAC"; | ||
# give password entered by user to ktutil | ||
echo "$user_pass" | ||
# creates keytab file | ||
echo "wkt client.keytab"; | ||
} | ktutil | ||
|
||
# get the current namespace | ||
NS=$(kubectl get sa -o=jsonpath='{.items[0]..metadata.namespace}') | ||
|
||
# generate the secret | ||
kubectl create secret generic kerberos-keytab -n $NS --from-file=./client.keytab -o yaml --dry-run=client > ktutil_keytab.yaml | ||
|
||
# apply the secret | ||
kubectl apply -f ./ktutil_keytab.yaml | ||
|
||
|
||
#get the notebook name | ||
nb_name=${NB_PREFIX##*/} | ||
|
||
# Prompt user for notebook restart | ||
while true; do | ||
read -p "In order to update the kerberos authentication, the notebook server needs to be restarted. Would you like to restart your notebook server?[Y/n]: " yn | ||
case $yn in | ||
[Yy]* ) echo "Your notebook server will now restart"; kubectl rollout restart statefulset $nb_name -n $NB_NAMESPACE; break;; | ||
[Nn]* ) echo "Your notebook server will not be restarted"; exit;; | ||
* ) echo "Only yes or no is an expected answer";; | ||
esac | ||
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
#!/bin/bash | ||
# creates the kerberos directory if not exist | ||
mkdir -p ~/krb5 | ||
cd ~/krb5 | ||
|
||
# gets the user's username (legacy AD) | ||
read -p "Username(ex. marcoma):" user_name | ||
|
||
user_name="${user_name}@STATCAN.CA" | ||
# gets the user's password | ||
read -sp "Password for ${user_name}:" user_pass | ||
|
||
# deletes the password prompt for cleaner output | ||
echo -en "\r\e[K" | ||
|
||
{ | ||
# adds entry for user, and requests password | ||
echo "addent -password -p ${user_name} -k 1 -e RC4-HMAC"; | ||
# give password entered by user to ktutil | ||
echo "$user_pass" | ||
# creates keytab file | ||
echo "wkt client.keytab"; | ||
} | ktutil | ||
|
||
# get the current namespace | ||
NS=$(kubectl get sa -o=jsonpath='{.items[0]..metadata.namespace}') | ||
|
||
# generate the secret | ||
kubectl create secret generic kerberos-keytab -n $NS --from-file=./client.keytab -o yaml --dry-run=client > ktutil_keytab.yaml | ||
|
||
# apply the secret | ||
kubectl apply -f ./ktutil_keytab.yaml | ||
|
||
|
||
#get the notebook name | ||
nb_name=${NB_PREFIX##*/} | ||
|
||
# Prompt user for notebook restart | ||
while true; do | ||
read -p "In order to update the kerberos authentication, the notebook server needs to be restarted. Would you like to restart your notebook server?[Y/n]: " yn | ||
case $yn in | ||
[Yy]* ) echo "Your notebook server will now restart"; kubectl rollout restart statefulset $nb_name -n $NB_NAMESPACE; break;; | ||
[Nn]* ) echo "Your notebook server will not be restarted"; exit;; | ||
* ) echo "Only yes or no is an expected answer";; | ||
esac | ||
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
#!/bin/bash | ||
# creates the kerberos directory if not exist | ||
mkdir -p ~/krb5 | ||
cd ~/krb5 | ||
|
||
# gets the user's username (legacy AD) | ||
read -p "Username(ex. marcoma):" user_name | ||
|
||
user_name="${user_name}@STATCAN.CA" | ||
# gets the user's password | ||
read -sp "Password for ${user_name}:" user_pass | ||
|
||
# deletes the password prompt for cleaner output | ||
echo -en "\r\e[K" | ||
|
||
{ | ||
# adds entry for user, and requests password | ||
echo "addent -password -p ${user_name} -k 1 -e RC4-HMAC"; | ||
# give password entered by user to ktutil | ||
echo "$user_pass" | ||
# creates keytab file | ||
echo "wkt client.keytab"; | ||
} | ktutil | ||
|
||
# get the current namespace | ||
NS=$(kubectl get sa -o=jsonpath='{.items[0]..metadata.namespace}') | ||
|
||
# generate the secret | ||
kubectl create secret generic kerberos-keytab -n $NS --from-file=./client.keytab -o yaml --dry-run=client > ktutil_keytab.yaml | ||
|
||
# apply the secret | ||
kubectl apply -f ./ktutil_keytab.yaml | ||
|
||
|
||
#get the notebook name | ||
nb_name=${NB_PREFIX##*/} | ||
|
||
# Prompt user for notebook restart | ||
while true; do | ||
read -p "In order to update the kerberos authentication, the notebook server needs to be restarted. Would you like to restart your notebook server?[Y/n]: " yn | ||
case $yn in | ||
[Yy]* ) echo "Your notebook server will now restart"; kubectl rollout restart statefulset $nb_name -n $NB_NAMESPACE; break;; | ||
[Nn]* ) echo "Your notebook server will not be restarted"; exit;; | ||
* ) echo "Only yes or no is an expected answer";; | ||
esac | ||
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
#!/bin/bash | ||
# creates the kerberos directory if not exist | ||
mkdir -p ~/krb5 | ||
cd ~/krb5 | ||
|
||
# gets the user's username (legacy AD) | ||
read -p "Username(ex. marcoma):" user_name | ||
|
||
user_name="${user_name}@STATCAN.CA" | ||
# gets the user's password | ||
read -sp "Password for ${user_name}:" user_pass | ||
|
||
# deletes the password prompt for cleaner output | ||
echo -en "\r\e[K" | ||
|
||
{ | ||
# adds entry for user, and requests password | ||
echo "addent -password -p ${user_name} -k 1 -e RC4-HMAC"; | ||
# give password entered by user to ktutil | ||
echo "$user_pass" | ||
# creates keytab file | ||
echo "wkt client.keytab"; | ||
} | ktutil | ||
|
||
# get the current namespace | ||
NS=$(kubectl get sa -o=jsonpath='{.items[0]..metadata.namespace}') | ||
|
||
# generate the secret | ||
kubectl create secret generic kerberos-keytab -n $NS --from-file=./client.keytab -o yaml --dry-run=client > ktutil_keytab.yaml | ||
|
||
# apply the secret | ||
kubectl apply -f ./ktutil_keytab.yaml | ||
|
||
|
||
#get the notebook name | ||
nb_name=${NB_PREFIX##*/} | ||
|
||
# Prompt user for notebook restart | ||
while true; do | ||
read -p "In order to update the kerberos authentication, the notebook server needs to be restarted. Would you like to restart your notebook server?[Y/n]: " yn | ||
case $yn in | ||
[Yy]* ) echo "Your notebook server will now restart"; kubectl rollout restart statefulset $nb_name -n $NB_NAMESPACE; break;; | ||
[Nn]* ) echo "Your notebook server will not be restarted"; exit;; | ||
* ) echo "Only yes or no is an expected answer";; | ||
esac | ||
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
#!/bin/bash | ||
# creates the kerberos directory if not exist | ||
mkdir -p ~/krb5 | ||
cd ~/krb5 | ||
|
||
# gets the user's username (legacy AD) | ||
read -p "Username(ex. marcoma):" user_name | ||
|
||
user_name="${user_name}@STATCAN.CA" | ||
# gets the user's password | ||
read -sp "Password for ${user_name}:" user_pass | ||
|
||
# deletes the password prompt for cleaner output | ||
echo -en "\r\e[K" | ||
|
||
{ | ||
# adds entry for user, and requests password | ||
echo "addent -password -p ${user_name} -k 1 -e RC4-HMAC"; | ||
# give password entered by user to ktutil | ||
echo "$user_pass" | ||
# creates keytab file | ||
echo "wkt client.keytab"; | ||
} | ktutil | ||
|
||
# get the current namespace | ||
NS=$(kubectl get sa -o=jsonpath='{.items[0]..metadata.namespace}') | ||
|
||
# generate the secret | ||
kubectl create secret generic kerberos-keytab -n $NS --from-file=./client.keytab -o yaml --dry-run=client > ktutil_keytab.yaml | ||
|
||
# apply the secret | ||
kubectl apply -f ./ktutil_keytab.yaml | ||
|
||
|
||
#get the notebook name | ||
nb_name=${NB_PREFIX##*/} | ||
|
||
# Prompt user for notebook restart | ||
while true; do | ||
read -p "In order to update the kerberos authentication, the notebook server needs to be restarted. Would you like to restart your notebook server?[Y/n]: " yn | ||
case $yn in | ||
[Yy]* ) echo "Your notebook server will now restart"; kubectl rollout restart statefulset $nb_name -n $NB_NAMESPACE; break;; | ||
[Nn]* ) echo "Your notebook server will not be restarted"; exit;; | ||
* ) echo "Only yes or no is an expected answer";; | ||
esac | ||
done |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should there be a prompt/instructions for the user to know to run this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is a ticket to define those instructions in the docs to let users know what to do
https://jirab.statcan.ca/browse/BTIS-686