Browse Source

rebuild project 11.10.21:05.01

root 3 years ago
parent
commit
f268438415
4 changed files with 27 additions and 22 deletions
  1. 3 0
      certbot.conf
  2. 7 4
      cleate_certs.sh
  3. 17 3
      dehydrated/make_ssl-dehydrated.sh
  4. 0 15
      dehydrated/renew-ssl.sh

+ 3 - 0
certbot.conf

@@ -0,0 +1,3 @@
1
+adminmail="admin@mydomen.com";
2
+domains=( "mydomen.org"
3
+           );

+ 7 - 4
cleate_certs.sh

@@ -1,13 +1,16 @@
1 1
 #!/bin/bash
2 2
 # create new cert
3
-domains=( "mydomain.ru" "dev.mydomain.ru" "webmail.mydomain.ru" );
4
-adminmail="admin@mydomain.ru";
3
+src="/etc/scripts/autocertbot/certbot.conf"
5 4
 
6 5
 function createCert() {
6
+certbot register --agree-tos -m $adminmail;
7
+/etc/init.d/haproxy stop;
8
+
7 9
 for ((dmn=0; dmn != ${#domains[@]}; dmn++))
8 10
     do
9
-certbot certonly --standalone -d ${domains[$dmn]} --non-interactive --agree-tos --email $adminmail  --http-01-port=55777
10
-done
11
+      certbot certonly --preferred-challenges http --standalone -d ${domains[$dmn]};
12
+    done
13
+/etc/init.d/haproxy start;
11 14
 }
12 15
 
13 16
 createCert;

+ 17 - 3
dehydrated/make_ssl-dehydrated.sh

@@ -4,7 +4,7 @@
4 4
 #
5 5
 path_ssl="/etc/ssl/private";
6 6
 path_certbot="/var/lib/dehydrated/certs";
7
-domains=( "mydomain.ru" "webmail.mydomain.ru" "dev.mydomain.ru" );
7
+src="/etc/scripts/autocertbot/certbot.conf"
8 8
 
9 9
 function makeSslPem() {
10 10
 for ((dmn=0; dmn != ${#domains[@]}; dmn++))
@@ -14,6 +14,7 @@ for ((dmn=0; dmn != ${#domains[@]}; dmn++))
14 14
     cat $path_certbot/${domains[$dmn]}/fullchain.pem >> $path_ssl/${domains[$dmn]}.pem;
15 15
     cat $path_certbot/${domains[$dmn]}/privkey.pem >> $path_ssl/${domains[$dmn]}.pem;
16 16
 done
17
+makePemList;
17 18
 }
18 19
 
19 20
 function makePemList() {
@@ -24,8 +25,21 @@ for ((icrt=0; icrt != ${#domains[@]}; icrt++))
24 25
 done
25 26
 }
26 27
 
28
+function checkCert() {
29
+if [ $(dehydrated -c -4|grep 'Certificate will not expire'|wc -l) != 0 ];
30
+    then
31
+        echo "$(date +%c) certbot(dehydrated): no certificates to upgrade...">>$logfile;
32
+        exit;
33
+    else
34
+        makeSslPem;
35
+        /etc/init.d/haproxy restart;
36
+        echo "$(date +%c) certbot(dehydrated): updating sertificate">>$logfile;
37
+fi
38
+}
39
+
40
+
41
+
27 42
 ## create sets.pem
28
-makeSslPem;
29
-makePemList;
43
+checkCert;
30 44
 
31 45
 

+ 0 - 15
dehydrated/renew-ssl.sh

@@ -1,15 +0,0 @@
1
-#!/bin/bash
2
-#
3
-# renew certbot ssl certificates
4
-#
5
-logfile="/var/log/syslog";
6
-
7
-if [ $(dehydrated -c -4|grep 'Certificate will not expire'|wc -l) != 0 ];
8
-    then
9
-	echo "$(date +%c) certbot(dehydrated): no certificates to upgrade...">>$logfile;
10
-	exit;
11
-    else
12
-	/etc/scripts/sertbot/dehydrated/make_ssl-dehydrated.sh;
13
-	/etc/init.d/haproxy restart;
14
-	echo "$(date +%c) certbot(dehydrated): updating sertificate">>$logfile;
15
-fi