Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Mailserver log get wrong ip address. #4617

Copy link
Copy link
@jASSSSSSON

Description

@jASSSSSSON
Issue body actions

Hello everyone, I am trying to use Docker Mailserver, but I encountered an issue. The IP address I obtained in the log is the address of the Docker network card, regardless of where I logged in from. I also used caddy-l4 at the same time( https://github.com/mholt/caddy-l4 )Perform TCP forwarding. Here are log and docker-compose.yaml and caddy json.
At the same time, I used the official documentation to add support for reverse proxy, but none of them were effective. I think even if the reverse proxy configuration is invalid, the IP should still be the IP where the proxy is located, not the internal IP of Docker. Did I miss anything?

2025-11-27T14:15:14.054831+08:00 mail dovecot: imap-login: Login: user=<test@mydomain.com>, method=PLAIN, rip=172.24.0.1, lip=172.24.0.2, mpid=612, TLS, session=</iSfb41E2tWsGAAB>

2025-11-27T14:15:14.219948+08:00 mail dovecot: imap(test@mydomain.com)<612></iSfb41E2tWsGAAB>: Disconnected: Logged out in=82 out=819 deleted=0 expunged=0 trashed=0 hdr_count=0 hdr_bytes=0 body_count=0 body_bytes=0
services:
  mailserver:
    image: mailserver/docker-mailserver
    container_name: Mailserver
    hostname: mail.mydomain.com
    networks:
      - mail-network
    environment:
      - ENABLE_RSPAMD=1
      - ENABLE_OPENDKIM=0
      - ENABLE_OPENDMARC=0
      - ENABLE_AMAVIS=0
      - ENABLE_POLICYD_SPF=0
      - ENABLE_SPAMASSASSIN=0
      - ENABLE_POSTGREY=0
      - RSPAMD_GREYLISTING=1
      - ENABLE_CLAMAV=1
      - SSL_TYPE=manual
      - SSL_CERT_PATH=/tmp/dms/custom-certs/fullchain.pem
      - SSL_KEY_PATH=/tmp/dms/custom-certs/privkey.pem
      - ENABLE_OAUTH2=1
      - OAUTH2_INTROSPECTION_URL=https://id.mydomain.com/api/oidc/userinfo
      - ENABLE_FAIL2BAN=1
    cap_add:
      - NET_ADMIN
    ports:
      - "25:25"    # SMTP  (explicit TLS => STARTTLS, Authentication is DISABLED => use port 465/587 instead)
      - "143:143"  # IMAP4 (explicit TLS => STARTTLS)
      - "465:465"  # ESMTP (implicit TLS)
      - "587:587"  # ESMTP (explicit TLS => STARTTLS)
      - "993:993"  # IMAP4 (implicit TLS)
    volumes:
      - ./dms/mail-data/:/var/mail/
      - ./dms/mail-state/:/var/mail-state/
      - ./dms/mail-logs/:/var/log/mail/
      - ./dms/config/:/tmp/docker-mailserver/
      - /etc/localtime:/etc/localtime:ro
      - ./custom-certs/:/tmp/dms/custom-certs/
    restart: always
    stop_grace_period: 1m
    healthcheck:
      test: "ss --listening --ipv4 --tcp | grep --silent ':smtp' || exit 1"
      timeout: 3s
      retries: 0

networks:
  mail-network:
    driver: bridge
{
    "apps": {
        "layer4": {
            "@id": "layer4",
            "servers": {
                "test": {
                    "@id": "test-id-1246",
                    "listen": [
                        "0.0.0.0:993"
                    ],
                    "routes": [
                        {
                            "handle": [
                                {
                                    "handler": "proxy",
                                    "upstreams": [
                                        {
                                            "dial": [
                                                "mailserver_ip:993"
                                            ]
                                        }
                                    ]
                                }
                            ]
                        }
                    ]
                }
            }
        }
    }
}

Originally posted by @jASSSSSSON in #4610

Reactions are currently unavailable

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/networkingissue/limited supportDue to a specific configuration on the user side only limited support is offeredDue to a specific configuration on the user side only limited support is offeredkind/questionSomeone asked a question - feel free to answerSomeone asked a question - feel free to answermeta/closed due to age or inactivityThis issue / PR has been closed due to inactivityThis issue / PR has been closed due to inactivitymeta/staleThis issue / PR has become stale and will be closed if there is no further activityThis issue / PR has become stale and will be closed if there is no further activityservice/dovecotservice/postfix

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.