Revisions
-
ITler revised this gist
Feb 11, 2020 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -1,7 +1,7 @@ #! /usr/bin/env bash # normally first char of prename + surname users="${@:-jsmith}" # normally users group="users" -
ITler revised this gist
Aug 5, 2019 . 1 changed file with 0 additions and 23 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -1,23 +0,0 @@ -
ITler revised this gist
Aug 5, 2019 . 1 changed file with 23 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,23 @@ #!/bin/sh get_clean_message() { egrep -o '^[^#].*' "$1" } # Do not allow empty messages after removing comments [ -z "$(get_clean_message "$1")" ] && { echo >&2 Commit message cannot be empty. exit 1 } # Prepend to message Jira issues found in branch name but not found within message JIRAS_IN_BRANCH_NAME="$(git rev-parse --abbrev-ref HEAD | egrep -io '\b[a-z]{3,}-[1-9][0-9]*\b')" for JIRA in ${JIRAS_IN_BRANCH_NAME}; do get_clean_message "$1" | egrep "\b${JIRA}\b" || sed -i "" -e "1s/^/${JIRA}, /" "$1" done if [ -z "${JIRAS_IN_BRANCH_NAME}" ]; then # Allow non prefixed commit messages, when branch name not referring JIRA issue get_clean_message "$1" | egrep -qi '\b[a-z]{3,}-[1-9][0-9]*\b' || { echo >&2 Commit message does not contain JIRA code. Consider amending message before pushing. } fi -
ITler revised this gist
Aug 1, 2019 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -20,7 +20,7 @@ for user in ${users}; do [ -f "${auth_keys_file}" ] || install -b -m 0600 /dev/null ${auth_keys_file} if [[ -r ${all_auth_keys_file} && $(grep ${user} ${all_auth_keys_file}) ]]; then echo "Found user's SSH key in authorized_keys database ${all_auth_keys_file} file" cat ${all_auth_keys_file} >>${auth_keys_file} else echo "SSH key for user ${user} not found in authorized_keys database ${all_auth_keys_file}, so add key manually" echo "Now paste user's SSH pub key here, make sure to end with new line and press CTRL+D to exit" -
ITler revised this gist
Aug 1, 2019 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -9,7 +9,7 @@ group="users" # normally adm and/or sudo groups="adm,sudo" # optional file containing all known SSH pub keys in authorized_keys format all_auth_keys_file=$(dirname $0)/authkeys for user in ${users}; do -
ITler revised this gist
Aug 1, 2019 . 1 changed file with 12 additions and 3 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -9,15 +9,24 @@ group="users" # normally adm and/or sudo groups="adm,sudo" # optional file containing all known SSH pub keys in authorized_key format all_auth_keys_file=$(dirname $0)/authkeys for user in ${users}; do auth_keys_file=/home/${user}/.ssh/authorized_keys echo "Creating access for user: ${user}" useradd -s /bin/bash -m ${user} -g ${group} -G ${groups} -c "manually created on $(date +%Y%m%d-%H%M%S)" mkdir -m 0700 /home/${user}/.ssh [ -f "${auth_keys_file}" ] || install -b -m 0600 /dev/null ${auth_keys_file} if [[ -r ${all_auth_keys_file} && $(grep ${user} ${all_auth_keys_file}) ]]; then echo "Found user's SSH key in authorized_keys database ${all_auth_keys_file} file" cat ${all_auth_keys_file} >> ${auth_keys_file} else echo "SSH key for user ${user} not found in authorized_keys database ${all_auth_keys_file}, so add key manually" echo "Now paste user's SSH pub key here, make sure to end with new line and press CTRL+D to exit" echo ${auth_keys_file} cat >>${auth_keys_file} fi sed -i "/.*${user}.*/!d" ${auth_keys_file} echo "SSH pub key stored in ${auth_keys_file}" chown -R ${user}:${group} $(dirname ${auth_keys_file}) -
ITler revised this gist
Jul 1, 2019 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -18,7 +18,7 @@ for user in ${users}; do echo "Paste user's SSH pub key here, make sure to end with new line and press CTRL+D to exit" echo ${auth_keys_file} cat >>${auth_keys_file} sed -i "/.*${user}.*/!d" ${auth_keys_file} echo "SSH pub key stored in ${auth_keys_file}" chown -R ${user}:${group} $(dirname ${auth_keys_file}) echo -e "... User '${user}' done\n" -
ITler revised this gist
Jul 1, 2019 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -18,7 +18,7 @@ for user in ${users}; do echo "Paste user's SSH pub key here, make sure to end with new line and press CTRL+D to exit" echo ${auth_keys_file} cat >>${auth_keys_file} sed -i "/.*${user}.*/\!d" ${auth_keys_file} echo "SSH pub key stored in ${auth_keys_file}" chown -R ${user}:${group} $(dirname ${auth_keys_file}) echo -e "... User '${user}' done\n" -
ITler revised this gist
Jul 1, 2019 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -18,7 +18,7 @@ for user in ${users}; do echo "Paste user's SSH pub key here, make sure to end with new line and press CTRL+D to exit" echo ${auth_keys_file} cat >>${auth_keys_file} sed -i "" "/.*${user}.*/\!d" ${auth_keys_file} echo "SSH pub key stored in ${auth_keys_file}" chown -R ${user}:${group} $(dirname ${auth_keys_file}) echo -e "... User '${user}' done\n" -
ITler revised this gist
Jul 1, 2019 . 1 changed file with 1 addition and 0 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -18,6 +18,7 @@ for user in ${users}; do echo "Paste user's SSH pub key here, make sure to end with new line and press CTRL+D to exit" echo ${auth_keys_file} cat >>${auth_keys_file} sed -i "" "/.*${u}.*/\!d" ${auth_keys_file} echo "SSH pub key stored in ${auth_keys_file}" chown -R ${user}:${group} $(dirname ${auth_keys_file}) echo -e "... User '${user}' done\n" -
nils-wagner-signavio revised this gist
May 13, 2019 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -6,7 +6,7 @@ users="${@:-nwagner}" # normally users group="users" # normally adm and/or sudo groups="adm,sudo" for user in ${users}; do -
nils-wagner-signavio created this gist
May 13, 2019 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,24 @@ #! /usr/bin/env bash # normally first char of prename + surname users="${@:-nwagner}" # normally users group="users" # normally adm and or sudo groups="adm,sudo" for user in ${users}; do auth_keys_file=/home/${user}/.ssh/authorized_keys echo "Creating access for user: ${user}" useradd -s /bin/bash -m ${user} -g ${group} -G ${groups} -c "manually created on $(date +%Y%m%d-%H%M%S)" mkdir -m 0700 /home/${user}/.ssh [ -f "${auth_keys_file}" ] || install -b -m 0600 /dev/null ${auth_keys_file} echo "Paste user's SSH pub key here, make sure to end with new line and press CTRL+D to exit" echo ${auth_keys_file} cat >>${auth_keys_file} echo "SSH pub key stored in ${auth_keys_file}" chown -R ${user}:${group} $(dirname ${auth_keys_file}) echo -e "... User '${user}' done\n" done