ok maybe tho
All checks were successful
gitea.arg.rip/deployment/pipeline/head This commit looks good

This commit is contained in:
adam 2024-12-06 18:20:35 -05:00
parent d24a36d7aa
commit a98147901c
2 changed files with 4 additions and 3 deletions

View File

@ -222,7 +222,7 @@ pipeline {
curl -u '${env.GITEA_USR}:${env.GITEATOKEN}' https://gitea.arg.rip/greyn/deployment/raw/branch/service/scripts/serviceaccount.sh --output serviceaccount.sh curl -u '${env.GITEA_USR}:${env.GITEATOKEN}' https://gitea.arg.rip/greyn/deployment/raw/branch/service/scripts/serviceaccount.sh --output serviceaccount.sh
sed -i 's/USERNAMETOADD=/USERNAMETOADD="${servicename}"/' serviceaccount.sh sed -i 's/USERNAMETOADD=/USERNAMETOADD="${servicename}"/' serviceaccount.sh
sed -i 's/PASSWORDTOADD=/PASSWORDTOADD="${env.pw_linuxserviceaccount}"/' serviceaccount.sh sed -i 's/PASSWORDTOADD=/PASSWORDTOADD="${env.pw_linuxserviceaccount}"/' serviceaccount.sh
sed -i 's/PUBKEYCONTENT=/PUBKEYCONTENT="\$(cat ${servicename}-ssh.pub)"/' serviceaccount.sh sed -i "s/PUBKEYCONTENT=/PUBKEYCONTENT=\"\$(cat ${servicename}-ssh.pub)"/\" serviceaccount.sh
sed -i 's/SUDOER_PSW=/SUDOER_PSW="${SUDOER_PSW}"/' serviceaccount.sh sed -i 's/SUDOER_PSW=/SUDOER_PSW="${SUDOER_PSW}"/' serviceaccount.sh
echo "serviceaccount :)" echo "serviceaccount :)"

View File

@ -12,10 +12,11 @@ function restofscript(){
cd ~/home/${USERNAMETOADD} cd ~/home/${USERNAMETOADD}
mkdir .ssh mkdir .ssh
pushd .ssh pushd .ssh
echo ${PUBKEYCONTENT} > authorized_keys pwd
echo ${PUBKEYCONTENT} >> authorized_keys
chmod 600 authorized_keys chmod 600 authorized_keys
popd popd
chown -R '${USERNAMETOADD}:${USERNAMETOADD}' .ssh chown -R "${USERNAMETOADD}:${USERNAMETOADD}" .ssh
} }
echo "${SUDOER_PSW}" | sudo -S bash -c "$(declare -f restofscript); restofscript" echo "${SUDOER_PSW}" | sudo -S bash -c "$(declare -f restofscript); restofscript"