批次檢查tls憑證是否過期

URL Link //n.sfs.tw/16406

2024-05-01 11:44:33 By igogo

 

tls憑證一年一簽, 台中市有三百多所學校, 寫成一檔案
 

skaps.tc.edu.tw
www.skaps.tc.edu.tw

 

checkend 是以秒為單位, 所以抓300天, 60x60x24x300= 25920000

 

#!/usr/bin/bash

expiredates=25920000 

tclist="./tclist.txt"

while IFS= read -r site
do

echo -n "$site," >> log.csv
echo -n Q | openssl s_client -servername $site -connect $site:443 | openssl x509 -noout -checkend $expiredates >> log.csv
sleep 2
done < "$tclist"