Project

General

Profile

katello-certs-check-fix-LC_TIME.diff

Fix for missing LC_TIME environment in $(date) calls - Andreas Bleischwitz, 10/05/2019 12:30 PM

View differences:

katello-certs-check 2019-10-05 14:10:43.393089686 +0200
84 84
}
85 85

  
86 86
function check-expiration () {
87
    DATE=$(date -u +"%b %-d %R:%S %Y")
87
    DATE=$(LC_TIME=C date -u +"%b %-d %R:%S %Y")
88 88
    CERT_EXP=$(openssl x509 -noout -enddate -in $CERT_FILE | sed -e 's/notAfter=//' | awk '{$NF="";}1')
89 89
    CA_EXP=$(openssl x509 -noout -enddate -in $CA_BUNDLE_FILE | sed -e 's/notAfter=//' | awk '{$NF="";}1')
90
    DATE_TODAY=`date -d"${DATE}" +%Y%m%d%H%M%S`
91
    CERT_DATE=`date -d"${CERT_EXP}" +%Y%m%d%H%M%S`
92
    CA_DATE=`date -d"${CA_EXP}" +%Y%m%d%H%M%S`
90
    DATE_TODAY=`LC_TIME=C date -d"${DATE}" +%Y%m%d%H%M%S`
91
    CERT_DATE=`LC_TIME=C date -d"${CERT_EXP}" +%Y%m%d%H%M%S`
92
    CA_DATE=`LC_TIME=C date -d"${CA_EXP}" +%Y%m%d%H%M%S`
93 93
    printf "Checking expiration of certificate: "
94 94
    if [ $DATE_TODAY -gt $CERT_DATE ]; then
95 95
        error 6 "The certificate \"$CERT_FILE\" has already expired on: $CERT_EXP"