Dir cleanup.

This commit is contained in:
Andrew Schott 2024-07-02 04:07:29 -05:00
parent cf2edaa1e7
commit ab60ec957f
4 changed files with 0 additions and 0 deletions

43
ssl_certs/cert-expiry.sh Executable file
View file

@ -0,0 +1,43 @@
#!/bin/bash
#: <<'END'
# RHEL/Fedora rigs
RHELHOSTS=("www.schotty.com" "matrix.schotty.com" "shadow.schotty.com")
for rhel in "${RHELHOSTS[@]}"
do
echo "╔═══════════════════════════════════════════════════════════════════════════════════════╗"
echo -e "║Host :" $rhel "\t\t\t\t\t\t\t║"
expiry=$(
echo $rhel |
xargs -n 1 bash -c ' \
openssl s_client -connect $0:443 2> /dev/null | \
openssl x509 -noout -enddate | \
cut -d = -f 2 | \
xargs -I {} echo {} $0 ')
expiry="${expiry:0:24}"
echo -e "║SSL Cert Expiry :" ${expiry} "\t\t\t\t\t\t║"
echo -e "║System Status :" `ssh $rhel "uptime | awk -F'[a-z]:' '{ print $2}'"` "\t║"
echo -e "║Updates :" `ssh $rhel "sudo yum -y list updates | wc -l"`\
"\t\t\t\t\t\t\t\t\t║"
echo -e "╚═══════════════════════════════════════════════════════════════════════════════════════╝"
done
#END
# Debian based rigs
DEBIANHOSTS=("mx.andrewschott.com")
for debian in "${DEBIANHOSTS[@]}"
do
echo "╔═══════════════════════════════════════════════════════════════════════════════════════╗"
echo -e "║Host :" $debian "\t\t\t\t\t\t\t║"
expiry=$(
echo $debian |
xargs -n 1 bash -c ' \
openssl s_client -connect $0:443 2> /dev/null | \
openssl x509 -noout -enddate | \
cut -d = -f 2 | \
xargs -I {} echo {} $0 ')
expiry="${expiry:0:24}"
echo -e "║SSL Cert Expiry :" ${expiry} "\t\t\t\t\t\t║"
echo -e "║System Status :" `ssh $debian "uptime | awk -F'[a-z]:' '{ print $2}'"` "\t║"
echo -e "║Updates :" `ssh $debian "sudo apt update > /dev/null 2>&1;sudo apt-get -s upgrade | grep -P \"\\d\\K upgraded\" | cut -d \" \" -f1" `\
"\t\t\t\t\t\t\t\t\t║"
echo -e "╚═══════════════════════════════════════════════════════════════════════════════════════╝"
done

8
ssl_certs/check-ssl-expiry.sh Executable file
View file

@ -0,0 +1,8 @@
#/bin/bash
SERVERLIST=("shadow.schotty.com" "schotty.com" "matrix.schotty.com" "mx.andrewschott.com")
for i in ${SERVERLIST[*]}; do
echo | openssl s_client -servername $i -connect $i:443 2>/dev/null | openssl x509 -noout -subject -enddate
echo
done