From a3f9eea38739396fbb70c1039740d3e4b79e8605 Mon Sep 17 00:00:00 2001 From: Mar Alegre Date: Wed, 6 Oct 2021 20:58:28 -0400 Subject: [PATCH] integrated changes to mailsrv from dev branch --- mailsrv/Containerfile | 10 ++++++++-- mailsrv/Systemdfile | 10 ++++++++++ mailsrv/assets/apache/roundcube.conf | 8 ++++++++ mailsrv/{ => assets}/bugfix/cronfix | 0 mailsrv/assets/pg_hba.conf | 5 +++++ mailsrv/docs/Deploy.md | 7 +++++-- 6 files changed, 36 insertions(+), 4 deletions(-) create mode 100644 mailsrv/Systemdfile create mode 100644 mailsrv/assets/apache/roundcube.conf rename mailsrv/{ => assets}/bugfix/cronfix (100%) create mode 100644 mailsrv/assets/pg_hba.conf diff --git a/mailsrv/Containerfile b/mailsrv/Containerfile index 49ba0d1..d6d988a 100644 --- a/mailsrv/Containerfile +++ b/mailsrv/Containerfile @@ -29,7 +29,7 @@ ARG FILESUID=5000 ARG DEBIAN_FRONTEND=noninteractive # install packages we want -RUN apt update -y && apt install -y rsyslog postfix dovecot-imapd dovecot-lmtpd dovecot-sieve cron +RUN apt update -y && apt install -y rsyslog postfix dovecot-imapd dovecot-lmtpd dovecot-sieve cron apache2 postgresql roundcube roundcube-pgsql roundcube-plugins # add virtual mail user RUN addgroup --gid ${FILESUID:?} vmail && \ @@ -74,6 +74,12 @@ COPY assets/dovecot /etc/dovecot # make symlink to mail dir RUN ln -s /vol/mail /var/mail/virtual +### +### Roundcube +### + + + ### ### Working Directory ### @@ -89,5 +95,5 @@ WORKDIR /vol/data ### # bugfix for cron -COPY bugfix/cronfix /root/ +COPY assets/bugfix/cronfix /root/ RUN chmod +x /root/cronfix && /root/cronfix diff --git a/mailsrv/Systemdfile b/mailsrv/Systemdfile new file mode 100644 index 0000000..2fedb93 --- /dev/null +++ b/mailsrv/Systemdfile @@ -0,0 +1,10 @@ +#!/bin/bash + +# Create PostgreSQL database and user +cmd() { + sudo -u postgres psql -c "$1" +} + +cmd "CREATE USER $DBUSER;" +cmd "CREATE DATABASE $DBNAME;" +cmd "GRANT ALL PRIVILEGES ON DATABASE $DBNAME TO $DBUSER;" diff --git a/mailsrv/assets/apache/roundcube.conf b/mailsrv/assets/apache/roundcube.conf new file mode 100644 index 0000000..19d4b90 --- /dev/null +++ b/mailsrv/assets/apache/roundcube.conf @@ -0,0 +1,8 @@ + + #ServerAdmin webmaster@localhost + DocumentRoot /var/lib/roundcube + + ErrorLog ${APACHE_LOG_DIR}/error.log + CustomLog ${APACHE_LOG_DIR}/access.log combined + #LogLevel debug + diff --git a/mailsrv/bugfix/cronfix b/mailsrv/assets/bugfix/cronfix similarity index 100% rename from mailsrv/bugfix/cronfix rename to mailsrv/assets/bugfix/cronfix diff --git a/mailsrv/assets/pg_hba.conf b/mailsrv/assets/pg_hba.conf new file mode 100644 index 0000000..cafce29 --- /dev/null +++ b/mailsrv/assets/pg_hba.conf @@ -0,0 +1,5 @@ +# TYPE DATABASE USER ADDRESS METHOD +local all all trust +host all all localhost trust +host all all 127.0.0.1/32 trust +host all all ::1/128 trust diff --git a/mailsrv/docs/Deploy.md b/mailsrv/docs/Deploy.md index 9071e20..08282a9 100644 --- a/mailsrv/docs/Deploy.md +++ b/mailsrv/docs/Deploy.md @@ -65,9 +65,12 @@ Then exit and relogin to refresh the bash hash ``` acme.sh --issue --alpn --pre-hook 'systemctl stop haproxy' \ --post-hook 'systemctl start haproxy' -d ${domain:?} -acme.sh --install-cert -d ${domain:?} \ +DEPLOY_HAPROXY_PEM_PATH=/etc/haproxy/certs \ +DEPLOY_HAPROXY_RELOAD="/usr/sbin/service haproxy reload" \ +acme.sh --install-cert --deploy --deploy-hook haproxy \ --fullchain-file /srv/vol/mailsrv/ssl/fullchain.pem \ - --key-file /srv/vol/mailsrv/ssl/privkey.pem + --key-file /srv/vol/mailsrv/ssl/privkey.pem \ + -d ${domain:?} ``` ## make users and aliases