美文网首页
shell脚本检测https证书有效期

shell脚本检测https证书有效期

作者: 清闲的云云子 | 来源:发表于2021-08-11 11:31 被阅读0次
    #!/bin/bash
    # 检测https证书有效期
    
    source /etc/profile
    
    while read line; do
    echo "====================================================================================="
    
    #echo "now check domain" $line
    end_time=$(echo | timeout 1 openssl s_client -servername $line -connect $line:443 2>/dev/null | openssl x509 -noout -enddate 2>/dev/null | awk -F '=' '{
    print $2}' )
    #([ $? -ne 0 ] || [[ $end_time == '' ]]) && exit 10
    
    end_times=`date -d "$end_time" +%s `
    current_times=`date -d "$(date -u '+%b %d %T %Y GMT') " +%s `
    
    let left_time=$end_times-$current_times
    days=`expr $left_time / 86400`
    echo "$line sheng yu tian shu: " $days
    
    [ $days -lt 30 ] && echo "https shengyu xiaoyu 30 days"
    
    done < ./https_list
    

    相关文章

      网友评论

          本文标题:shell脚本检测https证书有效期

          本文链接:https://www.haomeiwen.com/subject/rlgqbltx.html