Difference between revisions of "Cert expiration check from dns zone file"
Jump to navigation
Jump to search
(Created page with "# Tool https://github.com/genkiroid/cert https://github.com/genkiroid/cert/releases ``` git clone https://github.com/genkiroid/cert cd cmd/cert go build -o cert if you want...") |
|||
| (One intermediate revision by the same user not shown) | |||
| Line 12: | Line 12: | ||
``` | ``` | ||
| − | |||
``` | ``` | ||
#!/bin/bash | #!/bin/bash | ||
# DNS zone files must be in $domain.zone file format | # DNS zone files must be in $domain.zone file format | ||
| − | set - | + | set -e |
if [ "$#" -ne 1 ]; then | if [ "$#" -ne 1 ]; then | ||
| Line 23: | Line 22: | ||
exit | exit | ||
fi | fi | ||
| − | + | domain=$1 | |
| − | + | sleep_seconds=0 | |
| − | + | for i in $(sed '/; Zone records/,$!d' ${domain}.zone | sed '1,4d' | awk '{print $1}'); do | |
| − | + | fqdns="${fqdns} ${i}.${domain}" | |
| − | |||
sleep ${sleep_seconds} | sleep ${sleep_seconds} | ||
done | done | ||
| + | cert $fqdns | ||
``` | ``` | ||
Latest revision as of 22:58, 19 April 2023
Tool
https://github.com/genkiroid/cert
https://github.com/genkiroid/cert/releases
git clone https://github.com/genkiroid/cert cd cmd/cert go build -o cert if you want to build it from source using golang
#!/bin/bash
# DNS zone files must be in $domain.zone file format
set -e
if [ "$#" -ne 1 ]; then
echo "Usage: $0 <domain>"
echo "Example: $0 mktp.io"
exit
fi
domain=$1
sleep_seconds=0
for i in $(sed '/; Zone records/,$!d' ${domain}.zone | sed '1,4d' | awk '{print $1}'); do
fqdns="${fqdns} ${i}.${domain}"
sleep ${sleep_seconds}
done
cert $fqdns