🗝
summary refs log tree commit diff
path: root/renew.py
blob: d7efed42738ae8fd624bd8659eec8d5c2f1ca6e9 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
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())