To start off, I followed this guide to the letter: https://www.davd.eu/byecloud-building-a-mailserver-with-modern-webmail/
I am attempting to create a mailserver for my server, but I thought I'd test the above implementation locally first. Make sure I can get everything up and running at least so I can see what I should be expecting before trying it on the server. Here's what I did:
I created this "docker-compose.yml":
version: "3"
services:
rainloop:
image: hardware/rainloop
links:
- mail
volumes:
- ./data/rainloop:/rainloop/data
mail:
image: tvial/docker-mailserver:latest
restart: always
hostname: mail
domainname: fancydomain.tld
container_name: mail
ports:
- "25:25"
- "143:143"
- "587:587"
- "993:993"
- "4190:4190"
volumes:
- ./data/mail/data:/var/mail
- ./data/mail/state:/var/mail-state
- ./mail/config:/tmp/docker-mailserver/
- ./data/entry/acme/acme-v01.api.letsencrypt.org/sites/mail.fancydomain.tld:/tmp/ssl:ro
environment:
- ENABLE_SPAMASSASSIN=1
- ENABLE_CLAMAV=1
- ENABLE_FAIL2BAN=1
- ENABLE_POSTGREY=1
- ONE_DIR=1
- DMS_DEBUG=0
- ENABLE_MANAGESIEVE=1
cap_add:
- NET_ADMIN
entry:
image: abiosoft/caddy:0.10.4
restart: always
privileged: true
links:
- rainloop
ports:
- "80:80"
- "443:443"
volumes:
- ./entry/Caddyfile:/etc/Caddyfile
- ./data/entry:/root/.caddy
There is a small difference between this "docker-compose.yml" and the one provided by the site previously mentioned. All I did was remove the environment variables prefixed with "SSL_" as instructed by the guide for people who are just running it locally.
I created a directory in the current working directory called "entry" and created a "Caddyfile" with these contents:
http://mail.fancydomain.tld {
proxy / rainloop:8888 {
transparent
}
}
Again, just a small difference from the one provided on the site. I prefixed the domain with "http://" for the same reason as step 2.
docker-compose up -d
curl -o setup.sh https://raw.githubusercontent.com/tomav/docker-mailserver/master/setup.sh; chmod a+x ./setup.sh
to obtain the setup script../setup.sh email add webmaster@fancydomain.tld fancypassword
with those exact credentials, again to minimizes changes to keep track of../setup.sh config dkim
but I did not proceed further with these records... As I'm not sure what to do with these locally.I proceeded to "Domains" > "Add Domain" and used filled out the form as so:
Name: fancydomain.tld
IMAP
Server: mail
Port: 143
Secure: STARTTLS
SMTP
Server: mail
Port: 587
Secure: STARTTLS
Use short login: Checked
Use authentication: Checked
SIEVE
Allow sieve scripts: Checked
Server: mail
Port: 4190
Secure: STARTTLS
From here I returned to "http://mail.fancydomain.tld" and tried to login to the Webmail client with this login: Login=webmaster@fancydomain.tld Password=fancypassword
This is where I get the error: "Can't connect to server"
I am not sure where to go from here. I don't know how to troubleshoot at all. Can I please get some help on what I should be doing to troubleshoot and figure out where the error is?
Thank you!
07/01/18 Update: So... I added "127.0.0.1 mail" into "/etc/hosts" and it worked! RainLoop can now connect to my mailserver! This brings up a new question though. For step 9, instead of "mail" for the three "Server" fields, I tried, "mail.fancydomain.tld" and according to the test, the connection is being refused. Why would the connection be refused for the full domain but not the short domain?
The solution for this one it to make sure both containers, RainLoop and Mail, share a bridged network. Then all the configurations can stay the same.