summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuke Bratch <luke@bratch.co.uk>2018-11-21 22:50:23 +0000
committerLuke Bratch <luke@bratch.co.uk>2018-11-21 22:50:23 +0000
commit607cb60110fab704bfa58668fbe2681df9fe0fd4 (patch)
treee6b94e8628896a9583912b5170ce375c99635676
parent004608179988a12cffcecfa9981303270d445eff (diff)
Move the list of hosts and ports to a separate file, plus add sample and readme files
-rw-r--r--README3
-rwxr-xr-xcertexpiry.sh9
-rw-r--r--hostsandports.txt.sample6
3 files changed, 12 insertions, 6 deletions
diff --git a/README b/README
new file mode 100644
index 0000000..138e448
--- /dev/null
+++ b/README
@@ -0,0 +1,3 @@
+1. Create a file with a list of hosts and ports in the format "host:port" with one on each line - see the sample file myhostsandports.txt.sample
+2. By default the hosts/ports file is expected to be in the current directory and named "myhostsandports.txt"
+3. Edit default settings such as expiry warn time and the hosts/ports file name/path by editing certexpiry.sh
diff --git a/certexpiry.sh b/certexpiry.sh
index 90c5fd6..ea2feeb 100755
--- a/certexpiry.sh
+++ b/certexpiry.sh
@@ -5,14 +5,11 @@ set -euo pipefail
# Output warning if fewer than this number of seconds until expiry
WARNSECONDS=1209600 # Two weeks
# Bash array of host:port combinations to be checked
-HOSTSANDPORTS=(irc.tghost.co.uk:6697 irc.lc8n.com:6697 irc.pgburton.com:6697 www.tghost.co.uk mail.tghost.co.uk:25 \
- mail.tghost.co.uk:143 mail.tghost.co.uk mumble.tghost.co.uk:64738 bladns.net www.lc8n.com \
- www.blatech.net upload.bratch.co.uk www.nokiaplan3.com davmail.tghost.co.uk:1143 bcal.tghost.co.uk \
- www.blaupload.co.uk up.org.je)
+HOSTSANDPORTS="hostsandports.txt"
# ==== Variables ====
# Loop through all host:port combinations
-for HOSTANDPORT in "${HOSTSANDPORTS[@]}" ; do
+while read HOSTANDPORT ; do
# echo "DEBUG: HOSTANDPORT: $HOSTANDPORT."
@@ -72,4 +69,4 @@ for HOSTANDPORT in "${HOSTSANDPORTS[@]}" ; do
# echo "DEBUG: The certificate at $HOST:$PORT expires in $DIFFERENCE seconds (~$(expr $DIFFERENCE / 60 / 60 / 24) days)."
fi
-done
+done < "$HOSTSANDPORTS"
diff --git a/hostsandports.txt.sample b/hostsandports.txt.sample
new file mode 100644
index 0000000..b55841d
--- /dev/null
+++ b/hostsandports.txt.sample
@@ -0,0 +1,6 @@
+www.mywebsite.com
+foo.myotherwebsite.com
+bar.yetanotherwebsite.com:443
+mail.myhost.com:25
+mail.myhost.com:143
+mumble.myhost.com:64738