curl 监控https 证书配置

sftp> cd //usr/share/ssl/certs
sftp> cd /usr/share/ssl/certs
sftp> lcd f:\cer\
sftp> ls
ca-bundle.crt         cyrus-imapd.pem       dmgr.cer
dmgr35.cer            dmgr35.pem            dovecot.pem
make-dummy-cert       Makefile              slapd.pem
tmp.txt
sftp> lls
dmgr35.cer            dmgrwas1.cer          dmgrwas2.cer
sftp> put dmgrwas1.cer dmgrwas2.cer
Uploading dmgrwas1.cer to /usr/share/ssl/certs/dmgrwas1.cer
  100% 492 bytes    492 bytes/s 00:00:00    
f:/cer/dmgrwas1.cer: 492 bytes transferred in 0 seconds (492 bytes/s)
Uploading dmgrwas2.cer to /usr/share/ssl/certs/dmgrwas2.cer
  100% 492 bytes    492 bytes/s 00:00:00    
f:/cer/dmgrwas2.cer: 492 bytes transferred in 0 seconds (492 bytes/s)
sftp>

 

[root@was-rsync certs]# pwd
//usr/share/ssl/certs
[root@was-rsync certs]# openssl x509 -in dmgr35.cer -inform der -out dmgr35.pem

#获取https响应代码
HTTP_CODE=`curl -o /dev/null -s --cacert /usr/share/ssl/certs/dmgr35.pem -w "%{http_code}" --max-time 180 "${URL}"`
if [ $HTTP_CODE -ge 400 ]
 then
 echo $HTTP_CODE ${URL}
elif [ $HTTP_CODE -eq 000 ]
 then
 echo $HTTP_CODE 无法显示该页面 ${URL}
fi
done

 

你可能感兴趣的:(curl 监控https 证书配置)