mirror of
https://git.lapiole.org/dani/ansible-roles.git
synced 2025-07-27 00:05:44 +02:00
Update to 2023-12-06 22:00
This commit is contained in:
12
roles/zabbix_server/files/scripts/cert_expire.sh
Normal file
12
roles/zabbix_server/files/scripts/cert_expire.sh
Normal file
@@ -0,0 +1,12 @@
|
||||
#/bin/sh
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
# Validate host:port
|
||||
if ! echo $1 | grep -qP '^(((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)(\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3})|(([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-]*[a-zA-Z0-9])\.)*([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\-]*[A-Za-z0-9])):\d{1,5}$'; then
|
||||
echo "Invalid host:port"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo $((($(echo -n | openssl s_client -connect $1 2>/dev/null | openssl x509 -noout -enddate | sed "s/.*=\(.*\)/\1/" | xargs -I __ date -d "__" +%s) - $(date +%s))/86400))
|
||||
|
Reference in New Issue
Block a user