#!/usr/bin/python3 # SPDX-FileCopyrightText: 2021 Luca Beltrame # # SPDX-License-Identifier: BSD-3-Clause import os import time import requests IWANTMYNAME_ENDPOINT = "https://iwantmyname.com/basicauth/ddns" def main(): with open("/etc/letsencrypt/credentials") as handle: user, password = handle.read().strip().split() domain = os.environ["CERTBOT_DOMAIN"] validation_token = os.environ["CERTBOT_VALIDATION"] print("DEBUG", domain, validation_token) if "*." in domain: domain = domain.replace("*.", "") subdomain = f"_acme-challenge.{domain}" params = { "hostname": subdomain, "type": "txt", "value": "delete" } req = requests.get(IWANTMYNAME_ENDPOINT, params=params, auth=(user, password)) if __name__ == "__main__": main()