[WIP] nginx related script
[WIP] automatize new nginx reverse proxy entry config, SSL certificate generation and verification
This commit is contained in:
commit
968b5836f1
1 changed files with 48 additions and 0 deletions
48
autonginx
Normal file
48
autonginx
Normal file
|
|
@ -0,0 +1,48 @@
|
||||||
|
#!/usr/bin/env sh
|
||||||
|
|
||||||
|
USAGE="usage: autonginx <URL> <IP> <PORT>
|
||||||
|
|
||||||
|
URL: url à laquelle le service sera accessible (exemple.urlab.be)
|
||||||
|
IP: adresse ip locale du service (127.0.0.1 si sur cette machine, 172.23.100.X sinon)
|
||||||
|
PORT: port utilisé par le service (entre 1 et 65535; certains ports sont déjà utilisés)"
|
||||||
|
|
||||||
|
error(){
|
||||||
|
echo "$USAGE"
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
sanitize()
|
||||||
|
{
|
||||||
|
if ! [ "$PORT" -eq "$PORT" ] 2> /dev/null; then
|
||||||
|
error
|
||||||
|
fi
|
||||||
|
if 1 "<" PORT ">" 65535 ; then
|
||||||
|
error
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
if [ $# != 3 ]; then
|
||||||
|
error
|
||||||
|
fi
|
||||||
|
|
||||||
|
URL="$1"
|
||||||
|
IP="$2"
|
||||||
|
PORT="$3"
|
||||||
|
|
||||||
|
sanitize
|
||||||
|
|
||||||
|
echo "$URL"
|
||||||
|
echo "$IP"
|
||||||
|
echo "$PORT"
|
||||||
|
# sanitize input
|
||||||
|
# port entre 1 et 65535
|
||||||
|
# url de la forme *.urlab.be
|
||||||
|
# ip soit 127.0.0.1 soit 172.23.100.X, X entre 2 et 254
|
||||||
|
# verifier input
|
||||||
|
# ping ip
|
||||||
|
# check si port utilisé
|
||||||
|
#
|
||||||
|
#
|
||||||
|
# generate config, put it in right location
|
||||||
|
# generate ssl certificate
|
||||||
|
|
||||||
Loading…
Reference in a new issue