Skip to content
This repository has been archived by the owner on Jul 1, 2021. It is now read-only.

This site can’t be reached - postfixadmin and webmail #126

Closed
themsay opened this issue Jun 24, 2017 · 5 comments
Closed

This site can’t be reached - postfixadmin and webmail #126

themsay opened this issue Jun 24, 2017 · 5 comments

Comments

@themsay
Copy link

themsay commented Jun 24, 2017

I found this nice docker setup few days ago, but I have two issues:

Domain: mydomain.com
Server IP: 42.90.34.64
# Note - Just made up example information

Question: 1

dns-setup https://github.com/hardware/mailserver#dns-setup:
I'm newbie to NSD setup. Presently I've DNS setup in Namecheap currently serving my mail on this server but not with docker.

Namecheap.com registrar DNS record:
# Host Records
mail                IN            A            42.90.34.64            5min
postfixadmin        IN            CNAME        mail.mydomain.com.      5min
webmail             IN            CNAME        mail.mydomain.com.      5min

# Mail Settings
@                   IN            MX           10                  mail.mydomain.com
  • Do I still need nsd?
  • If I want to disable nsd by commenting it out in docker-compose file, will it affect other services?

Question: 2

domainname: value

docker-compose.yml: My original file only domain name changed:
version: '2'
services:
  mailserver:
    image: hardware/mailserver
    container_name: mailserver
    domainname: mydomain.com
    hostname: mail
    # restart: always
    # extra_hosts:                        - Required for external database (on other server or for local database on host)
    #  - "mariadb:xx.xx.xx.xx"            - Replace with IP address of MariaDB server
    ports:
      - "25:25"     # SMTP                - Required
    # - "110:110"   # POP3       STARTTLS - Optional - For webmails/desktop clients
      - "143:143"   # IMAP       STARTTLS - Optional - For webmails/desktop clients
      - "465:465"   # SMTPS      SSL/TLS  - Optional - Enabled for compatibility reason, otherwise disabled
      - "587:587"   # Submission STARTTLS - Optional - For webmails/desktop clients
      - "993:993"   # IMAPS      SSL/TLS  - Optional - For webmails/desktop clients
      - "995:995"   # POP3S      SSL/TLS  - Optional - For webmails/desktop clients
      - "4190:4190" # SIEVE      STARTTLS - Optional - Recommended for mail filtering
    environment:
      - DBPASS=C0Q1KDJHPnIJAcWOkZpgDej
      - ENABLE_POP3=true           # Enable POP3 protocol
      - GREYLISTING=gross          # Enable gross greylisting policy server
      - DISABLE_CLAMAV=false       # Disable virus scanning
      - DISABLE_SPAMASSASSIN=false # Disable SPAM checking
      - DISABLE_SIEVE=flase        # Disable ManageSieve protocol
      - ENABLE_FETCHMAIL=true
      - ADD_DOMAINS=mydomain.net
    volumes:
      - /mnt/docker/mail:/var/mail
      - /mnt/docker/mail/opendkim:/etc/opendkim/keys
      - /mnt/docker/nginx/certs:/etc/letsencrypt
    depends_on:
      - mariadb

   postfixadmin:
    image: hardware/postfixadmin
    container_name: postfixadmin
    domainname: mydomain.com
    hostname: mail
    # restart: always
    environment:
      - DBPASS=C0Q1KDJHPnIJAcWOkZpgDej
    depends_on:
      - mailserver
      - mariadb

  rainloop:
    image: hardware/rainloop
    container_name: rainloop
    # restart: always
    volumes:
      - /mnt/docker/rainloop:/rainloop/data
    depends_on:
      - mailserver
      - mariadb

  nsd:
    image: hardware/nsd-dnssec
    container_name: nsd
    # restart: always
    ports:
      - "53:53"
      - "53:53/udp"
    volumes:
      - /mnt/docker/nsd/conf:/etc/nsd
      - /mnt/docker/nsd/zones:/zones
      - /mnt/docker/nsd/db:/var/db/nsd

   nginx:
    image: wonderfall/boring-nginx
    container_name: nginx
    # restart: always
    ports:
      - "80:8000"
      - "443:4430"
    volumes:
      - /mnt/docker/nginx/sites-enabled:/sites-enabled
      - /mnt/docker/nginx/conf:/conf.d
      - /mnt/docker/nginx/log:/var/log/nginx
      - /mnt/docker/nginx/certs:/certs
    depends_on:
      - postfixadmin
      - rainloop

  mariadb:
    image: mariadb:10.1
    container_name: mariadb
    # restart: always
    # Info : These variables are ignored when the volume already exists (databases created before).
    environment:
      - MYSQL_ROOT_PASSWORD=cx0zUNjGoYtZOp4f2UiY0icWBBm6lF5t9nZygdn+RfojF6GibVm5g==
      - MYSQL_DATABASE=postfix
      - MYSQL_USER=postfix
      - MYSQL_PASSWORD=C0Q1KDJHPnIJAcWOkZpgDej
    volumes:
      - /mnt/docker/mysql/db:/var/lib/mysql

