mirror of
https://github.com/docker-mailserver/docker-mailserver.git
synced 2024-01-19 02:48:50 +00:00
Removed "docker_mail_domain" env. variable to use docker hostname and improved documentation for #13
This commit is contained in:
parent
09c8166a24
commit
63a7be0e97
|
@ -16,6 +16,7 @@ Additional informations:
|
|||
|
||||
- only config files, no *sql database required
|
||||
- mails are stored in `/var/mail/${domain}/${username}`
|
||||
- you should use a data volume container for `/var/mail` for data persistence
|
||||
- email login are full email address (`username1@my-domain.com`)
|
||||
- ssl is strongly recommended
|
||||
- user accounts are managed in `./postfix/accounts.cf`
|
||||
|
@ -33,7 +34,7 @@ Additional informations:
|
|||
|
||||
## run
|
||||
|
||||
docker run -v "$(pwd)/postfix":/tmp/postfix -v "$(pwd)/spamassassin":/tmp/spamassassin -p "25:25" -p "143:143" -p "587:587" -p "993:993" -e docker_mail_domain=my-domain.com -t tvial/docker-mailserver
|
||||
docker run --name mail -v "$(pwd)/postfix":/tmp/postfix -v "$(pwd)/spamassassin":/tmp/spamassassin -p "25:25" -p "143:143" -p "587:587" -p "993:993" -h mail.my-domain.com -t tvial/docker-mailserver
|
||||
|
||||
## docker-compose template (recommended)
|
||||
|
||||
|
@ -47,11 +48,9 @@ Additional informations:
|
|||
- "143:143"
|
||||
- "587:587"
|
||||
- "993:993"
|
||||
environment:
|
||||
docker_mail_domain: "my-domain.com"
|
||||
volumes:
|
||||
- ./spamassassin:/tmp/spamassassin/:ro
|
||||
- ./postfix:/tmp/postfix/:ro
|
||||
- ./spamassassin:/tmp/spamassassin/
|
||||
- ./postfix:/tmp/postfix/
|
||||
|
||||
Volumes allow to:
|
||||
|
||||
|
|
|
@ -1,23 +1,19 @@
|
|||
#!/bin/sh
|
||||
|
||||
echo "Regenerating postfix 'vmailbox' and 'virtual' for given users"
|
||||
# rm /etc/postfix/virtual
|
||||
# rm /etc/postfix/virtual.db
|
||||
# rm /etc/postfix/vmailbox
|
||||
# rm /etc/postfix/vmailbox.db
|
||||
echo "# WARNING: this file is auto-generated. Modify accounts.cf in postfix directory on host" > /etc/postfix/vmailbox
|
||||
# Checking that /tmp/postfix/accounts.cf ends with a newline
|
||||
sed -i -e '$a\' /tmp/postfix/accounts.cf
|
||||
# Creating users
|
||||
while IFS=$'|' read -r login pass
|
||||
while IFS=$'|' read login pass
|
||||
do
|
||||
|
||||
# Setting variables for better readability
|
||||
user=$(echo ${login} | cut -d @ -f1)
|
||||
domain=$(echo ${login} | cut -d @ -f2)
|
||||
|
||||
# Let's go!
|
||||
echo "user '${user}' for domain '${domain}' with password '********'"
|
||||
echo "${login} ${domain}/${user}/" >> /etc/postfix/vmailbox
|
||||
userdb ${login} set uid=5000 gid=5000 home=/var/mail/${domain}/${user} mail=/var/mail/${domain}/${user}
|
||||
/usr/sbin/userdb ${login} set uid=5000 gid=5000 home=/var/mail/${domain}/${user} mail=/var/mail/${domain}/${user}
|
||||
echo "${pass}" | userdbpw -md5 | userdb ${login} set systempw
|
||||
echo "${pass}" | saslpasswd2 -p -c -u ${domain} ${login}
|
||||
mkdir -p /var/mail/${domain}
|
||||
|
@ -31,7 +27,7 @@ cp /tmp/postfix/virtual /etc/postfix/virtual
|
|||
echo "Postfix configurations"
|
||||
postmap /etc/postfix/vmailbox
|
||||
postmap /etc/postfix/virtual
|
||||
sed -i -r 's/DOCKER_MAIL_DOMAIN/'"$docker_mail_domain"'/g' /etc/postfix/main.cf
|
||||
sed -i -r 's/DOCKER_MAIL_DOMAIN/'"$(hostname -d)"'/g' /etc/postfix/main.cf
|
||||
cat /tmp/vhost.tmp | sort | uniq >> /etc/postfix/vhost && rm /tmp/vhost.tmp
|
||||
|
||||
echo "Fixing permissions"
|
||||
|
@ -39,7 +35,7 @@ chown -R 5000:5000 /var/mail
|
|||
mkdir -p /var/log/clamav && chown -R clamav:root /var/log/clamav
|
||||
|
||||
echo "Creating /etc/mailname"
|
||||
echo $docker_mail_domain > /etc/mailname
|
||||
echo $(hostname -d) > /etc/mailname
|
||||
|
||||
echo "Configuring Spamassassin"
|
||||
echo "required_hits 5.0" >> /etc/mail/spamassassin/local.cf
|
||||
|
|
Loading…
Reference in a new issue