Browse Source

fixed LeLet's Encrypt renew

lj2007331 8 years ago
parent
commit
96aa5f8b2d
5 changed files with 16 additions and 11 deletions
  1. 5 2
      README.md
  2. 3 1
      addons.sh
  3. 1 1
      options.conf
  4. 4 4
      versions.txt
  5. 3 3
      vhost.sh

+ 5 - 2
README.md

@@ -1,4 +1,7 @@
-This script is written using the shell, in order to quickly deploy `LEMP`/`LAMP`/`LNMP`/`LNMPA`/`LTMP`(Linux, Nginx/Tengine/OpenResty, MySQL in a production environment/MariaDB/Percona, PHP, JAVA), applicable to CentOS 5~7(including redhat), Debian 6~8, Ubuntu 12~15 of 32 and 64.
+[![PayPal donate button](https://img.shields.io/badge/paypal-donate-green.svg)](https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=lj2007331@gmail.com&item_name=OneinStack%20Donate&currency_code=USD)
+[![支付宝捐助按钮](https://img.shields.io/badge/%E6%94%AF%E4%BB%98%E5%AE%9D-%E5%90%91TA%E6%8D%90%E5%8A%A9-green.svg)](https://static.oneinstack.com/images/alipay.png)
+[![微信捐助按钮](https://img.shields.io/badge/%E5%BE%AE%E4%BF%A1-%E5%90%91TA%E6%8D%90%E5%8A%A9-green.svg)](https://static.oneinstack.com/images/weixin.png)
+This script is written using the shell, in order to quickly deploy `LEMP`/`LAMP`/`LNMP`/`LNMPA`/`LTMP`(Linux, Nginx/Tengine/OpenResty, MySQL in a production environment/MariaDB/Percona, PHP, JAVA), applicable to CentOS 5~7(including redhat), Debian 6~8, Ubuntu 12~16 of 32 and 64.
 
 Script properties:
 - Continually updated
@@ -14,7 +17,7 @@ Script properties:
 - Installation Pureftpd, phpMyAdmin according to their needs
 - Install memcached, redis according to their needs
 - Tcmalloc can use according to their needs or jemalloc optimize MySQL, Nginx
-- Providing add a virtual host script
+- Providing add a virtual host script, include Let's Encrypt SSL certificate
 - Provide Nginx/Tengine, MySQL/MariaDB/Percona, PHP, Redis, phpMyAdmin upgrade script
 - Provide local backup and remote backup (rsync between servers) script
 - Provided under HHVM install CentOS 6,7

+ 3 - 1
addons.sh

@@ -121,12 +121,14 @@ cd $oneinstack_dir/src
 src_url=https://dl.eff.org/certbot-auto && Download_src
 /bin/mv certbot-auto /usr/local/bin/
 chmod +x /usr/local/bin/certbot-auto
-certbot-auto --help all
+certbot-auto -n --help all
 certbot-auto -h | grep '\-\-standalone' > /dev/null && echo; echo "${CSUCCESS}Let's Encrypt client install successfully! ${CEND}"
 }
 
 Uninstall_letsencrypt() {
 rm -rf /usr/local/bin/cerbot-auto /etc/letsencrypt /var/log/letsencrypt
+[ "$OS" == 'CentOS' ] && Cron_file=/var/spool/cron/root || Cron_file=/var/spool/cron/crontabs/root
+sed -i '/certbot-auto/d' $Cron_file 
 echo; echo "${CMSG}Let's Encrypt client uninstall completed${CEND}";
 }
 

+ 1 - 1
options.conf

@@ -1,5 +1,5 @@
 # operating environment for the current working directory
-oneinstack_dir=
+oneinstack_dir=/root/git/repo/oneinstack
 
 # Nginx Apache and PHP-FPM process is run as $run_user(Default "www"), you can freely specify
 run_user=www

+ 4 - 4
versions.txt

@@ -22,7 +22,7 @@ mysql_5_5_version=5.5.50
 
 mariadb_10_1_version=10.1.14
 mariadb_10_0_version=10.0.25
-mariadb_5_5_version=5.5.49
+mariadb_5_5_version=5.5.50
 
 percona_5_7_version=5.7.12-5
 percona_5_6_version=5.6.30-76.3
@@ -34,9 +34,9 @@ jdk_7_version=1.7.0_80
 jdk_6_version=1.6.0_45
 
 # PHP
-php_7_version=7.0.7
-php_6_version=5.6.22
-php_5_version=5.5.36
+php_7_version=7.0.8
+php_6_version=5.6.23
+php_5_version=5.5.37
 php_4_version=5.4.45
 php_3_version=5.3.29
 

+ 3 - 3
vhost.sh

@@ -162,7 +162,7 @@ openssl x509 -req -days 36500 -sha256 -in $PATH_SSL/${domain}.csr -signkey $PATH
 }
 
 Create_SSL() {
-if [ -e "/usr/local/bin/certbot-auto" ];then
+if [ -e "/usr/local/bin/certbot-auto" -a -e "~/.local/share/letsencrypt/bin/letsencrypt" ];then
     while :; do echo
         read -p "Do you want to use a Let's Encrypt certificate? [y/n]: " letsencrypt_yn 
         if [[ ! $letsencrypt_yn =~ ^[y,n]$ ]];then
@@ -193,7 +193,7 @@ if [ -e "/usr/local/bin/certbot-auto" ];then
         [ "$moredomainame_yn" == 'y' ] && moredomainame_D="`for D in $moredomainame; do echo -d $D; done`"
         [ "$nginx_ssl_yn" == 'y' ] && S=nginx
         [ "$apache_ssl_yn" == 'y' ] && S=httpd
-        [ ! -d "$vhostdir/.well-known" ] && mkdir -p $vhostdir/.well-known;chown -R $run_user.$run_user $vhostdir/.well-known 
+        [ ! -d "$wwwroot_dir/$domain/.well-known" ] && mkdir -p $wwwroot_dir/$domain/.well-known;chown -R $run_user.$run_user $wwwroot_dir/$domain/.well-known 
         certbot-auto certonly --standalone --agree-tos --email $Admin_Email -d $domain $moredomainame_D --pre-hook "service $S stop" --post-hook "service $S start"
         if [ -s "/etc/letsencrypt/live/$domain/cert.pem" ];then
             [ -e "$PATH_SSL/$domain.crt" ] && rm -rf $PATH_SSL/$domain.{crt,key}
@@ -207,7 +207,7 @@ if [ -e "/usr/local/bin/certbot-auto" ];then
                 Cron_Command='/etc/init.d/httpd graceful'
             fi
             [ "$OS" == 'CentOS' ] && Cron_file=/var/spool/cron/root || Cron_file=/var/spool/cron/crontabs/root
-            [ -z "`grep \'$domain $moredomainame_D\' $Cron_file`" ] && echo "0 10 * * 1 /usr/local/bin/certbot-auto certonly -a webroot --agree-tos --renew-by-default --webroot-path=$wwwroot_dir/$domain -d $domain $moredomainame_D;$Cron_Command" >> $Cron_file
+            [ -z "`grep "$domain $moredomainame_D" $Cron_file`" ] && echo "0 10 * * 1 /usr/local/bin/certbot-auto certonly -a webroot --agree-tos --renew-by-default --webroot-path=$wwwroot_dir/$domain -d $domain $moredomainame_D;$Cron_Command" >> $Cron_file
         else
             echo "${CFAILURE}Error: Let's Encrypt SSL certificate installation failed${CEND}"
             exit 1