🗝
summary refs log tree commit diff
path: root/renew.py
diff options
context:
space:
mode:
authormia <mia@mia.jetzt>2024-06-08 22:56:14 -0700
committermia <mia@mia.jetzt>2024-06-08 22:56:14 -0700
commit5016065f2c1b959e578bc18cfcab226db970b401 (patch)
tree28b0826702f391651ebbf65d15ff06cf3f2227f5 /renew.py
downloadcertificates-5016065f2c1b959e578bc18cfcab226db970b401.tar.gz
certificates-5016065f2c1b959e578bc18cfcab226db970b401.zip
initial commit
Diffstat (limited to 'renew.py')
-rw-r--r--renew.py31
1 files changed, 31 insertions, 0 deletions
diff --git a/renew.py b/renew.py
new file mode 100644
index 0000000..d7efed4
--- /dev/null
+++ b/renew.py
@@ -0,0 +1,31 @@
+import io
+from tarfile import TarFile
+
+from commia.bearer import keys, set_key
+from commia.prelude import *
+
+from lib import pull, push, state_dir
+
+domains = [
+    "mia.jetzt",
+    "outskirts.town",
+    "standardtld.com",
+    "void.rehab",
+]
+
+pull()
+with (state_dir / "domains.txt").open("w") as fh:
+    for domain in domains:
+        fh.write(f"{domain} *.{domain}\n")
+run(["dehydrated", "--cron"])
+run(["dehydrated", "--cleanup"])
+push()
+
+print("[*] packaging certs")
+buffer = io.BytesIO()
+tar = TarFile("certs.tar", "w", buffer)
+for domain in domains:
+    tar.add(state_dir / f"certs/{domain}/fullchain.pem", f"{domain}.crt")
+    tar.add(state_dir / f"certs/{domain}/privkey.pem", f"{domain}.key")
+tar.close()
+set_key(keys.certificates.certs, buffer.getvalue())