|
@@ -4,7 +4,7 @@
|
4
|
4
|
# license: GPL 2.0
|
5
|
5
|
# create 2022
|
6
|
6
|
#
|
7
|
|
-version="0.3.7";
|
|
7
|
+version="0.3.9";
|
8
|
8
|
sname="avto4certbot";
|
9
|
9
|
# необходимы для работы: nginx,certbot (и если почтовый сервер то сервисы в restartMail)
|
10
|
10
|
# create new cert or update
|
|
@@ -122,17 +122,19 @@ for ((dmn=0; dmn != ${#domains[@]}; dmn++))
|
122
|
122
|
keytime=$(ls -l --time-style=long-iso $path_cert/${dreg[0]}/cert.pem |awk {'print$7'});
|
123
|
123
|
if [[ "$keydate" = "$rdate" ]] && [[ "$keytime" = "$rtime" ]]; then
|
124
|
124
|
((valtrue++));
|
|
125
|
+ if [ -d $path_cert/${dreg[0]} ]; then
|
125
|
126
|
cat $path_cert/${dreg[0]}/privkey.pem > $path_ssl/private/privkey_${dreg[0]}.pem;
|
126
|
127
|
cat $path_cert/${dreg[0]}/fullchain.pem > $path_ssl/private/fullchain_${dreg[0]}.pem;
|
127
|
128
|
cat $path_cert/${dreg[0]}/fullchain.pem > $path_ssl/private/${dreg[0]}.pem;
|
128
|
129
|
cat $path_cert/${dreg[0]}/privkey.pem >> $path_ssl/private/${dreg[0]}.pem;
|
129
|
130
|
#
|
130
|
|
- cp -f $path_ssl/private/${dreg[0]}.pem $path_ssl/certs/${dreg[0]}.pem
|
131
|
|
- cd $path_ssl/certs
|
132
|
|
- chmod 600 ${dreg[0]}.pem
|
133
|
|
- ln -sf ${dreg[0]}.pem `openssl x509 -noout -hash < ${dreg[0]}.pem`.0
|
134
|
|
- cd $path_ssl
|
135
|
|
- echo "$(date) - $sname: update cert for ${domains[$dmn]}">> $log;
|
|
131
|
+ cp -f $path_ssl/private/${dreg[0]}.pem $path_ssl/certs/${dreg[0]}.pem
|
|
132
|
+ cd $path_ssl/certs
|
|
133
|
+ chmod 600 ${dreg[0]}.pem
|
|
134
|
+ ln -sf ${dreg[0]}.pem `openssl x509 -noout -hash < ${dreg[0]}.pem`.0
|
|
135
|
+ cd $path_ssl
|
|
136
|
+ echo "$(date) - $sname: update cert for ${domains[$dmn]}">> $log;
|
|
137
|
+ fi
|
136
|
138
|
fi
|
137
|
139
|
done
|
138
|
140
|
if [ $valtrue != 0 ];then
|
|
@@ -152,6 +154,7 @@ if [ -d $path_cert ];
|
152
|
154
|
do
|
153
|
155
|
eval local dreg="(" $(echo -e ${domains[$dmn]}) ")";
|
154
|
156
|
((valtrue++));
|
|
157
|
+ if [ -d $path_cert/${dreg[0]} ]; then
|
155
|
158
|
cat $path_cert/${dreg[0]}/privkey.pem > $path_ssl/private/privkey_${dreg[0]}.pem;
|
156
|
159
|
cat $path_cert/${dreg[0]}/fullchain.pem > $path_ssl/private/fullchain_${dreg[0]}.pem;
|
157
|
160
|
cat $path_cert/${dreg[0]}/fullchain.pem > $path_ssl/private/${dreg[0]}.pem;
|
|
@@ -163,6 +166,7 @@ if [ -d $path_cert ];
|
163
|
166
|
ln -sf ${dreg[0]}.pem `openssl x509 -noout -hash < ${dreg[0]}.pem`.0
|
164
|
167
|
cd $path_ssl
|
165
|
168
|
echo "$(date) - $sname: update certlist for ${domains[$dmn]}">> $log;
|
|
169
|
+ fi
|
166
|
170
|
done
|
167
|
171
|
if [ $valtrue != 0 ]; then
|
168
|
172
|
echo >/etc/ssl/crt-list.txt
|