blob: 429905e9e4059f315add8f507bf132adf6fb7d2b (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
import io
import os
from tarfile import TarFile
from commia.bearer import keys, set_key
from commia.prelude import *
from lib import pull, push, state_dir
pull()
run(["dehydrated", "--cron"])
run(["dehydrated", "--cleanup"])
push()
print("[*] packaging certs")
buffer = io.BytesIO()
tar = TarFile("certs.tar", "w", buffer)
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())
|