forked from GNUsocial/gnu-social
[DOCKER][MAIL] User is now created on setup and Dockerfile
Continuation of previous commit
This commit is contained in:
parent
2c3599721e
commit
19ed10078f
2
docker/mail/.gitignore
vendored
2
docker/mail/.gitignore
vendored
@ -1,2 +0,0 @@
|
|||||||
mail.env
|
|
||||||
config/*
|
|
@ -42,11 +42,10 @@ RUN \
|
|||||||
&& chmod +x "/etc/service/rsyslog/run"
|
&& chmod +x "/etc/service/rsyslog/run"
|
||||||
|
|
||||||
# Prepare user
|
# Prepare user
|
||||||
RUN \
|
RUN mkdir -p "/var/mail/${DOMAINNAME}" \
|
||||||
mkdir -p "/var/mail/${DOMAINNAME}" \
|
&& mkdir -p "/var/mail/${DOMAINPART}/${USER%@*}" \
|
||||||
&& mkdir -p "/var/mail/${DOMAINPART}/${USER@*}" \
|
|
||||||
&& chown vmail:vmail "/var/mail/${DOMAINNAME}" \
|
&& chown vmail:vmail "/var/mail/${DOMAINNAME}" \
|
||||||
&& chown vmail:vmail "/var/mail/${DOMAINPART}/${USER@*}"
|
&& chown vmail:vmail "/var/mail/${DOMAINPART}/${USER%@*}"
|
||||||
|
|
||||||
# Expose ports
|
# Expose ports
|
||||||
EXPOSE 25 110 143 587 993 995
|
EXPOSE 25 110 143 587 993 995
|
||||||
|
@ -1,46 +0,0 @@
|
|||||||
[unix_http_server]
|
|
||||||
file=/tmp/supervisor.sock
|
|
||||||
|
|
||||||
[supervisord]
|
|
||||||
nodaemon=true
|
|
||||||
user=root
|
|
||||||
loglevel=warn
|
|
||||||
|
|
||||||
[supervisorctl]
|
|
||||||
serverurl=unix:///tmp/supervisor.sock
|
|
||||||
user=root
|
|
||||||
|
|
||||||
[rpcinterface:supervisor]
|
|
||||||
supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface
|
|
||||||
|
|
||||||
[program:opendkim]
|
|
||||||
autostart=false
|
|
||||||
autorestart=true
|
|
||||||
stdout_logfile=/dev/fd/1
|
|
||||||
stdout_logfile_maxbytes=0
|
|
||||||
redirect_stderr=true
|
|
||||||
command=/usr/sbin/opendkim -x /etc/mail/opendkim/opendkim.conf
|
|
||||||
|
|
||||||
[program:postfix]
|
|
||||||
autostart=false
|
|
||||||
autorestart=true
|
|
||||||
stdout_logfile=/dev/fd/1
|
|
||||||
stdout_logfile_maxbytes=0
|
|
||||||
redirect_stderr=true
|
|
||||||
command=postfix -c /etc/mail/postfix/postfix.conf
|
|
||||||
|
|
||||||
[program:dovecot]
|
|
||||||
autostart=false
|
|
||||||
autorestart=true
|
|
||||||
stdout_logfile=/dev/fd/1
|
|
||||||
stdout_logfile_maxbytes=0
|
|
||||||
redirect_stderr=true
|
|
||||||
command=dovecot -c /etc/mail/dovecot/dovecot.conf
|
|
||||||
|
|
||||||
[program:rsyslog]
|
|
||||||
autostart=false
|
|
||||||
autorestart=true
|
|
||||||
stdout_logfile=/dev/fd/1
|
|
||||||
stdout_logfile_maxbytes=0
|
|
||||||
redirect_stderr=true
|
|
||||||
command=rsyslog -f /etc/mail/rsyslogd/rsyslog.conf
|
|
@ -24,6 +24,7 @@ DOMAINNAME=${domain_root}
|
|||||||
MAILNAME=${domain}
|
MAILNAME=${domain}
|
||||||
SSL_CERT=/etc/letsencrypt/live/${domain_root}/fullchain.pem
|
SSL_CERT=/etc/letsencrypt/live/${domain_root}/fullchain.pem
|
||||||
SSL_KEY=/etc/letsencrypt/live/${domain_root}/privkey.pem
|
SSL_KEY=/etc/letsencrypt/live/${domain_root}/privkey.pem
|
||||||
|
USER="${user}@${domain_root}"
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
DOMAINNAME="${domain_root}"
|
DOMAINNAME="${domain_root}"
|
||||||
@ -32,7 +33,7 @@ SSL_CERT="/etc/letsencrypt/live/${domain_root}/fullchain.pem"
|
|||||||
SSL_KEY="/etc/letsencrypt/live/${domain_root}/privkey.pem"
|
SSL_KEY="/etc/letsencrypt/live/${domain_root}/privkey.pem"
|
||||||
|
|
||||||
USER="${user}@${DOMAINNAME}"
|
USER="${user}@${DOMAINNAME}"
|
||||||
PASS=$(mkpasswd -m sha-512 -S "" -R 5000 ${pass})
|
PASSHASH=$(mkpasswd -m sha-512 -S "" -R 5000 ${pass})
|
||||||
|
|
||||||
# Config postfix
|
# Config postfix
|
||||||
sed -i -e "s#^\s*myhostname\s*=.*#myhostname = ${MAILNAME}#" config/postfix/main.cf
|
sed -i -e "s#^\s*myhostname\s*=.*#myhostname = ${MAILNAME}#" config/postfix/main.cf
|
||||||
@ -50,7 +51,7 @@ sed -i -e "s/^.*#HOSTNAME/${MAILNAME}#HOSTNAME/" config/opendkim/TrustedHosts
|
|||||||
|
|
||||||
# Prepare mail user
|
# Prepare mail user
|
||||||
touch config/aliases config/domains config/mailboxes config/passwd
|
touch config/aliases config/domains config/mailboxes config/passwd
|
||||||
echo "${DOMAINNAME} #OK" >> config/domains
|
echo "${DOMAINNAME} #OK" > config/domains
|
||||||
echo "${USER} ${USER}" >> config/aliases
|
echo "${USER} ${USER}" > config/aliases
|
||||||
echo "${USER} ${DOMAINNAME}/${user}/" >> config/mailboxes
|
echo "${USER} ${DOMAINNAME}/${user}/" > config/mailboxes
|
||||||
echo "${USER}:${PASSHASH}" >> config/passwd
|
echo "${USER}:${PASSHASH}" > config/passwd
|
||||||
|
Loading…
Reference in New Issue
Block a user