Progetto

Generale

Profilo

listlecert.sh

Script per elencare certificati e domini - Simone Piccardi, 11-05-2016 15:10

Scarica (465 Bytes)

 
1
#!/bin/bash
2

    
3
echo Certificati installati:
4
for i in /etc/letsencrypt/live/*/cert.pem; do 
5
    echo "in $i":
6
    MAIN=$(openssl x509 -text -noout < $i|grep Subject:|cut -d= -f2)
7
    echo Main CN: $MAIN
8
    ALT=$(openssl x509 -text -noout < $i | \
9
      sed -n -r '/X509v3 Subject Alternative Name:/,+1p' \
10
       | egrep -v '(Subject Public Key Info:|X509v3 Subject)' \
11
       | tr -d ',:DNS')
12
    echo Alternate: 
13
    for j in $ALT; do
14
    	echo - $j
15
    done
16
done
17