Browse Source

recreate one sctipt for nginx and mail server 08.11.22:01.30

master 1 year ago
parent
commit
78a54ef0ca

certbot4nginx/auto4certbot.conf → avto4certbot/avto4certbot.conf


+ 70 - 39
certbot4nginx/auto4certbot.sh

@@ -4,24 +4,40 @@
4 4
 # license: GPL 2.0
5 5
 # create 2022
6 6
 #
7
-version="0.2.4";
8
-sname="autocertbot";
9
-# необходимы для работы: nginx,certbot
10
-# create new cert
7
+version="0.3.0";
8
+sname="avto4certbot";
9
+# необходимы для работы: nginx,certbot (и если почтовый сервер то сервисы в restartMail)
10
+# create new cert or update
11 11
 path_ssl="/etc/ssl";
12 12
 path_cert="/etc/letsencrypt/live";
13
-source "/etc/scripts/certbot4nginx/auto4certbot.conf";
13
+source "/etc/scripts/avto4certbot/avto4certbot.conf";
14
+
14 15
 ## - nginx
15 16
 nginx_enable="/etc/nginx/sites-enabled";
16 17
 nginx_available="/etc/nginx/sites-available";
18
+## - mail services
19
+mailservice=(
20
+    "dbmail"
21
+    "postfix"
22
+    "stunnel4"
23
+    "rspamd"
24
+);
25
+
17 26
 ##
18 27
 www_root="/tmp/letsencrypt";
28
+
19 29
 ##
20 30
 path_tmp="/tmp/certbot";
31
+
21 32
 ##
22 33
 log="/var/log/syslog";
23
-#
34
+
35
+# - shared options
24 36
 cmd=$1;
37
+
38
+# - for mail server
39
+opt=$2;
40
+
25 41
 #-list enable sites
26 42
 scan_list=();
27 43
 #
