HEX
Server: Apache/2.4.65 (Unix) OpenSSL/1.1.1k
System: Linux vps109042.inmotionhosting.com 4.18.0 #1 SMP Mon Sep 30 15:36:27 MSK 2024 x86_64
User: cisa (1010)
PHP: 8.2.30
Disabled: NONE
Upload Files
File: //opt/cwprads/check_service_ssl
#!/bin/bash

panelurl=https://$(hostname -f):2087/

if curl $panelurl 2>&1 >/dev/null | grep -qE "SSL certificate problem|not trusted by the user"
then
  echo "SSL Certificate for $panelurl bad, renewing"
  HOME=/root /scripts/install_acme
  /scripts/generate_hostname_ssl
  HOME=/root /usr/bin/bash /root/.acme.sh/acme.sh --issue --cert-home /root/.acme.sh/cwp_certs -d $(hostname -f) -w /usr/local/apache/autossl_tmp/ --certpath /etc/pki/tls/certs/hostname.cert --keypath /etc/pki/tls/private/hostname.key --fullchainpath /etc/pki/tls/certs/hostname.bundle --keylength 2048 --force --renew-hook /scripts/hostname_ssl_restart_services --log
  systemctl restart cwpsrv
else
  echo "SSL Certificate for $panelurl good, not renewing"
fi