🗝
summary refs log tree commit diff
diff options
context:
space:
mode:
authormia <mia@mia.jetzt>2024-06-30 18:26:02 -0700
committermia <mia@mia.jetzt>2024-06-30 18:26:02 -0700
commita856ec1a6fafd385b2a112ae144b94e472f9f619 (patch)
treed2742d7eb3c28d4e2aa8c7e02bb6db0178c7bec1
parent5016065f2c1b959e578bc18cfcab226db970b401 (diff)
downloadcertificates-main.tar.gz
certificates-main.zip
refactor HEAD main
-rw-r--r--renew.py17
1 files changed, 4 insertions, 13 deletions
diff --git a/renew.py b/renew.py
index d7efed4..429905e 100644
--- a/renew.py
+++ b/renew.py
@@ -1,4 +1,5 @@
 import io
+import os
 from tarfile import TarFile
 
 from commia.bearer import keys, set_key
@@ -6,17 +7,7 @@ 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()
@@ -24,8 +15,8 @@ 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")
+for domain in os.listdir(state_dir / "certs"):
+    tar.add((state_dir / f"certs/{domain}/fullchain.pem").resolve(), f"{domain}.crt")
+    tar.add((state_dir / f"certs/{domain}/privkey.pem").resolve(), f"{domain}.key")
 tar.close()
 set_key(keys.certificates.certs, buffer.getvalue())