ROOTPLOIT
Server: Apache
System: Linux node6122.myfcloud.com 6.14.3-x86_64-linode168 #1 SMP PREEMPT_DYNAMIC Mon Apr 21 19:47:55 EDT 2025 x86_64
User: bashacomputer (1004)
PHP: 7.4.33
Disabled: exec,passthru,shell_exec,system
Upload Files
File: //usr/lib64/nagios/plugins/check_a2_whm_ssl
#!/bin/bash

# Get the hostname and construct the domain
HOSTNAME=$(hostname)
DOMAIN="www${HOSTNAME}"
PORT=2087

# Get certificate expiration date in epoch format
EXPIRY_DATE=$(openssl s_client -connect ${DOMAIN}:${PORT} -servername ${DOMAIN} </dev/null 2>/dev/null | openssl x509 -noout -enddate | cut -d= -f2)
EXPIRY_EPOCH=$(date -d "${EXPIRY_DATE}" +%s)
CURRENT_EPOCH=$(date +%s)

# Calculate days remaining
DAYS_REMAINING=$(( (EXPIRY_EPOCH - CURRENT_EPOCH) / 86400 ))

# Check expiration thresholds
if [ "$DAYS_REMAINING" -le 14 ]; then
    echo "CRITICAL - SSL certificate for ${DOMAIN} expires in ${DAYS_REMAINING} days"
    exit 2
elif [ "$DAYS_REMAINING" -le 30 ]; then
    echo "WARNING - SSL certificate for ${DOMAIN} expires in ${DAYS_REMAINING} days"
    exit 1
else
    echo "OK - SSL certificate for ${DOMAIN} expires in ${DAYS_REMAINING} days"
    exit 0
fi