nagios-check_domain_expirat.../README.md
Alarig Le Lay 5a3f7686f0
Updating the readme to explain the basics
Signed-off-by: Alarig Le Lay <alarig@swordarmor.fr>
2024-07-27 13:39:47 +02:00

56 lines
3.1 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

Script intented to check a domain expiration with a query to the corresponding
RDAP server. The RDAP server for the TLD is extracted from the IANA JSON RDAP.
If the expiration field isnt found on the TLD server, the script falls back to
the registrar server.
This script is inspired from
https://raw.githubusercontent.com/buanzo/check_expiration_rdap/main/src/nagios_check_domain_expiration_rdap/nagios_check_domain_expiration_rdap.py
and `/usr/lib/python3.11/site-packages/nagiosplugin/examples/`
The script assumes that the TLD has only one label while looking for the RDAP
server from the IANA JSON. If its not the case it will fail.
Have fun.
For all the options, run `./check_domain_expiration_rdap.py -h`
Here are the tested cases:
```shell
# expired domain
alarig@x280 nagios-check_domain_expiration_rdap % (master *+%) ./check_domain_expiration_rdap.py found.com.br
EXPIRATION CRITICAL - -31 days until domain expires (outside range @~:15) | daystoexpiration=-31d;@15:30;@~:15
zsh: exit 2 ./check_domain_expiration_rdap.py found.com.br
# not reachable rdap server
alarig@x280 nagios-check_domain_expiration_rdap % (master *+%) ./check_domain_expiration_rdap.py 美しい.世界
EXPIRATION UNKNOWN - The connection to the RDAP server failed: HTTPSConnectionPool(host='rdap.teleinfo.cn', port=443): Max retries exceeded with url: /xn--rhqv96g/domain/xn--n8jub8754b.xn--rhqv96g (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x7f92a5d24650>: Failed to establish a new connection: [Errno 111] Connection refused'))
zsh: exit 3 ./check_domain_expiration_rdap.py 美しい.世界
# unexistant domain name
alarig@x280 nagios-check_domain_expiration_rdap % (master *+%) ./check_domain_expiration_rdap.py foundnotfound.fr
EXPIRATION UNKNOWN - The domain foundnotfound.fr has not been found
zsh: exit 3 ./check_domain_expiration_rdap.py foundnotfound.fr
# tld without rdap server
alarig@x280 nagios-check_domain_expiration_rdap % (master *+%) ./check_domain_expiration_rdap.py c.pt
EXPIRATION UNKNOWN - The TLD pt does not have an RDAP server
zsh: exit 3 ./check_domain_expiration_rdap.py c.pt
# domain with more than two labels
alarig@x280 nagios-check_domain_expiration_rdap % (master *+%) ./check_domain_expiration_rdap.py demarches.gouv.fr
EXPIRATION OK - 113 days until domain expires | daystoexpiration=113d;@15:30;@~:15
# unicode domain
alarig@x280 nagios-check_domain_expiration_rdap % (master *+%) ./check_domain_expiration_rdap.py こっち.みんな
EXPIRATION OK - 268 days until domain expires | daystoexpiration=268d;@15:30;@~:15
# near expiration domain
alarig@x280 nagios-check_domain_expiration_rdap % (master *+%) ./check_domain_expiration_rdap.py hostux.ninja
EXPIRATION WARNING - 17 days until domain expires (outside range @15:30) | daystoexpiration=17d;@15:30;@~:15
zsh: exit 1 ./check_domain_expiration_rdap.py hostux.ninja
# very far expiration domain
alarig@x280 nagios-check_domain_expiration_rdap % (master *+%) ./check_domain_expiration_rdap.py swordarmor.fr
EXPIRATION OK - 3615 days until domain expires | daystoexpiration=3615d;@15:30;@~:15
```