On mailserver and postfixadmin 'domainname' section:

  • Should I replace domainname: mydomain.com with domainname: mail.mydomain.com?
setup.sh: My helper script:
#!/bin/bash

# Domains
DOMAIN=mydomain.com
DOMAIN_2=mydomain.net

# Remove the default MTA Exim4
sudo apt-get purge -y exim4*

# Stop system services
for i in nginx postfix dovecot amavis spamassassin clamav-daemon clamav-freshclam; do sudo service ${i} stop; done

# Make sure that no other application is interferring with mail server configuration
sudo netstat -tulpn | grep -E -w '25|80|110|143|443|465|587|993|995|4190'

# Start
sudo docker-compose -f docker-compose.yml up -d

# SSL
sudo docker-compose stop nginx

# Generate a certificate with letsencrypt webserver standalone
# Remember to add extra domain(s) if exist
sudo docker run -it --rm \
       -v /mnt/docker/nginx/certs:/etc/letsencrypt \
       -p 80:80 -p 443:443 \
       xataz/letsencrypt \
       certonly --standalone \
         --agree-tos \
         -m contact@${DOMAIN} \
         -d mail.${DOMAIN} \
         -d smtp.${DOMAIN} \
         -d imap.${DOMAIN} \
         -d webmail.${DOMAIN} \
         -d postfixadmin.${DOMAIN} \
         -d mail.${DOMAIN_2} \
         -d smtp.${DOMAIN_2} \
         -d imap.${DOMAIN_2}

sudo docker-compose up -d

# Run
$ ./setup.sh

# This site can’t be reached
https://postfixadmin.mydomain.com/setup.php and https://webmail.mydomain.com/?admin
# Note - I replaced mydomain.com with my real domain name on my browser.

Troubleshoot:
$ docker logs nginx - No log
$ docker logs postfixadmin - No log
$ docker logs rainloop - No log

$ sudo netstat -tulpn | grep -E -w '25|80|110|143|443|465|587|993|995|4190'

tcp6       0      0 :::25                   :::*                    LISTEN      18406/docker-proxy
tcp6       0      0 :::443                 :::*                    LISTEN      18655/docker-proxy
tcp6       0      0 :::4190                :::*                    LISTEN      18335/docker-proxy
tcp6       0      0 :::993                  :::*                    LISTEN      18357/docker-proxy
tcp6       0      0 :::995                  :::*                    LISTEN      18346/docker-proxy
tcp6       0      0 :::587                  :::*                    LISTEN      18368/docker-proxy
tcp6       0      0 :::143                  :::*                    LISTEN      18396/docker-proxy
tcp6       0      0 :::80                   :::*                    LISTEN      18665/docker-proxy
tcp6       0      0 :::465                  :::*                    LISTEN      18380/docker-proxy

Note - only tcp6 found no tcp

Any idea what can possibly be the problem? Thanks in advance.

@themsay
Copy link
Author

themsay commented Jun 24, 2017

I it was my mistake this helped https://github.com/hardware/mailserver/wiki/Reverse-proxy-configuration

@themsay themsay closed this as completed Jun 24, 2017
@Cyber1000
Copy link

Hi,

Sorry to ask on an old thread, but I'm confused of the tcp6-Problem too. And the page in the wiki doesn't exist any more. Do you know what was your problem?

Thanks a lot!

@navossoc
Copy link
Contributor

navossoc commented Jul 6, 2018

@Cyber1000 are you having any issue? If so, I think it is better to create a new issue.
As you said this is really old thread and probably doesn't apply to your issue, since there is no more a "nginx reverse proxy" on this project.

tcp6       0      0 :::80                   :::*                    LISTEN      18665/docker-proxy

Probably that means that port 80 is open, on both protocols tcp and tcp6.
Apparently, it depends on the operating system settings, but I've never tested.

// Listening on network "tcp" with host "0.0.0.0" or "[::]" may listen on both
// IPv4 and IPv6. To only use IPv4, use network "tcp4". To explicitly use both,
// listen on ":port" without a host.

More information:
golang/go#17615
nodejs/node#9390

@Cyber1000
Copy link

ok it was just the tcp6 that confused me, cause I can't connect to postfixadmin and webmail too. So I thought this problem may be similar to mine. I'll have a further look at it when I'm at home, probably creating a new issue.

Thanks for the fast answer!

@Cyber1000
Copy link

Ok tcp6 seems to include tcp4 too (at least on ubuntu), I've forgotten to change VOLUMES_ROOT_PATH in .env. This was necessary cause I changed the root path. This solved most issues for me.

Rainloop has still a problem on my machine, I'll create a new issue therefore.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants