Esempio n. 1
0
 def resolve_host(self):
     self.config['HOST_IMAP'] = resolve(self.config['HOST_IMAP'])
     self.config['HOST_POP3'] = resolve(self.config['HOST_POP3'])
     self.config['HOST_AUTHSMTP'] = resolve(self.config['HOST_AUTHSMTP'])
     self.config['HOST_SMTP'] = resolve(self.config['HOST_SMTP'])
     if self.config['WEBMAIL'] != 'none':
         self.config['HOST_WEBMAIL'] = resolve(self.config['HOST_WEBMAIL'])
Esempio n. 2
0
 def resolve_host(self):
     self.config['HOST_IMAP'] = resolve(self.config['HOST_IMAP'])
     self.config['HOST_POP3'] = resolve(self.config['HOST_POP3'])
     self.config['HOST_AUTHSMTP'] = resolve(self.config['HOST_AUTHSMTP'])
     self.config['HOST_SMTP'] = resolve(self.config['HOST_SMTP'])
     if self.config['WEBMAIL'] != 'none':
         self.config['HOST_WEBMAIL'] = resolve(self.config['HOST_WEBMAIL'])
Esempio n. 3
0
#!/usr/bin/python3

import os
import shutil
import logging as log
import sys
from mailustart import resolve, convert

log.basicConfig(stream=sys.stderr, level=os.environ.get("LOG_LEVEL", "WARNING"))

# Actual startup script
os.environ["FRONT_ADDRESS"] = resolve(os.environ.get("FRONT_ADDRESS", "front"))
os.environ["IMAP_ADDRESS"] = resolve(os.environ.get("IMAP_ADDRESS", "imap"))

os.environ["MAX_FILESIZE"] = str(int(int(os.environ.get("MESSAGE_SIZE_LIMIT"))*0.66/1048576))

base = "/data/_data_/_default_/"
shutil.rmtree(base + "domains/", ignore_errors=True)
os.makedirs(base + "domains", exist_ok=True)
os.makedirs(base + "configs", exist_ok=True)

convert("/default.ini", "/data/_data_/_default_/domains/default.ini")
convert("/application.ini", "/data/_data_/_default_/configs/application.ini")
convert("/php.ini", "/usr/local/etc/php/conf.d/rainloop.ini")

os.system("chown -R www-data:www-data /data")

os.execv("/usr/local/bin/apache2-foreground", ["apache2-foreground"])

Esempio n. 4
0
from mailustart import resolve, convert

from podop import run_server

log.basicConfig(stream=sys.stderr, level=os.environ.get("LOG_LEVEL", "WARNING"))

def start_podop():
    os.setuid(8)
    url = "http://" + os.environ["ADMIN_ADDRESS"] + "/internal/dovecot/§"
    run_server(0, "dovecot", "/tmp/podop.socket", [
		("quota", "url", url ),
		("auth", "url", url),
		("sieve", "url", url),
    ])

# Actual startup script
os.environ["FRONT_ADDRESS"] = resolve(os.environ.get("FRONT_ADDRESS", "front"))
os.environ["REDIS_ADDRESS"] = resolve(os.environ.get("REDIS_ADDRESS", "redis"))
os.environ["ADMIN_ADDRESS"] = resolve(os.environ.get("ADMIN_ADDRESS", "admin"))
if os.environ["WEBMAIL"] != "none":
    os.environ["WEBMAIL_ADDRESS"] = resolve(os.environ.get("WEBMAIL_ADDRESS", "webmail"))

for dovecot_file in glob.glob("/conf/*.conf"):
    convert(dovecot_file, os.path.join("/etc/dovecot", os.path.basename(dovecot_file)))

# Run Podop, then postfix
multiprocessing.Process(target=start_podop).start()
os.system("chown mail:mail /mail")
os.system("chown -R mail:mail /var/lib/dovecot /conf")
os.execv("/usr/sbin/dovecot", ["dovecot", "-c", "/etc/dovecot/dovecot.conf", "-F"])
Esempio n. 5
0
def start_podop():
    os.setuid(100)
    url = "http://" + os.environ["ADMIN_ADDRESS"] + "/internal/postfix/"
    # TODO: Remove verbosity setting from Podop?
    run_server(0, "postfix", "/tmp/podop.socket",
               [("transport", "url", url + "transport/§"),
                ("alias", "url", url + "alias/§"),
                ("domain", "url", url + "domain/§"),
                ("mailbox", "url", url + "mailbox/§"),
                ("senderaccess", "url", url + "sender/access/§"),
                ("senderlogin", "url", url + "sender/login/§")])


# Actual startup script
os.environ["FRONT_ADDRESS"] = resolve(os.environ.get("FRONT_ADDRESS", "front"))
os.environ["ADMIN_ADDRESS"] = resolve(os.environ.get("ADMIN_ADDRESS", "admin"))
os.environ["HOST_ANTISPAM"] = resolve(
    os.environ.get("HOST_ANTISPAM", "antispam:11332"))
