mirror of
https://github.com/donaldzou/WGDashboard.git
synced 2024-11-22 15:20:09 +01:00
added Let’s Encrypt via certbot
This commit is contained in:
parent
94a0d5a0a4
commit
24f269191c
4
src/certbot.ini
Normal file
4
src/certbot.ini
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
authenticator = standalone
|
||||||
|
noninteractive = true
|
||||||
|
agree-tos = true
|
||||||
|
rsa-key-size = 2048
|
@ -3,4 +3,5 @@ tinydb
|
|||||||
ifcfg
|
ifcfg
|
||||||
icmplib
|
icmplib
|
||||||
flask-qrcode
|
flask-qrcode
|
||||||
gunicorn
|
gunicorn
|
||||||
|
certbot
|
50
src/wgd.sh
50
src/wgd.sh
@ -3,6 +3,14 @@
|
|||||||
app_name="dashboard.py"
|
app_name="dashboard.py"
|
||||||
app_official_name="WGDashboard"
|
app_official_name="WGDashboard"
|
||||||
environment=$(if [[ $ENVIRONMENT ]]; then echo $ENVIRONMENT; else echo 'develop'; fi)
|
environment=$(if [[ $ENVIRONMENT ]]; then echo $ENVIRONMENT; else echo 'develop'; fi)
|
||||||
|
if [[ $CONFIGURATION_PATH ]]; then
|
||||||
|
cb_work_dir=$CONFIGURATION_PATH/letsencrypt/work-dir
|
||||||
|
cb_config_dir=$CONFIGURATION_PATH/letsencrypt/config-dir
|
||||||
|
else
|
||||||
|
cb_work_dir=/etc/letsencrypt
|
||||||
|
cb_config_dir=/var/lib/letsencrypt
|
||||||
|
fi
|
||||||
|
|
||||||
dashes='------------------------------------------------------------'
|
dashes='------------------------------------------------------------'
|
||||||
equals='============================================================'
|
equals='============================================================'
|
||||||
help () {
|
help () {
|
||||||
@ -57,20 +65,42 @@ check_wgd_status(){
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
certbot_create_ssl () {
|
||||||
|
certbot certonly --config ./certbot.ini --email "$EMAIL" --work-dir $cb_work_dir --config-dir $cb_config_dir --domain "$SERVERURL"
|
||||||
|
}
|
||||||
|
|
||||||
|
certbot_renew_ssl () {
|
||||||
|
certbot renew --work-dir $cb_work_dir --config-dir $cb_config_dir
|
||||||
|
}
|
||||||
|
|
||||||
gunicorn_start () {
|
gunicorn_start () {
|
||||||
printf "%s\n" "$dashes"
|
if [[ $SSL ]]; then
|
||||||
printf "| Starting WGDashboard in the background. |\n"
|
if [ ! -d $cb_config_dir ]; then
|
||||||
if [ ! -d "log" ]
|
certbot_create_ssl
|
||||||
then mkdir "log"
|
else
|
||||||
fi
|
certbot_renew_ssl
|
||||||
d=$(date '+%Y%m%d%H%M%S')
|
|
||||||
if [[ $USER == root ]]; then
|
|
||||||
export PATH=$PATH:/usr/local/bin:$HOME/.local/bin
|
|
||||||
fi
|
fi
|
||||||
|
fi
|
||||||
|
printf "%s\n" "$dashes"
|
||||||
|
printf "| Starting WGDashboard in the background. |\n"
|
||||||
|
if [ ! -d "log" ]; then
|
||||||
|
mkdir "log"
|
||||||
|
fi
|
||||||
|
d=$(date '+%Y%m%d%H%M%S')
|
||||||
|
if [[ $USER == root ]]; then
|
||||||
|
export PATH=$PATH:/usr/local/bin:$HOME/.local/bin
|
||||||
|
fi
|
||||||
|
if [[ $SSL ]]; then
|
||||||
|
gunicorn --certfile $cb_config_dir/live/"$SERVERURL"/cert.pem \
|
||||||
|
--keyfile $cb_config_dir/live/"$SERVERURL"/privkey.pem \
|
||||||
|
--access-logfile log/access_"$d".log \
|
||||||
|
--error-logfile log/error_"$d".log 'dashboard:run_dashboard()'
|
||||||
|
else
|
||||||
gunicorn --access-logfile log/access_"$d".log \
|
gunicorn --access-logfile log/access_"$d".log \
|
||||||
--error-logfile log/error_"$d".log 'dashboard:run_dashboard()'
|
--error-logfile log/error_"$d".log 'dashboard:run_dashboard()'
|
||||||
printf "| Log files is under log/ |\n"
|
fi
|
||||||
printf "%s\n" "$dashes"
|
printf "| Log files is under log/ |\n"
|
||||||
|
printf "%s\n" "$dashes"
|
||||||
}
|
}
|
||||||
|
|
||||||
gunicorn_stop () {
|
gunicorn_stop () {
|
||||||
|
Loading…
Reference in New Issue
Block a user