2024-01-05 10:42:17 +00:00
|
|
|
#!/bin/bash
|
|
|
|
## Generate TLS certificate for a new subdomain
|
|
|
|
|
2024-01-17 13:35:06 +00:00
|
|
|
DMZKEYFILE=$(echo -n ~)"/.ssh/dmz"
|
2024-01-05 10:42:17 +00:00
|
|
|
|
|
|
|
NGINXHOST=$1
|
|
|
|
SUBDOMAIN=$2
|
2024-01-27 21:37:26 +00:00
|
|
|
CTIPADDRESS=$3
|
2024-01-05 10:42:17 +00:00
|
|
|
|
|
|
|
if [[ -z "$NGINXHOST" ]]; then
|
|
|
|
echo "Set Nginx Host"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [[ -z "$SUBDOMAIN" ]]; then
|
|
|
|
echo "Set subdomain"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2024-01-27 21:37:26 +00:00
|
|
|
|
2024-01-05 10:42:17 +00:00
|
|
|
ssh-add -t 200 $DMZKEYFILE
|
|
|
|
torsocks scp ./remotecmd $NGINXHOST:/root/remotecmd.sh
|
2024-01-22 16:02:28 +00:00
|
|
|
torsocks scp ./subdomain.dmz.rs.http $NGINXHOST:/etc/nginx/sites-available/
|
|
|
|
torsocks scp ./subdomain.dmz.rs.https $NGINXHOST:/etc/nginx/sites-available/
|
2024-01-05 10:42:17 +00:00
|
|
|
|
2024-01-27 21:37:26 +00:00
|
|
|
if [[ -z "$CTIPADDRESS" ]]; then
|
|
|
|
torsocks scp ./subdomain.dmz.rs.proxy $NGINXHOST:/etc/nginx/sites-available/
|
|
|
|
fi
|
|
|
|
|
2024-01-05 10:42:17 +00:00
|
|
|
torsocks ssh $NGINXHOST "chmod +x /root/remotecmd.sh; /root/remotecmd.sh $SUBDOMAIN"
|
|
|
|
|