Change to mailustart functions

master
Ionut Filip 6 years ago committed by Tim Möhlmann
parent 9684ebf33f
commit 004a431e97
No known key found for this signature in database
GPG Key ID: 8677988D8072E8DE

@ -4,10 +4,7 @@ RUN apk add --no-cache \
python3 py3-pip git \ python3 py3-pip git \
&& pip3 install --upgrade pip && pip3 install --upgrade pip
# Shared layer between rspamd, postfix, dovecot, unbound and nginx # Shared layer between rspamd, postfix, dovecot, unbound and nginx
RUN pip3 install jinja2 \ RUN pip3 install git+https://github.com/usrpro/MailuStart.git#egg=mailustart
&& pip3 install git+https://github.com/usrpro/MailuStart.git#egg=mailustart
# Shared layer between rspamd, postfix, dovecot
RUN pip3 install tenacity
# Image specific layers under this line # Image specific layers under this line
RUN apk add --no-cache \ RUN apk add --no-cache \
dovecot dovecot-pigeonhole-plugin rspamd-client bash \ dovecot dovecot-pigeonhole-plugin rspamd-client bash \

@ -1,10 +1,10 @@
FROM alpine:3.8 FROM alpine:3.8
# python3 shared with most images # python3 shared with most images
RUN apk add --no-cache \ RUN apk add --no-cache \
python3 py3-pip \ python3 py3-pip git \
&& pip3 install --upgrade pip && pip3 install --upgrade pip
# Shared layer between rspamd, postfix, dovecot, unbound and nginx # Shared layer between rspamd, postfix, dovecot, unbound and nginx
RUN pip3 install jinja2 RUN pip3 install git+https://github.com/usrpro/MailuStart.git#egg=mailustart
# Image specific layers under this line # Image specific layers under this line
RUN apk add --no-cache certbot nginx nginx-mod-mail openssl curl \ RUN apk add --no-cache certbot nginx nginx-mod-mail openssl curl \
&& pip3 install idna requests watchdog && pip3 install idna requests watchdog

@ -1,32 +1,23 @@
#!/usr/bin/python3 #!/usr/bin/python3
import jinja2
import os import os
import logging as log import logging as log
import sys import sys
from mailustart import resolve, convert
args = os.environ.copy() args = os.environ.copy()
log.basicConfig(stream=sys.stderr, level=args.get("LOG_LEVEL", "WARNING")) log.basicConfig(stream=sys.stderr, level=args.get("LOG_LEVEL", "WARNING"))
def convert(src, dst, args):
logger = log.getLogger("convert()")
logger.debug("Source: %s, Destination: %s", src, dst)
open(dst, "w").write(jinja2.Template(open(src).read()).render(**args))
# Get the first DNS server # Get the first DNS server
with open("/etc/resolv.conf") as handle: with open("/etc/resolv.conf") as handle:
content = handle.read().split() content = handle.read().split()
args["RESOLVER"] = content[content.index("nameserver") + 1] args["RESOLVER"] = content[content.index("nameserver") + 1]
if "HOST_WEBMAIL" not in args: args["HOST_WEBMAIL"] = resolve(args.get("HOST_WEBMAIL", "webmail"))
args["HOST_WEBMAIL"] = "webmail" args["HOST_ADMIN"] = resolve(args.get("HOST_ADMIN", "admin"))
if "HOST_ADMIN" not in args: args["HOST_WEBDAV"] = resolve(args.get("HOST_WEBDAV", "webdav:5232"))
args["HOST_ADMIN"] = "admin" args["HOST_ANTISPAM"] = resolve(args.get("HOST_ANTISPAM", "antispam:11334"))
if "HOST_WEBDAV" not in args:
args["HOST_WEBDAV"] = "webdav:5232"
if "HOST_ANTISPAM" not in args:
args["HOST_ANTISPAM"] = "antispam:11334"
# TLS configuration # TLS configuration
cert_name = os.getenv("TLS_CERT_FILENAME", default="cert.pem") cert_name = os.getenv("TLS_CERT_FILENAME", default="cert.pem")

@ -4,10 +4,7 @@ RUN apk add --no-cache \
python3 py3-pip git \ python3 py3-pip git \
&& pip3 install --upgrade pip && pip3 install --upgrade pip
# Shared layer between rspamd, postfix, dovecot, unbound and nginx # Shared layer between rspamd, postfix, dovecot, unbound and nginx
RUN pip3 install jinja2 \ RUN pip3 install git+https://github.com/usrpro/MailuStart.git#egg=mailustart
&& pip3 install git+https://github.com/usrpro/MailuStart.git#egg=mailustart
# Shared layer between rspamd, postfix, dovecot
RUN pip3 install tenacity
# Image specific layers under this line # Image specific layers under this line
RUN apk add --no-cache postfix postfix-pcre rsyslog \ RUN apk add --no-cache postfix postfix-pcre rsyslog \

