1
0
Fork 0

cert tools

This commit is contained in:
Vladimír Dudr 2022-05-13 12:03:47 +02:00
parent a872caaf88
commit fe94f74b0e
2 changed files with 68 additions and 1 deletions

42
bin/executable_make_certs Normal file
View file

@ -0,0 +1,42 @@
#!/bin/zsh
set -e
doms=(
'localhost'
'djinn1.localhost'
'*.gdpr.localhost'
'*.up123.localhost'
'*.caves.localhost'
'*.eno.localhost'
'*.adminer.localhost'
'*.laya-server.localhost'
'*.eshop.localhost'
'*.teastarter.localhost'
'*.aikido.localhost'
'*.trailguide.localhost'
'*.mytango.localhost'
'*.invoicing.localhost'
'*.layaweb.localhost'
'*.asqix.localhost'
'*.statistix.localhost'
'*.booking.localhost'
'*.kotmel.localhost'
'*.baterie-grohe.localhost'
'*.zdravotniregistr.cz'
'*.katalogy.localhost'
'*.vizit-core.localhost'
'*.vizit.localhost'
'*.booking-core.localhost'
'*.nicerice.localhost'
'*.jopixel-support.localhost'
'*.eno-statistix.localhost'
)
mkcert -cert-file $HOME/.config/nginx/ssl/localhost.crt -key-file $HOME/.config/nginx/ssl/localhost.key $doms
if [[ $(systemctl --user is-active nginx) = active ]]
then
echo "reloading nginx"
systemctl --user reload-or-restart --user nginx
fi

View file

@ -1,6 +1,23 @@
#!/bin/zsh
coproc ( : | openssl s_client -connect $1:443 2>/dev/null| awk '/BEGIN CERTIFICATE/,/END CERTIFICATE/' | openssl x509 -in - -noout -startdate -enddate -ext subjectAltName | sed '/X509v3 Subject Alternative Name/ {n ; s/DNS://g ; s/, /\n /g;}' )
fetch() {
if [[ -f $1 ]]
then
fetch_file $1
else
fetch_remote $1
fi
}
fetch_remote() {
: | openssl s_client -connect $1:443 2>/dev/null| awk '/BEGIN CERTIFICATE/,/END CERTIFICATE/'
}
fetch_file() {
cat $1
}
coproc fetch $1 | openssl x509 -in - -noout -subject -issuer -startdate -enddate -ext subjectAltName | sed '/X509v3 Subject Alternative Name/ {n ; s/DNS://g ; s/, /\n /g;}'
exec 3> >(LC_ALL=C sort)
@ -9,6 +26,14 @@ while read -p line
do
if [[ $line = notBefore=* ]]
then
date -d ${line#notBefore=} '+Since: %d.%m.%Y %T'
continue
elif [[ $line = notAfter=* ]]
then
date -d ${line#notAfter=} '+Until: %d.%m.%Y %T'
continue
fi
if (( sort == 1 ))
then