os.environ["HOST_LMTP"] = resolve(os.environ.get("HOST_LMTP", "imap:2525"))

for postfix_file in glob.glob("/conf/*.cf"):
    convert(postfix_file,
            os.path.join("/etc/postfix", os.path.basename(postfix_file)))

if os.path.exists("/overrides/postfix.cf"):
    for line in open("/overrides/postfix.cf").read().strip().split("\n"):
        line = line.strip()
        if line and line[0] != "#":
            os.system('postconf -e "{}"'.format(line))
Esempio n. 6
0
#!/usr/bin/python3

import os
import glob
import logging as log
import sys
from mailustart import resolve, convert

log.basicConfig(stream=sys.stderr, level=os.environ.get("LOG_LEVEL", "WARNING"))

# Actual startup script
os.environ["FRONT_ADDRESS"] = resolve(os.environ.get("FRONT_ADDRESS", "front"))

if "HOST_REDIS" not in os.environ: os.environ["HOST_REDIS"] = "redis"

for rspamd_file in glob.glob("/conf/*"):
    convert(rspamd_file, os.path.join("/etc/rspamd/local.d", os.path.basename(rspamd_file)))

# Run rspamd
os.execv("/usr/sbin/rspamd", ["rspamd", "-i", "-f"])
Esempio n. 7
0
import os
import logging as log
import sys
from mailustart import resolve, convert

args = os.environ.copy()

log.basicConfig(stream=sys.stderr, level=args.get("LOG_LEVEL", "WARNING"))

# Get the first DNS server
with open("/etc/resolv.conf") as handle:
    content = handle.read().split()
    args["RESOLVER"] = content[content.index("nameserver") + 1]

args["HOST_ADMIN"] = resolve(args.get("HOST_ADMIN", "admin"))
args["HOST_ANTISPAM"] = resolve(args.get("HOST_ANTISPAM", "antispam:11334"))
args["HOST_WEBMAIL"] = args.get("HOST_WEBMAIL", "webmail")
if args["WEBMAIL"] != "none":
    args["HOST_WEBMAIL"] = resolve(args.get("HOST_WEBMAIL"))
args["HOST_WEBDAV"] = args.get("HOST_WEBDAV", "webdav:5232")
if args["WEBDAV"] != "none":
    args["HOST_WEBDAV"] = resolve(args.get("HOST_WEBDAV"))

