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())