X-Git-Url: https://code.wpia.club/?a=blobdiff_plain;f=commands;h=aa2f8087a93a4f1fb5775e9eabf4b7f59f1dbcea;hb=b7f1b1ee842b3d37e74b3002b02368537199d0b9;hp=4dd7f4d359c750410694ad7ac9b24544fc425586;hpb=09f6b5ae971c8941e54e9f984ac2a5344a99a1e3;p=infra.git diff --git a/commands b/commands index 4dd7f4d..aa2f808 100755 --- a/commands +++ b/commands @@ -1,12 +1,12 @@ #!/bin/bash com="$SSH_ORIGINAL_COMMAND" -if [[ "$UID" == 0 ]]; then +if [[ $UID == 0 ]]; then echo "Run script as non-root-user" exit fi -if [[ "$com" == "update certs" || "$com" == "force update certs" ]]; then +if [[ $com == "update certs" || $com == "force update certs" ]]; then force=false - if [[ "$com" == "force update certs" ]]; then + if [[ $com == "force update certs" ]]; then force=true fi folder=$(mktemp -d) @@ -20,7 +20,7 @@ if [[ "$com" == "update certs" || "$com" == "force update certs" ]]; then openssl req -newkey rsa:4096 -subj "/CN=will-be-ignored" -nodes -out $folder/web.req -keyout $folder/web.key 2>/dev/null cat $folder/web.req read -r response - if [[ "$response" == "SUCCESS" ]]; then + if [[ $response == "SUCCESS" ]]; then # read certificate count read -r len printf '' > $folder/web.crt @@ -50,17 +50,18 @@ if [[ "$com" == "update certs" || "$com" == "force update certs" ]]; then update_cert "modules/gigi/files/gigi" update_cert "modules/gigi/files/client" update_cert "modules/gitweb/files/web" + update_cert "modules/motion/files/motion" echo "DONE" [[ -f $folder/web.crt ]] && rm $folder/web.crt [[ -f $folder/web.req ]] && rm $folder/web.req [[ -f $folder/web.key ]] && rm $folder/web.key rmdir $folder -elif [[ "$com" == "reload certs" ]]; then +elif [[ $com == "reload certs" ]]; then sudo puppet apply /etc/puppet/code/environments/production/manifests --verbose - sudo lxc-attach -n front-nginx -- puppet agent --verbose --test - sudo lxc-attach -n quiz -- puppet agent --verbose --test - sudo lxc-attach -n gigi -- puppet agent --verbose --test -elif [[ "$com" == "update crls" ]]; then + sudo lxc-attach -n front-nginx -- puppet agent --verbose --onetime --no-daemonize + sudo lxc-attach -n quiz -- puppet agent --verbose --onetime --no-daemonize + sudo lxc-attach -n gigi -- puppet agent --verbose --onetime --no-daemonize +elif [[ $com == "update crls" ]]; then if ! tar xv -C /data/crl; then echo "requiring tar" exit;