@ -28,8 +28,8 @@ def start_podop():
# Actual startup script # Actual startup script
os.environ["FRONT_ADDRESS"] = resolve(os.environ.get("FRONT_ADDRESS", "front")) os.environ["FRONT_ADDRESS"] = resolve(os.environ.get("FRONT_ADDRESS", "front"))
os.environ["ADMIN_ADDRESS"] = resolve(os.environ.get("ADMIN_ADDRESS", "admin")) os.environ["ADMIN_ADDRESS"] = resolve(os.environ.get("ADMIN_ADDRESS", "admin"))
os.environ["HOST_ANTISPAM"] = os.environ.get("HOST_ANTISPAM", "antispam:11332") os.environ["HOST_ANTISPAM"] = resolve(os.environ.get("HOST_ANTISPAM", "antispam:11332"))
os.environ["HOST_LMTP"] = os.environ.get("HOST_LMTP", "imap:2525") os.environ["HOST_LMTP"] = resolve(os.environ.get("HOST_LMTP", "imap:2525"))
for postfix_file in glob.glob("/conf/*.cf"): for postfix_file in glob.glob("/conf/*.cf"):
convert(postfix_file, os.path.join("/etc/postfix", os.path.basename(postfix_file))) convert(postfix_file, os.path.join("/etc/postfix", os.path.basename(postfix_file)))

@ -4,10 +4,7 @@ RUN apk add --no-cache \
python3 py3-pip git \ python3 py3-pip git \
&& pip3 install --upgrade pip && pip3 install --upgrade pip
# Shared layer between rspamd, postfix, dovecot, unbound and nginx # Shared layer between rspamd, postfix, dovecot, unbound and nginx
RUN pip3 install jinja2 \ RUN pip3 install git+https://github.com/usrpro/MailuStart.git#egg=mailustart
&& pip3 install git+https://github.com/usrpro/MailuStart.git#egg=mailustart
# Shared layer between rspamd, postfix, dovecot
RUN pip3 install tenacity
# Image specific layers under this line # Image specific layers under this line
RUN apk add --no-cache rspamd rspamd-controller rspamd-proxy rspamd-fuzzy ca-certificates curl RUN apk add --no-cache rspamd rspamd-controller rspamd-proxy rspamd-fuzzy ca-certificates curl

@ -1,10 +1,10 @@
FROM alpine:3.8 FROM alpine:3.8
# python3 shared with most images # python3 shared with most images
RUN apk add --no-cache \ RUN apk add --no-cache \
python3 py3-pip \ python3 py3-pip git \
&& pip3 install --upgrade pip && pip3 install --upgrade pip
# Shared layer between rspamd, postfix, dovecot, unbound and nginx # Shared layer between rspamd, postfix, dovecot, unbound and nginx
RUN pip3 install jinja2 RUN pip3 install git+https://github.com/usrpro/MailuStart.git#egg=mailustart
# Image specific layers under this line # Image specific layers under this line
RUN apk add --no-cache unbound curl bind-tools \ RUN apk add --no-cache unbound curl bind-tools \
&& curl -o /etc/unbound/root.hints https://www.internic.net/domain/named.cache \ && curl -o /etc/unbound/root.hints https://www.internic.net/domain/named.cache \

@ -1,17 +1,12 @@
#!/usr/bin/python3 #!/usr/bin/python3
import jinja2
import os import os
import logging as log import logging as log
import sys import sys
from mailustart import convert
log.basicConfig(stream=sys.stderr, level=os.environ.get("LOG_LEVEL", "WARNING")) log.basicConfig(stream=sys.stderr, level=os.environ.get("LOG_LEVEL", "WARNING"))
def convert(src, dst):
logger = log.getLogger("convert()")
logger.debug("Source: %s, Destination: %s", src, dst)
open(dst, "w").write(jinja2.Template(open(src).read()).render(**os.environ))
convert("/unbound.conf", "/etc/unbound/unbound.conf") convert("/unbound.conf", "/etc/unbound/unbound.conf")
os.execv("/usr/sbin/unbound", ["-c /etc/unbound/unbound.conf"]) os.execv("/usr/sbin/unbound", ["-c /etc/unbound/unbound.conf"])

