From f215868267881decfeb33b5bc839d45bb9618cc8 Mon Sep 17 00:00:00 2001 From: M3chD09 Date: Sun, 1 Mar 2020 13:30:16 +0800 Subject: [PATCH] minor fix --- centos-ss-install.sh | 18 +++++++++++------- ubuntu-ss-install.sh | 1 + 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/centos-ss-install.sh b/centos-ss-install.sh index 1a37aa7..04c3d23 100644 --- a/centos-ss-install.sh +++ b/centos-ss-install.sh @@ -166,17 +166,19 @@ WantedBy=multi-user.target EOF } +firewall_conf(){ + systemctl status firewalld > /dev/null 2>&1 + if [ $? -eq 0 ]; then + firewall-cmd --permanent --zone=public --add-service=http + firewall-cmd --permanent --zone=public --add-service=https + firewall-cmd --reload + fi +} + get_cert(){ if [ -f /etc/letsencrypt/live/$domain/fullchain.pem ];then echo -e "\033[1;32mcert already got, skip.\033[0m" else - systemctl status firewalld > /dev/null 2>&1 - if [ $? -eq 0 ]; then - firewall-cmd --permanent --zone=public --add-service=http - firewall-cmd --permanent --zone=public --add-port=443/tcp - firewall-cmd --permanent --zone=public --add-port=443/udp - firewall-cmd --reload - fi yum install -y certbot certbot certonly --cert-name $domain -d $domain --standalone --agree-tos --register-unsafely-without-email systemctl enable certbot-renew.timer @@ -224,6 +226,7 @@ install_all(){ install_ss install_v2 ss_conf + firewall_conf get_cert start_ss remove_files @@ -262,6 +265,7 @@ echo "What do you want to do?" echo "[1] Install" echo "[2] Remove" read -p "(Default option: Install):" option +option=${option:-1} if [ $option -eq 2 ];then remove_all else diff --git a/ubuntu-ss-install.sh b/ubuntu-ss-install.sh index 06541cd..e94ad2b 100644 --- a/ubuntu-ss-install.sh +++ b/ubuntu-ss-install.sh @@ -262,6 +262,7 @@ echo "What do you want to do?" echo "[1] Install" echo "[2] Remove" read -p "(Default option: Install):" option +option=${option:-1} if [ $option -eq 2 ];then remove_all else