This commit is contained in:
2019-02-10 19:49:59 -06:00
parent d915973f09
commit 34e2c5c2ad
2 changed files with 52 additions and 51 deletions

View File

@@ -631,7 +631,7 @@ CHECK-CERTS(){
SERVERFILE=/opt/idssys/nodemgmt/ssldomains SERVERFILE=/opt/idssys/nodemgmt/ssldomains
source /opt/idssys/nodemgmt/ssl-check.sh source /opt/idssys/nodemgmt/ssl-check.sh
# print_heading print_heading
# IFS=$'\n' # IFS=$'\n'
# for LINE in `egrep -v '(^#|^$)' ${SERVERFILE}`; do # for LINE in `egrep -v '(^#|^$)' ${SERVERFILE}`; do
# HOST=${LINE%% *} # HOST=${LINE%% *}

View File

@@ -223,6 +223,7 @@ prints() {
print_heading() print_heading()
{ {
echo 'YES'
if [ "${NOHEADER}" != "TRUE" ] if [ "${NOHEADER}" != "TRUE" ]
then then
if [ "${QUIET}" != "TRUE" ] && [ "${ISSUER}" = "TRUE" ] && [ "${NAGIOS}" != "TRUE" ] && [ "${VALIDATION}" != "TRUE" ] if [ "${QUIET}" != "TRUE" ] && [ "${ISSUER}" = "TRUE" ] && [ "${NAGIOS}" != "TRUE" ] && [ "${VALIDATION}" != "TRUE" ]
@@ -609,56 +610,56 @@ else
fi fi
### If a HOST and PORT were passed on the cmdline, use those values ### If a HOST and PORT were passed on the cmdline, use those values
if [ "${HOST}" != "" ] && [ "${PORT}" != "" ] # if [ "${HOST}" != "" ] && [ "${PORT}" != "" ]
then # then
print_heading # print_heading
check_server_status "${HOST}" "${PORT}" # check_server_status "${HOST}" "${PORT}"
print_summary # print_summary
#
### If a file is passed to the "-f" option on the command line, check # ### If a file is passed to the "-f" option on the command line, check
### each certificate or server / port combination in the file to see if # ### each certificate or server / port combination in the file to see if
### they are about to expire # ### they are about to expire
elif [ -f "${SERVERFILE}" ] # elif [ -f "${SERVERFILE}" ]
then # then
print_heading # print_heading
#
IFS=$'\n' # IFS=$'\n'
for LINE in `egrep -v '(^#|^$)' ${SERVERFILE}` # for LINE in `egrep -v '(^#|^$)' ${SERVERFILE}`
do # do
HOST=${LINE%% *} # HOST=${LINE%% *}
PORT=${LINE#* } # PORT=${LINE#* }
IFS=" " # IFS=" "
if [ "$PORT" = "FILE" ] # if [ "$PORT" = "FILE" ]
then # then
check_file_status ${HOST} "FILE" "${HOST}" # check_file_status ${HOST} "FILE" "${HOST}"
else # else
check_server_status "${HOST}" "${PORT}" # check_server_status "${HOST}" "${PORT}"
fi # fi
done # done
IFS=${OLDIFS} # IFS=${OLDIFS}
print_summary # print_summary
#
### Check to see if the certificate in CERTFILE is about to expire # ### Check to see if the certificate in CERTFILE is about to expire
elif [ "${CERTFILE}" != "" ] # elif [ "${CERTFILE}" != "" ]
then # then
print_heading # print_heading
check_file_status ${CERTFILE} "FILE" "${CERTFILE}" # check_file_status ${CERTFILE} "FILE" "${CERTFILE}"
print_summary # print_summary
#
### Check to see if the certificates in CERTDIRECTORY are about to expire # ### Check to see if the certificates in CERTDIRECTORY are about to expire
elif [ "${CERTDIRECTORY}" != "" ] && (${FIND} -L ${CERTDIRECTORY} -type f > /dev/null 2>&1) # elif [ "${CERTDIRECTORY}" != "" ] && (${FIND} -L ${CERTDIRECTORY} -type f > /dev/null 2>&1)
then # then
print_heading # print_heading
for FILE in `${FIND} -L ${CERTDIRECTORY} -type f`; do # for FILE in `${FIND} -L ${CERTDIRECTORY} -type f`; do
check_file_status ${FILE} "FILE" "${FILE}" # check_file_status ${FILE} "FILE" "${FILE}"
done # done
print_summary # print_summary
#
### There was an error, so print a detailed usage message and exit # ### There was an error, so print a detailed usage message and exit
else # else
usage # usage
exit 1 # exit 1
fi # fi
rm -f ${CERT_TMP} ${ERROR_TMP} rm -f ${CERT_TMP} ${ERROR_TMP}