# TLS configuration
cert_name = os.getenv("TLS_CERT_FILENAME", default="cert.pem")
keypair_name = os.getenv("TLS_KEYPAIR_FILENAME", default="key.pem")
args["TLS"] = {
    "cert": ("/certs/%s" % cert_name, "/certs/%s" % keypair_name),
    "letsencrypt": ("/certs/letsencrypt/live/mailu/fullchain.pem",
        "/certs/letsencrypt/live/mailu/privkey.pem"),
Esempio n. 8
0
def start_podop():
    os.setuid(100)
    url = "http://" + os.environ["ADMIN_ADDRESS"] + "/internal/postfix/"
    # TODO: Remove verbosity setting from Podop?
    run_server(0, "postfix", "/tmp/podop.socket", [
		("transport", "url", url + "transport/§"),
		("alias", "url", url + "alias/§"),
		("domain", "url", url + "domain/§"),
        ("mailbox", "url", url + "mailbox/§"),
        ("senderaccess", "url", url + "sender/access/§"),
        ("senderlogin", "url", url + "sender/login/§")
    ])

# Actual startup script
os.environ["FRONT_ADDRESS"] = resolve(os.environ.get("FRONT_ADDRESS", "front"))
os.environ["ADMIN_ADDRESS"] = resolve(os.environ.get("ADMIN_ADDRESS", "admin"))
os.environ["HOST_ANTISPAM"] = resolve(os.environ.get("HOST_ANTISPAM", "antispam:11332"))
os.environ["HOST_LMTP"] = resolve(os.environ.get("HOST_LMTP", "imap:2525"))

for postfix_file in glob.glob("/conf/*.cf"):
    convert(postfix_file, os.path.join("/etc/postfix", os.path.basename(postfix_file)))

if os.path.exists("/overrides/postfix.cf"):
    for line in open("/overrides/postfix.cf").read().strip().split("\n"):
        os.system('postconf -e "{}"'.format(line))

if os.path.exists("/overrides/postfix.master"):
    for line in open("/overrides/postfix.master").read().strip().split("\n"):
        os.system('postconf -Me "{}"'.format(line))
Esempio n. 9
0
import os
import logging as log
import sys
from mailustart import resolve, convert

args = os.environ.copy()

log.basicConfig(stream=sys.stderr, level=args.get("LOG_LEVEL", "WARNING"))

# Get the first DNS server
with open("/etc/resolv.conf") as handle:
    content = handle.read().split()
    args["RESOLVER"] = content[content.index("nameserver") + 1]

args["HOST_ADMIN"] = resolve(args.get("HOST_ADMIN", "admin"))
args["HOST_ANTISPAM"] = resolve(args.get("HOST_ANTISPAM", "antispam:11334"))
args["HOST_WEBMAIL"] = args.get("HOST_WEBMAIL", "webmail")
if args["WEBMAIL"] != "none":
    args["HOST_WEBMAIL"] = resolve(args.get("HOST_WEBMAIL"))
args["HOST_WEBDAV"] = args.get("HOST_WEBDAV", "webdav:5232")
if args["WEBDAV"] != "none":
    args["HOST_WEBDAV"] = resolve(args.get("HOST_WEBDAV"))

# TLS configuration
cert_name = os.getenv("TLS_CERT_FILENAME", default="cert.pem")
keypair_name = os.getenv("TLS_KEYPAIR_FILENAME", default="key.pem")
args["TLS"] = {
    "cert": ("/certs/%s" % cert_name, "/certs/%s" % keypair_name),
    "letsencrypt": ("/certs/letsencrypt/live/mailu/fullchain.pem",
                    "/certs/letsencrypt/live/mailu/privkey.pem"),
Esempio n. 10
0
#!/usr/bin/python3

import os
import shutil
import logging as log
import sys
from mailustart import resolve, convert

log.basicConfig(stream=sys.stderr,
                level=os.environ.get("LOG_LEVEL", "WARNING"))

# Actual startup script
os.environ["FRONT_ADDRESS"] = resolve(os.environ.get("FRONT_ADDRESS", "front"))
os.environ["IMAP_ADDRESS"] = resolve(os.environ.get("IMAP_ADDRESS", "imap"))

os.environ["MAX_FILESIZE"] = str(
    int(int(os.environ.get("MESSAGE_SIZE_LIMIT")) * 0.66 / 1048576))

base = "/data/_data_/_default_/"
shutil.rmtree(base + "domains/", ignore_errors=True)
os.makedirs(base + "domains", exist_ok=True)
os.makedirs(base + "configs", exist_ok=True)

convert("/default.ini", "/data/_data_/_default_/domains/default.ini")
convert("/application.ini", "/data/_data_/_default_/configs/application.ini")
convert("/php.ini", "/usr/local/etc/php/conf.d/rainloop.ini")

os.system("chown -R www-data:www-data /data")

os.execv("/usr/local/bin/apache2-foreground", ["apache2-foreground"])
Esempio n. 11
0
 def resolve_host(self):
     self.config['HOST_IMAP'] = resolve(self.config['HOST_IMAP'])
     self.config['HOST_POP3'] = resolve(self.config['HOST_POP3'])
     self.config['HOST_AUTHSMTP'] = resolve(self.config['HOST_AUTHSMTP'])
     self.config['HOST_SMTP'] = resolve(self.config['HOST_SMTP'])
Esempio n. 12
0
#!/usr/bin/python3

import os
import glob
import logging as log
import sys
from mailustart import resolve, convert

log.basicConfig(stream=sys.stderr,
                level=os.environ.get("LOG_LEVEL", "WARNING"))

# Actual startup script
os.environ["FRONT_ADDRESS"] = resolve(os.environ.get("FRONT_ADDRESS", "front"))

if "HOST_REDIS" not in os.environ: os.environ["HOST_REDIS"] = "redis"

for rspamd_file in glob.glob("/conf/*"):
    convert(rspamd_file,
            os.path.join("/etc/rspamd/local.d", os.path.basename(rspamd_file)))

# Run rspamd
os.execv("/usr/sbin/rspamd", ["rspamd", "-i", "-f"])
Esempio n. 13
0
log.basicConfig(stream=sys.stderr,
                level=os.environ.get("LOG_LEVEL", "WARNING"))


def start_podop():
    os.setuid(8)
    url = "http://" + os.environ["ADMIN_ADDRESS"] + "/internal/dovecot/§"
    run_server(0, "dovecot", "/tmp/podop.socket", [
        ("quota", "url", url),
        ("auth", "url", url),
        ("sieve", "url", url),
    ])


# Actual startup script
os.environ["FRONT_ADDRESS"] = resolve(os.environ.get("FRONT_ADDRESS", "front"))
os.environ["REDIS_ADDRESS"] = resolve(os.environ.get("REDIS_ADDRESS", "redis"))
os.environ["ADMIN_ADDRESS"] = resolve(os.environ.get("ADMIN_ADDRESS", "admin"))
if os.environ["WEBMAIL"] != "none":
    os.environ["WEBMAIL_ADDRESS"] = resolve(
        os.environ.get("WEBMAIL_ADDRESS", "webmail"))

for dovecot_file in glob.glob("/conf/*.conf"):
    convert(dovecot_file,
            os.path.join("/etc/dovecot", os.path.basename(dovecot_file)))

# Run Podop, then postfix
multiprocessing.Process(target=start_podop).start()
os.system("chown mail:mail /mail")
os.system("chown -R mail:mail /var/lib/dovecot /conf")
os.execv("/usr/sbin/dovecot",