@@ -56,17 +72,17 @@ for ((dmn=0; dmn != ${#domains[@]}; dmn++))
56 72
      if [ "$keydate" = "$rdate" ] && [ "$keytime" = "$rtime" ];
57 73
         then
58 74
          ((valtrue++));
59
-        cat $path_cert/${dreg[0]}/cert.pem > $path_ssl/private/${dreg[0]}.pem;
60
-        cat $path_cert/${dreg[0]}/chain.pem >> $path_ssl/private/${dreg[0]}.pem;
61
-        cat $path_cert/${dreg[0]}/fullchain.pem >> $path_ssl/private/${dreg[0]}.pem;
62
-        cat $path_cert/${dreg[0]}/privkey.pem >> $path_ssl/private/${dreg[0]}.pem;
75
+		cat $path_cert/${dreg[0]}/privkey.pem > $path_ssl/private/privkey_${dreg[0]}.pem;
76
+		cat $path_cert/${dreg[0]}/fullchain.pem > $path_ssl/private/fullchain_${dreg[0]}.pem;
77
+    		cat $path_cert/${dreg[0]}/fullchain.pem > $path_ssl/private/${dreg[0]}.pem;
78
+    		cat $path_cert/${dreg[0]}/privkey.pem >> $path_ssl/private/${dreg[0]}.pem;
63 79
 #
64 80
         cp -f $path_ssl/private/${dreg[0]}.pem $path_ssl/certs/${dreg[0]}.pem
65 81
         cd $path_ssl/certs
66 82
         chmod 600 ${dreg[0]}.pem
67 83
         ln -sf ${dreg[0]}.pem `openssl x509 -noout -hash < ${dreg[0]}.pem`.0
68 84
         cd $path_ssl
69
-        echo "$(date) - auto4certbot.sh: update cert for  ${domains[$dmn]}">> $log;
85
+        echo "$(date) - $sname: update cert for  ${domains[$dmn]}">> $log;
70 86
       fi
71 87
 done
72 88
 if [ $valtrue != 0 ];
@@ -87,17 +103,17 @@ if [ -d $path_cert ];
87 103
             do
88 104
                 eval local dreg="(" $(echo -e ${domains[$dmn]}) ")";
89 105
                 ((valtrue++));
90
-                cat $path_cert/${dreg[0]}/cert.pem > $path_ssl/private/${dreg[0]}.pem;
91
-                cat $path_cert/${dreg[0]}/chain.pem >> $path_ssl/private/${dreg[0]}.pem;
92
-                cat $path_cert/${dreg[0]}/fullchain.pem >> $path_ssl/private/${dreg[0]}.pem;
93
-                cat $path_cert/${dreg[0]}/privkey.pem >> $path_ssl/private/${dreg[0]}.pem;
106
+		cat $path_cert/${dreg[0]}/privkey.pem > $path_ssl/private/privkey_${dreg[0]}.pem;
107
+		cat $path_cert/${dreg[0]}/fullchain.pem > $path_ssl/private/fullchain_${dreg[0]}.pem;
108
+    		cat $path_cert/${dreg[0]}/fullchain.pem > $path_ssl/private/${dreg[0]}.pem;
109
+    		cat $path_cert/${dreg[0]}/privkey.pem >> $path_ssl/private/${dreg[0]}.pem;
94 110
 #
95 111
                 cp -f $path_ssl/private/${dreg[0]}.pem $path_ssl/certs/${dreg[0]}.pem
96 112
                 cd $path_ssl/certs
97 113
                 chmod 600 ${dreg[0]}.pem
98 114
                 ln -sf ${dreg[0]}.pem `openssl x509 -noout -hash < ${dreg[0]}.pem`.0
99 115
                 cd $path_ssl
100
-                echo "$(date) - auto4certbot.sh: update certlist for  ${domains[$dmn]}">> $log;
116
+                echo "$(date) - $sname: update certlist for  ${domains[$dmn]}">> $log;
101 117
         done
102 118
         if [ $valtrue != 0 ];
103 119
             then
@@ -110,6 +126,7 @@ if [ -d $path_cert ];
110 126
         fi
111 127
     else
112 128
         echo "Ошибка - отсутствует $path_cert!"
129
+	echo "$(date) - $sname: Ошибка - отсутствует $path_cert!">> $log;
113 130
 fi
114 131
 }
115 132
 
@@ -117,19 +134,12 @@ function downSite(){
117 134
 sudo systemctl stop nginx.service;
118 135
 
119 136
 eval list_www="(" $(find $nginx_enable/* -maxdepth 0 -type l -printf '%f\n') ")";
137
+if [ ${#list_www[@]} != 0 ]; then
120 138
 for ((dwx=0; dwx != ${#list_www[@]}; dwx++))
121 139
     do
122 140
       rm $nginx_enable/${list_www[dwx]};
123 141
 done
124
-
125
-for ((dnm=0; dnm != ${#domains[@]}; dnm++))
126
-    do
127
-eval local dcert="(" $(echo -e ${domains[$dnm]}) ")";
128
-    sitename="${dcert[0]}";
129
-    siteport="${dcert[2]}";
130
-    createConf;
131
-done
132
-sudo systemctl start nginx.service;
142
+fi
133 143
 }
134 144
 
135 145
 function upSite(){
@@ -139,10 +149,12 @@ for ((cr=0; cr != ${#cert_bot[@]}; cr++))
139 149
     do
140 150
       rm $nginx_enable/${cert_bot[cr]};
141 151
 done
142
-
143
-for ((dwx=0; dwx != ${#list_www[@]}; dwx++))
152
+for ((dnm=0; dnm != ${#domains[@]}; dnm++))
144 153
     do
145
-     ln -s $nginx_available/${list_www[dwx]} $nginx_enable/${list_www[dwx]};
154
+eval local dcert="(" $(echo -e ${domains[$dnm]}) ")";
155
+    sitename="${dcert[0]}";
156
+    siteport="${dcert[2]}";
157
+    createConf;
146 158
 done
147 159
 sudo systemctl start nginx.service;
148 160
 }
@@ -164,10 +176,6 @@ fi
164 176
     echo -e '\n' >>$path_tmp/$sitename.conf;
165 177
     echo -e 'server_name '"$sitename"';' >>$path_tmp/$sitename.conf;
166 178
     echo -e '\n' >>$path_tmp/$sitename.conf;
167
-    #echo -e 'if ($http_host != $server_name){' >> $path_tmp/$sitename.conf;
168
-    #echo -e '    rewrite ^(.*)$ http://$server_name$1 redirect;'>>$path_tmp/$sitename.conf;
169
-    #echo -e '}' >>$path_tmp/$sitename.conf;
170
-    #echo -e '\n' >>$path_tmp/$sitename.conf;
171 179
     echo -e 'location /.well-known/acme-challenge {' >>$path_tmp/$sitename.conf;
172 180
     echo -e '    allow all;' >>$path_tmp/$sitename.conf;
173 181
     echo -e '    autoindex off;' >>$path_tmp/$sitename.conf;
@@ -188,6 +196,13 @@ fi
188 196
 ln -s $path_tmp/$sitename.conf $nginx_enable/$sitename.conf
189 197
 }
190 198
 
199
+function restartMail(){
200
+for ((scn=0; scn != ${#mailservice[@]}; scn++))
201
+    do
202
+/etc/init.d/${mailservice[$scn]} restart;
203
+# systemctl restart ${mailservices[$scn]};
204
+done
205
+}
191 206
 
192 207
 
193 208
 case "$cmd" in
@@ -196,33 +211,49 @@ case "$cmd" in
196 211
 "--create" | "--create" )
197 212
 
198 213
 downSite;
199
-createCert;
200 214
 upSite;
215
+createCert;
201 216
 toSSL;
217
+downSite;
218
+if [ "$opt" == "mail" ]; then
219
+restartMail;
220
+fi
221
+
202 222
 ;;
203 223
 
204 224
 ## update cert
205 225
 "--update" | "--update" )
206 226
 
207 227
 downSite;
208
-renew;
209 228
 upSite;
229
+renew;
210 230
 toSSL;
231
+downSite;
232
+if [ "$opt" == "mail" ]; then
233
+restartMail;
234
+fi
235
+
236
+
211 237
 ;;
212 238
 
213 239
 ## update cert force
214 240
 "--flist" | "--flist" )
215 241
 toSSL;
242
+if [ "$opt" == "mail" ]; then
243
+restartMail;
244
+fi
245
+
246
+
216 247
 ;;
217 248
 
218 249
 ## start defaults
219 250
 
220 251
 * )
221
-echo "please input pameters: auto4certbot.sh --create | --update | --flist";
222
-echo "auto4certbot.sh --create; create new certificate"
223
-echo "auto4certbot.sh --update; update certificates;"
224
-echo "auto4certbot.sh --flist; update certificates from ssl;"
252
+echo "please input pameters: avto4certbot.sh --create | --update | --flist";
253
+echo "avto4certbot.sh --create; create new certificate or --create mail; create and restart mail services " 
254
+echo "avto4certbot.sh --update; update certificates or --update mail; update and restart mail services;"
255
+echo "avto4certbot.sh --flist; update certificates from ssl or --flist mail; update certs and restart mail services;"
225 256
 ;;
226 257
 esac
227 258
 
228
-exit
259
+exit

+ 0 - 4
certbot4mail/certbot4mail.conf

@@ -1,4 +0,0 @@
1
-webcrt="/tmp/letsencrypt";
2
-domains=( 
3
- '"mail.mydomen.ru" "admin@mydomen.ru" "80"'
4
- );

+ 0 - 241
certbot4mail/certbot4mail.sh

@@ -1,241 +0,0 @@
1
-#!/bin/bash
2
-#
3
-# author: Koshuba V.O.
4
-# license: GPL 2.0
5
-# create 2022
6
-#
7
-version="0.2.9";
8
-sname="certbot4mail";
9
-# необходимы для работы: nginx,certbot
10
-# create new cert
11
-path_ssl="/etc/ssl";
12
-path_cert="/etc/letsencrypt/live";
13
-source "/etc/scripts/certbot4mail/certbot4mail.conf";
14
-## - nginx
15
-nginx_enable="/etc/nginx/sites-enabled";
16
-nginx_available="/etc/nginx/sites-available";
17
-##
18
-www_root="/tmp/letsencrypt";
19
-##
20
-path_tmp="/tmp/certbot";
21
-##
22
-log="/var/log/syslog";
23
-#
24
-cmd=$1;
25
-#-list enable sites
26
-scan_list=();
27
-#
28
-
29
-function createCert() {
30
-#
31
-for ((dmn=0; dmn != ${#domains[@]}; dmn++))
32
-    do
33
-eval local dreg="(" $(echo -e ${domains[$dmn]}) ")";
34
-    if [ "$cmd" == "--create" ];
35
-        then
36
-            certbot -m "${dreg[1]}";
37
-        else
38
-            certbot --update-registration -m "${dreg[1]}" -d "${dreg[0]}" ;
39
-    fi
40
-##
41
-## example manual: certbot certonly --webroot --webroot-path /tmp/letsencrypt/ -d mydomen.ru
42
-certbot certonly --webroot --webroot-path $www_root/ -d ${dreg[0]}
43
-done
44
-}
45
-
46
-function renew() {
47
-certbot renew;
48
-valtrue=0;
49
-rdate=$(date +%Y-%m-%d);
50
-rtime=$(date +%H:%M);
51
-for ((dmn=0; dmn != ${#domains[@]}; dmn++))
52
-    do
53
-    eval local dreg="(" $(echo -e ${domains[$dmn]}) ")";
54
-     keydate=$(ls -l --time-style=long-iso $path_cert/${dreg[0]}/cert.pem |awk {'print$6'});
55
-     keytime=$(ls -l --time-style=long-iso $path_cert/${dreg[0]}/cert.pem |awk {'print$7'});
56
-     if [ "$keydate" = "$rdate" ] && [ "$keytime" = "$rtime" ];
57
-        then
58
-         ((valtrue++));
59
-        cat $path_cert/${dreg[0]}/cert.pem > $path_ssl/private/${dreg[0]}.pem;
60
-        cat $path_cert/${dreg[0]}/chain.pem >> $path_ssl/private/${dreg[0]}.pem;
61
-        cat $path_cert/${dreg[0]}/fullchain.pem >> $path_ssl/private/${dreg[0]}.pem;
62
-        cat $path_cert/${dreg[0]}/privkey.pem >> $path_ssl/private/${dreg[0]}.pem;
63
-#
64
-# to postfix
65
-	if [ ! -d $path_ssl/manual ]; then
66
-	    mkdir -p $path_ssl/manual;
67
-	fi
68
-        cat $path_cert/${dreg[0]}/fullchain.pem >> $path_ssl/manual/fullchain.pem;
69
-        cat $path_cert/${dreg[0]}/privkey.pem >> $path_ssl/manual/privkey.pem;
70
-#
71
-
72
-        cp -f $path_ssl/private/${dreg[0]}.pem $path_ssl/certs/${dreg[0]}.pem
73
-        cd $path_ssl/certs
74
-        chmod 600 ${dreg[0]}.pem
75
-        ln -sf ${dreg[0]}.pem `openssl x509 -noout -hash < ${dreg[0]}.pem`.0
76
-        cd $path_ssl
77
-        echo "$(date) - certbot4mail.sh: update cert for  ${domains[$dmn]}">> $log;
78
-      fi
79
-done
80
-if [ $valtrue != 0 ];
81
-   then
82
-     :>/etc/ssl/crt-list.txt
83
-        for ((icrt=0; icrt != ${#domains[@]}; icrt++))
84
-         do
85
-          echo "$path_ssl/${domains[$icrt]}.pem">>/etc/ssl/crt-list.txt
86
-        done
87
-fi
88
-}
89
-
90
-
91
-function toSSL() {
92
-if [ -d $path_cert ];
93
-    then
94
-        for ((dmn=0; dmn != ${#domains[@]}; dmn++))
95
-            do
96
-                eval local dreg="(" $(echo -e ${domains[$dmn]}) ")";
97
-                ((valtrue++));
98
-                cat $path_cert/${dreg[0]}/cert.pem > $path_ssl/private/${dreg[0]}.pem;
99
-                cat $path_cert/${dreg[0]}/chain.pem >> $path_ssl/private/${dreg[0]}.pem;
100
-                cat $path_cert/${dreg[0]}/fullchain.pem >> $path_ssl/private/${dreg[0]}.pem;
101
-                cat $path_cert/${dreg[0]}/privkey.pem >> $path_ssl/private/${dreg[0]}.pem;
102
-# to postfix
103
-		if [ ! -d $path_ssl/manual ]; then
104
-		    mkdir -p $path_ssl/manual;
105
-		fi
106
-    		cat $path_cert/${dreg[0]}/fullchain.pem >> $path_ssl/manual/fullchain.pem;
107
-    		cat $path_cert/${dreg[0]}/privkey.pem >> $path_ssl/manual/privkey.pem;
108
-#
109
-                cp -f $path_ssl/private/${dreg[0]}.pem $path_ssl/certs/${dreg[0]}.pem
110
-                cd $path_ssl/certs
111
-                chmod 600 ${dreg[0]}.pem
112
-                ln -sf ${dreg[0]}.pem `openssl x509 -noout -hash < ${dreg[0]}.pem`.0
113
-                cd $path_ssl
114
-                echo "$(date) - certbot4mail.sh: update certlist for  ${domains[$dmn]}">> $log;
115
-        done
116
-        if [ $valtrue != 0 ];
117
-            then
118
-                echo >/etc/ssl/crt-list.txt
119
-            for ((icrt=0; icrt != ${#domains[@]}; icrt++))
120
-                do
121
-                eval local dcrt="(" $(echo -e ${domains[$icrt]}) ")";
122
-                echo "$path_ssl/private/${dcrt[0]}.pem">>/etc/ssl/crt-list.txt
123
-            done
124
-        fi
125
-    else
126
-        echo "Ошибка - отсутствует $path_cert!"
127
-fi
128
-}
129
-
130
-function downSite(){
131
-sudo systemctl stop nginx.service;
132
-
133
-eval list_www="(" $(find $nginx_enable/* -maxdepth 0 -type l -printf '%f\n') ")";
134
-for ((dwx=0; dwx != ${#list_www[@]}; dwx++))
135
-    do
136
-      rm $nginx_enable/${list_www[dwx]};
137
-done
138
-}
139
-
140
-function upSite(){
141
-sudo systemctl stop nginx.service;
142
-eval cert_bot="(" $(find $nginx_enable/* -maxdepth 0 -type l -printf '%f\n') ")";
143
-for ((cr=0; cr != ${#cert_bot[@]}; cr++))
144
-    do
145
-      rm $nginx_enable/${cert_bot[cr]};
146
-done
147
-for ((dnm=0; dnm != ${#domains[@]}; dnm++))
148
-    do
149
-eval local dcert="(" $(echo -e ${domains[$dnm]}) ")";
150
-    sitename="${dcert[0]}";
151
-    siteport="${dcert[2]}";
152
-    createConf;
153
-done
154
-sudo systemctl start nginx.service;
155
-}
156
-
157
-
158
-function createConf(){
159
-if [ ! -d $path_tmp ];
160
-  then
161
-    mkdir -p $path_tmp;
162
-fi
163
-
164
-if [ ! -d $www_root ];
165
-  then
166
-    mkdir -p $www_root/.well-known/acme-challenge;
167
-chown -R www-data:www-data $www_root;
168
-fi
169
-    echo >$path_tmp/$sitename.conf;
170
-    echo -e 'server { listen      0.0.0.0:'"$siteport"';' >>$path_tmp/$sitename.conf;
171
-    echo -e '\n' >>$path_tmp/$sitename.conf;
172
-    echo -e 'server_name '"$sitename"';' >>$path_tmp/$sitename.conf;
173
-    echo -e '\n' >>$path_tmp/$sitename.conf;
174
-    echo -e 'location /.well-known/acme-challenge {' >>$path_tmp/$sitename.conf;
175
-    echo -e '    allow all;' >>$path_tmp/$sitename.conf;
176
-    echo -e '    autoindex off;' >>$path_tmp/$sitename.conf;
177
-    echo -e '    default_type "text/plain";' >>$path_tmp/$sitename.conf;
178
-    echo -e '    root '"$www_root"';' >>$path_tmp/$sitename.conf;
179
-    echo -e '}' >>$path_tmp/$sitename.conf;
180
-    echo -e '\n' >>$path_tmp/$sitename.conf;
181
-    echo -e 'location = /.well-known {' >>$path_tmp/$sitename.conf;
182
-    echo -e '    return 404;' >>$path_tmp/$sitename.conf;
183
-    echo -e '}' >>$path_tmp/$sitename.conf;
184
-    echo -e '\n' >>$path_tmp/$sitename.conf;
185
-    echo -e 'error_page 404 /404.html;' >>$path_tmp/$sitename.conf;
186
-    echo -e 'error_page 500 502 503 504 /50x.html;' >>$path_tmp/$sitename.conf;
187
-    echo -e '\n' >>$path_tmp/$sitename.conf;
188
-    echo -e 'error_log /var/log/nginx/err-certbot.log;' >>$path_tmp/$sitename.conf;
189
-    echo -e 'access_log /var/log/nginx/access-certbot.log;' >>$path_tmp/$sitename.conf;
190
-    echo -e '}' >>$path_tmp/$sitename.conf;
191
-ln -s $path_tmp/$sitename.conf $nginx_enable/$sitename.conf
192
-}
193
-
194
-function restartMail(){
195
-/etc/init.d/dbmail restart;
196
-/etc/init.d/stunnel4 restart;
197
-/etc/init.d/postfix restart;
198
-}
199
-
200
-
201
-case "$cmd" in
202
-
203
-## create cert
204
-"--create" | "--create" )
205
-
206
-downSite;
207
-createCert;
208
-upSite;
209
-toSSL;
210
-downSite;
211
-restartMail;
212
-;;
213
-
214
-## update cert
215
-"--update" | "--update" )
216
-
217
-downSite;
218
-renew;
219
-upSite;
220
-toSSL;
221
-downSite;
222
-restartMail;
223
-;;
224
-
225
-## update cert force
226
-"--flist" | "--flist" )
227
-toSSL;
228
-restartMail;
229
-;;
230
-
231
-## start defaults
232
-
233
-* )
234
-echo "please input pameters: certbot4mail.sh --create | --update | --flist";
235
-echo "certbot4mail.sh --create; create new certificate"
236
-echo "certbot4mail.sh --update; update certificates;"
237
-echo "certbot4mail.sh --flist; update certificates from ssl;"
238
-;;
239
-esac
240
-
241
-exit

+ 0 - 16
certbot4mail/examples/nginx/sites-avalable/http_mail-mydomen

@@ -1,16 +0,0 @@
1
-server {
2
-    listen      192.4.1.6:80;
3
-
4
-    server_name mail.mydomen.ru;
5
-    if ($http_host !~ "^mail.mydomen.ru$"){
6
-        rewrite ^(.*)$ http://mail.mydomen.ru$1 redirect;
7
-    }
8
-    root /home/wwwmail/letsencrypt;
9
-
10
-    error_log /var/log/nginx/err-mail_mydomen_ru.log;
11
-    access_log /var/log/nginx/access-mail_mydomen_ru.log;
12
-
13
-    include /etc/nginx/templates/content.conf;
14
-    include /etc/nginx/templates/letsencrypt.conf;
15
-}
16
-

+ 0 - 9
certbot4mail/examples/nginx/templates/letsencrypt.conf

@@ -1,9 +0,0 @@
1
-location /.well-known {
2
-   allow all;
3
-   default_type "text/plain";
4
-   alias /home/wwwmail/letsencrypt/.well-known;
5
- }
6
-
7
- location = /.well-known {
8
-   return 404;
9
- }

+ 0 - 126
certbot4mail/examples/stunnel.conf

@@ -1,126 +0,0 @@
1
-; Sample stunnel configuration file for Unix by Michal Trojnara 2002-2015
2
-; Some options used here may be inadequate for your particular configuration
3
-; This sample file does *not* represent stunnel.conf defaults
4
-; Please consult the manual for detailed description of available options
5
-
6
-; **************************************************************************
7
-; * Global options                                                         *
8
-; **************************************************************************
9
-
10
-; It is recommended to drop root privileges if stunnel is started by root
11
-;setuid = stunnel4
12
-;setgid = stunnel4
13
-
14
-; PID file is created inside the chroot jail (if enabled)
15
-pid = /var/run/stunnel4/stunnel.pid
16
-
17
-; Debugging stuff (may be useful for troubleshooting)
18
-;foreground = yes
19
-;debug = info
20
-output = /var/log/stunnel4/stunnel.log
21
-
22
-; Enable FIPS 140-2 mode if needed for compliance
23
-;fips = yes
24
-fips = no
25
-; **************************************************************************
26
-; * Service defaults may also be specified in individual service sections  *
27
-; **************************************************************************
28
-
29
-; Enable support for the insecure SSLv3 protocol
30
-options = -NO_SSLv3
31
-sslVersion = TLSv1.2
32
-
33
-; These options provide additional security at some performance degradation
34
-;options = SINGLE_ECDH_USE
35
-;options = SINGLE_DH_USE
36
-
37
-; **************************************************************************
38
-; * Include all configuration file fragments from the specified folder     *
39
-; **************************************************************************
40
-
41
-;include = /etc/stunnel/conf.d
42
-
43
-; **************************************************************************
44
-; * Service definitions (remove all services for inetd mode)               *
45
-; **************************************************************************
46
-
47
-; ***************************************** Example TLS client mode services
48
-
49
-; The following examples use /etc/ssl/certs, which is the common location
50
-; of a hashed directory containing trusted CA certificates.  This is not
51
-; a hardcoded path of the stunnel package, as it is not related to the
52
-; stunnel configuration in /etc/stunnel/.
53
-
54
-;[mydomen-pop3]
55
-;client = yes
56
-;accept = 127.0.0.1:110
57
-;connect = pop3.mydomen.ru:995
58
-;verifyChain = yes
59
-;CApath = @sysconfdir/ssl/certs
60
-;checkHost = pop3s.mydomen.ru
61
-;OCSPaia = yes
62
-
63
-;[mydomen-imap]
64
-;client = yes
65
-;accept = 127.0.0.1:143
66
-;connect = imap.mydomen.ru:993
67
-;verifyChain = yes
68
-;CApath = @sysconfdir/ssl/certs
69
-;checkHost = imaps.mydomen.ru
70
-;OCSPaia = yes
71
-
72
-;[mydomen-smtp]
73
-;client = yes
74
-;accept = 127.0.0.1:25
75
-;connect = smtp.mydomen.ru:465
76
-;verifyChain = yes
77
-;CApath = @sysconfdir/ssl/certs
78
-;checkHost = smtps.mydomen.ru
79
-;OCSPaia = yes
80
-
81
-; ***************************************** Example TLS server mode services
82
-
83
-[pop3s]
84
-accept  = 10.2.2.8:995
85
-connect = 10.2.2.8:110
86
-cert=/etc/letsencrypt/live/mail.mydomen.ru/fullchain.pem
87
-key=/etc/letsencrypt/live/mail.mydomen.ru/privkey.pem
88
-
89
-[imaps]
90
-accept  = 10.2.2.8:993
91
-connect = 10.2.2.8:143
92
-cert=/etc/letsencrypt/live/mail.mydomen.ru/fullchain.pem
93
-key=/etc/letsencrypt/live/mail.mydomen.ru/privkey.pem
94
-
95
-[smtps]
96
-accept  = 10.2.2.8:465
97
-connect = 10.2.2.8:587
98
-cert=/etc/letsencrypt/live/mail.mydomen.ru/fullchain.pem
99
-key=/etc/letsencrypt/live/mail.mydomen.ru/privkey.pem
100
-
101
-; TLS front-end to a web server
102
-;[https]
103
-;accept  = 443
104
-;connect = 80
105
-;cert = /etc/stunnel/stunnel.pem
106
-; "TIMEOUTclose = 0" is a workaround for a design flaw in Microsoft SChannel
107
-; Microsoft implementations do not use TLS close-notify alert and thus they
108
-; are vulnerable to truncation attacks
109
-;TIMEOUTclose = 0
110
-
111
-; Remote shell protected with PSK-authenticated TLS
112
-; Create "/etc/stunnel/secrets.txt" containing IDENTITY:KEY pairs
113
-;[shell]
114
-;accept = 1337
115
-;exec = /bin/sh
116
-;execArgs = sh -i
117
-;ciphers = PSK
118
-;PSKsecrets = /etc/stunnel/secrets.txt
119
-
120
-; Non-standard MySQL-over-TLS encapsulation connecting the Unix socket
121
-;[mysql]
122
-;cert = /etc/stunnel/stunnel.pem
123
-;accept = 3307
124
-;connect = /run/mysqld/mysqld.sock
125
-
126
-; vim:ft=dosini

+ 0 - 74
certbot4nginx/examples/nginx.conf

@@ -1,74 +0,0 @@
1
-user  www-data;
2
-worker_processes  1;
3
-
4
-error_log  /var/log/nginx/error.log warn;
5
-pid        /var/run/nginx.pid;
6
-
7
-
8
-events {
9
-    worker_connections  1024;
10
-}
11
-
12
-
13
-http {
14
-    include       /etc/nginx/mime.types;
15
-    default_type  application/octet-stream;
16
-
17
-    log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
18
-                      '$status $body_bytes_sent "$http_referer" '
19
-                      '"$http_user_agent" "$http_x_forwarded_for"';
20
-
21
-    #access_log  /var/log/nginx/access.log  main;
22
-    access_log off;
23
-
24
-    sendfile        on;
25
-    tcp_nopush     on;
26
-    server_tokens off;
27
-    keepalive_timeout  65;
28
-
29
-    gzip  on;
30
-###
31
-    gzip_disable "msie6";
32
-    gzip_comp_level 4;
33
-    gzip_buffers 16 8k;
34
-    gzip_http_version 1.1;
35
-    gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript;
36
-    
37
-### include /etc/nginx/conf.d/*.conf;
38
-    include /etc/nginx/conf.d/*.conf;
39
-    include /etc/nginx/sites-enabled/*;
40
-####
41
-    tcp_nodelay on;
42
-    types_hash_max_size 2048;
43
-    
44
-### codepage
45
-    charset        utf8;
46
-    source_charset utf8;
47
-    
48
-#### Tuning system....
49
-    ## - Защита
50
-    # Максимальный размер буфера для хранения тела запроса клиента
51
-    ##client_body_buffer_size 1K;
52
-    # Максимальный размер буфера для хранения заголовков запроса клиента
53
-    ##client_header_buffer_size 1k;
54
-    # Максимальный размер тела запроса клиента, прописанный в поле Content-Length заголовка. Если сервер должен поддерживать загрузку файлов, это значение необходимо увеличить
55
-    ##client_max_body_size 1k;
56
-    # для Rouncube
57
-    client_max_body_size 40M;
58
-    # Количество и размер буферов для чтения большого заголовка запроса клиента
59
-    ##large_client_header_buffers 2 1k;
60
-    
61
-    
62
-    ## - Увеличиваем скорость
63
-    # Таймаут при чтении тела запроса клиента
64
-    client_body_timeout   10;
65
-    # Таймаут при чтении заголовка запроса клиента
66
-    client_header_timeout 10;
67
-    # Таймаут, по истечению которого keep-alive соединение с клиентом не будет закрыто со стороны сервера
68
-    ##keepalive_timeout     5 5;
69
-    # Таймаут при передаче ответа клиенту
70
-    send_timeout          10;
71
-    ## transparent ip
72
-    set_real_ip_from 127.0.0.1;
73
-    real_ip_header X-Real-IP;
74
-}

+ 0 - 11
certbot4nginx/examples/nginx/templates/content.conf

@@ -1,11 +0,0 @@
1
-  error_page 404 /404.html;
2
-   error_page 500 502 503 504 /50x.html;
3
-
4
- location ~* \.(css|js|jpg|jpeg|gif|png|ico|txt|woff|otf|eot|svg|ttf|html|xml|css|js)$ {
5
-   expires 30d;
6
-   error_page 404 @notfound;
7
- }
8
-
9
- location = /50x.html {
10
-   root /usr/share/nginx/html;
11
- }

+ 0 - 9
certbot4nginx/examples/nginx/templates/index_php.conf

@@ -1,9 +0,0 @@
1
- location / {
2
-   if ($http_host ~* "^www\.(.+)$"){
3
-   rewrite ^(.*)$ http://%1/$1 redirect; 
4
-   } 
5
-   if (!-e $request_filename){ 
6
-   rewrite ^(.*)$ /index.php; 
7
-   }
8
-   index   index.htm index.html index.php;
9
- }

+ 0 - 19
certbot4nginx/examples/nginx/templates/php7.x-fpm.conf

@@ -1,19 +0,0 @@
1
-location ~ ^/(README|INSTALL|LICENSE|CHANGELOG|UPGRADING)$ {
2
-   deny all;
3
-}
4
-
5
-location ~ ^/(bin|SQL)/ {
6
-   deny all;
7
-}
8
-
9
-location ~ \.php$ {
10
-   try_files $uri $uri/ /index.php =404;
11
-   fastcgi_pass  localhost:9000;
12
-   fastcgi_index index.php;
13
-   fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
14
-   include fastcgi_params;
15
-}
16
-
17
-location ~ /.ht {
18
-    deny all;
19
-}

+ 0 - 13
certbot4nginx/examples/nginx/templates/proxy.conf

@@ -1,13 +0,0 @@
1
-proxy_redirect              off;
2
-proxy_set_header            Host $host;
3
-proxy_set_header            X-Real-IP $remote_addr;
4
-proxy_set_header            X-Forwarded-For $proxy_add_x_forwarded_for;
5
-client_max_body_size        10m;
6
-client_body_buffer_size     128k;
7
-proxy_connect_timeout       90;
8
-proxy_send_timeout          90;
9
-proxy_read_timeout          90;
10
-proxy_buffer_size           4k;
11
-proxy_buffers               4 32k;
12
-proxy_busy_buffers_size     64k;
13
-proxy_temp_file_write_size  64k;

certbot4mail/examples/nginx.conf → nginx_examples/nginx.conf


certbot4nginx/examples/nginx/sites-avalable/http_mail-mydomen → nginx_examples/nginx/sites-avalable/http_mail-mydomen


certbot4nginx/examples/nginx/sites-avalable/https_mail-mydomen → nginx_examples/nginx/sites-avalable/https_mail-mydomen


certbot4nginx/examples/nginx/ssl/ssl_mydomen-ru.conf → nginx_examples/nginx/ssl/ssl_mydomen-ru.conf


certbot4mail/examples/nginx/templates/content.conf → nginx_examples/nginx/templates/content.conf


certbot4mail/examples/nginx/templates/index_php.conf → nginx_examples/nginx/templates/index_php.conf


certbot4nginx/examples/nginx/templates/letsencrypt.conf → nginx_examples/nginx/templates/letsencrypt.conf


certbot4mail/examples/nginx/templates/php7.x-fpm.conf → nginx_examples/nginx/templates/php7.x-fpm.conf


certbot4mail/examples/nginx/templates/proxy.conf → nginx_examples/nginx/templates/proxy.conf