Ispravke skripte
[bacula-cn.git] / bacula-check-cert
1 #!/bin/bash
2
3 BACULACRT=/etc/bacula/bacula-fd.pem
4 DAYS=$(expr 30 \* 86400)
5
6 if [ ! -f $BACULACRT ]; then 
7         mailx -s "BACULA: Ne mogu otvoriti datoteku $BACULACRT!" root <<EOF
8
9                 Datoteka $BACULACRT nije dostupna ili je korisnik 'bacula' ne može otvoriti!
10
11                 Molimo provjerite status certifikata i po potrebi ga osvježite po uputama na adresi:
12                 https://sysportal.carnet.hr/node/834
13
14
15 EOF
16         exit 1
17 fi
18
19
20 SSL=$(openssl x509 -checkend $DAYS -in $BACULACRT)
21
22 if [ $? -eq 1 ];  then
23         mailx -s "BACULA: Valjanost certifikata za Baculu je ISTEKLA!" root <<EOF
24         
25         Valjanost certifikata za Baculu je istekla ili će isteći na dan: $(date --date="$(openssl x509 -in $BACULACRT -noout -enddate | cut -d= -f 2)" --iso-8601)
26         
27         Certifikat obnovite po uputama na https://sysportal.carnet.hr/node/834
28         
29 EOF
30         exit 1
31 fi
32
33 exit 0