@ -1,7 +1,7 @@
FROM php:7.2-apache FROM php:7.2-apache
#Shared layer between rainloop and roundcube #Shared layer between rainloop and roundcube
RUN apt-get update && apt-get install -y \ RUN apt-get update && apt-get install -y \
python3 curl \ python3 curl python3-pip git \
&& rm -rf /var/lib/apt/lists \ && rm -rf /var/lib/apt/lists \
&& echo "ServerSignature Off" >> /etc/apache2/apache2.conf && echo "ServerSignature Off" >> /etc/apache2/apache2.conf
@ -21,6 +21,8 @@ RUN apt-get update && apt-get install -y \
&& chown -R www-data: * \ && chown -R www-data: * \
&& apt-get purge -y unzip \ && apt-get purge -y unzip \
&& rm -rf /var/lib/apt/lists && rm -rf /var/lib/apt/lists
RUN pip3 install git+https://github.com/usrpro/MailuStart.git#egg=mailustart
COPY include.php /var/www/html/include.php COPY include.php /var/www/html/include.php
COPY php.ini /php.ini COPY php.ini /php.ini

@ -1,21 +1,16 @@
#!/usr/bin/python3 #!/usr/bin/python3
import jinja2
import os import os
import shutil import shutil
import logging as log import logging as log
import sys import sys
from mailustart import resolve, convert
log.basicConfig(stream=sys.stderr, level=os.environ.get("LOG_LEVEL", "WARNING")) log.basicConfig(stream=sys.stderr, level=os.environ.get("LOG_LEVEL", "WARNING"))
def convert(src, dst):
logger = log.getLogger("convert()")
logger.debug("Source: %s, Destination: %s", src, dst)
open(dst, "w").write(jinja2.Template(open(src).read()).render(**os.environ))
# Actual startup script # Actual startup script
os.environ["FRONT_ADDRESS"] = os.environ.get("FRONT_ADDRESS", "front") os.environ["FRONT_ADDRESS"] = resolve(os.environ.get("FRONT_ADDRESS", "front"))
os.environ["IMAP_ADDRESS"] = os.environ.get("IMAP_ADDRESS", "imap") 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)) os.environ["MAX_FILESIZE"] = str(int(int(os.environ.get("MESSAGE_SIZE_LIMIT"))*0.66/1048576))

@ -1,7 +1,7 @@
FROM php:7.2-apache FROM php:7.2-apache
#Shared layer between rainloop and roundcube #Shared layer between rainloop and roundcube
RUN apt-get update && apt-get install -y \ RUN apt-get update && apt-get install -y \
python3 curl \ python3 curl python3-pip git \
&& rm -rf /var/lib/apt/lists \ && rm -rf /var/lib/apt/lists \
&& echo "ServerSignature Off" >> /etc/apache2/apache2.conf && echo "ServerSignature Off" >> /etc/apache2/apache2.conf
@ -23,6 +23,8 @@ RUN apt-get update && apt-get install -y \
&& chown -R www-data: logs temp \ && chown -R www-data: logs temp \
&& rm -rf /var/lib/apt/lists && rm -rf /var/lib/apt/lists
RUN pip3 install git+https://github.com/usrpro/MailuStart.git#egg=mailustart
COPY php.ini /php.ini COPY php.ini /php.ini
COPY config.inc.php /var/www/html/config/ COPY config.inc.php /var/www/html/config/
COPY start.py /start.py COPY start.py /start.py

@ -1,17 +1,12 @@
#!/usr/bin/python3 #!/usr/bin/python3
import os import os
import jinja2
import logging as log import logging as log
import sys import sys
from mailustart import convert
log.basicConfig(stream=sys.stderr, level=os.environ.get("LOG_LEVEL", "WARNING")) log.basicConfig(stream=sys.stderr, level=os.environ.get("LOG_LEVEL", "WARNING"))
def convert(src, dst):
logger = log.getLogger("convert()")
logger.debug("Source: %s, Destination: %s", src, dst)
open(dst, "w").write(jinja2.Template(open(src).read()).render(**os.environ))
os.environ["MAX_FILESIZE"] = str(int(int(os.environ.get("MESSAGE_SIZE_LIMIT"))*0.66/1048576)) os.environ["MAX_FILESIZE"] = str(int(int(os.environ.get("MESSAGE_SIZE_LIMIT"))*0.66/1048576))
convert("/php.ini", "/usr/local/etc/php/conf.d/roundcube.ini") convert("/php.ini", "/usr/local/etc/php/conf.d/roundcube.ini")

Loading…
Cancel
Save