Add initial madmail installer step

This commit is contained in:
Ana Custura 2026-03-30 15:15:22 +01:00
parent 441031a4ac
commit 48abccbbd6
3 changed files with 72 additions and 2 deletions

69
install_madmail.py Normal file
View file

@ -0,0 +1,69 @@
import pexpect
import json
def run_madmail_installer():
with open("./settings.txt", "r") as f:
settings = json.load(f)
butterbox_hostname = settings["butterbox_hostname"]
cmd = f"sudo ../madmail/madmail install"
child = pexpect.spawn(cmd, encoding = "utf-8")#
child.logfile = open("install_log.txt", "w")
child.expect("Customize every setting")
child.sendline("2")
child.expect("Primary domain")
child.sendline(butterbox_hostname)
child.expect("MX record")
child.sendline(butterbox_hostname)
child.expect("Public IP address")
child.sendline("127.0.0.1")
child.expect("Additional domains")
child.sendline("")
child.expect("State directory")
child.sendline("")
child.expect("Configuration directory")
child.sendline("")
child.expect("TLS certificate path")
child.sendline("")
child.expect("TLS private key path")
child.sendline("")
child.expect("SMTP port")
child.sendline("")
child.expect("Submission port")
child.sendline("")
child.expect("Submission TLS port")
child.sendline("")
child.expect("IMAP port")
child.sendline("")
child.expect("IMAP TLS port")
child.sendline("")
child.expect("Allow insecure")
child.sendline("n")
child.expect("Enable chatmail endpoint for user registration")
child.sendline("y")
child.expect("Chatmail HTTP port")
child.sendline("8081")
child.expect("Chatmail HTTPS port")
child.sendline("8443")
child.expect("Chatmail username length")
child.sendline("")
child.expect("Chatmail password length")
child.sendline("")
child.expect("Enable Shadowsocks proxy for faster messaging")
child.sendline("n")
child.expect("Enable TURN server")
child.sendline("n")
child.expect("Require PGP encryption for outgoing messages")
child.sendline("y")
child.expect("Allow secure join requests without encryption")
child.sendline("n")
child.expect("Passthrough senders")
child.sendline("")
child.expect("Passthrough recipients")
child.sendline("")
child.expect("Maximum message size")
child.sendline("")
child.expect("Add Cloudflare proxy disable tags to DNS records")
child.sendline("n")
child.expect("Enable logging for the server")
child.sendline("y")
child.expect(pexpect.EOF)