Skip to content

Rspamd can not start because "address already in use' #3581

@Georgebobby

Description

@Georgebobby

📝 Preliminary Checks

  • I tried searching for an existing issue and followed the debugging docs advice, but still need assistance.

👀 What Happened?

I set up the docker mailserver with the env variable as follows:

ENABLE_RSPAMD=1
ENABLE_RSPAMD_REDIS=1
RSPAMD_LEARN=1
RSPAMD_CHECK_AUTHENTICATED=1
RSPAMD_GREYLISTING=1
RSPAMD_HFILTER=1
RSPAMD_HFILTER_HOSTNAME_UNKNOWN_SCORE=6

When I go inside the docker, I can see rspamd is working? but when running service rspamd status, it shows:

root@mail:/# service rspamd status
rspamd is not running ... failed!

I'm not sure what to do. Any suggestion would be greatly appreciated

The output of netstat -plntua:

tcp        0      0 0.0.0.0:993             0.0.0.0:*               LISTEN      910/dovecot         
tcp        0      0 0.0.0.0:587             0.0.0.0:*               LISTEN      1073/master         
tcp        0      0 0.0.0.0:465             0.0.0.0:*               LISTEN      1073/master         
tcp        0      0 0.0.0.0:25              0.0.0.0:*               LISTEN      1073/master         
tcp        0      0 0.0.0.0:143             0.0.0.0:*               LISTEN      910/dovecot         
tcp        0      0 0.0.0.0:4190            0.0.0.0:*               LISTEN      910/dovecot         
tcp        0      0 127.0.0.1:6379          0.0.0.0:*               LISTEN      944/redis-server 12 
tcp        0      0 127.0.0.1:10024         0.0.0.0:*               LISTEN      1089/amavisd-new (m 
tcp        0      0 127.0.0.1:10025         0.0.0.0:*               LISTEN      1073/master         
tcp        0      0 127.0.0.1:10001         0.0.0.0:*               LISTEN      895/postsrsd        
tcp        0      0 127.0.0.1:10002         0.0.0.0:*               LISTEN      895/postsrsd        
tcp        0      0 127.0.0.1:8893          0.0.0.0:*               LISTEN      963/opendmarc       
tcp        0      0 0.0.0.0:11334           0.0.0.0:*               LISTEN      953/rspamd: main pr 
tcp        0      0 127.0.0.1:11332         0.0.0.0:*               LISTEN      953/rspamd: main pr 
udp        0      0 127.0.0.1:60375         127.0.0.11:53           ESTABLISHED 1025/rspamd: contro 
udp        0      0 127.0.0.1:44562         127.0.0.11:53           ESTABLISHED 1025/rspamd: contro 
udp        0      0 127.0.0.1:45846         127.0.0.11:53           ESTABLISHED 1025/rspamd: contro 
udp        0      0 127.0.0.1:46457         127.0.0.11:53           ESTABLISHED 1025/rspamd: contro 
udp        0      0 127.0.0.1:48399         127.0.0.11:53           ESTABLISHED 1025/rspamd: contro 
udp        0      0 127.0.0.1:49385         127.0.0.11:53           ESTABLISHED 1025/rspamd: contro 
udp        0      0 127.0.0.1:50620         127.0.0.11:53           ESTABLISHED 1025/rspamd: contro 
udp        0      0 127.0.0.1:51150         127.0.0.11:53           ESTABLISHED 1025/rspamd: contro 
udp        0      0 127.0.0.1:35234         127.0.0.11:53           ESTABLISHED 1025/rspamd: contro 
udp        0      0 127.0.0.1:36868         127.0.0.11:53           ESTABLISHED 1025/rspamd: contro 
udp        0      0 127.0.0.1:54725         127.0.0.11:53           ESTABLISHED 1025/rspamd: contro 
udp        0      0 127.0.0.1:55190         127.0.0.11:53           ESTABLISHED 1025/rspamd: contro 
udp        0      0 127.0.0.11:56631        0.0.0.0:*                           -                   
udp        0      0 127.0.0.1:41113         127.0.0.11:53           ESTABLISHED 1025/rspamd: contro 
udp        0      0 127.0.0.1:41254         127.0.0.11:53           ESTABLISHED 1025/rspamd: contro 
udp        0      0 127.0.0.1:57685         127.0.0.11:53           ESTABLISHED 1025/rspamd: contro 
udp        0      0 127.0.0.1:43035         127.0.0.11:53           ESTABLISHED 1025/rspamd: contro

👟 Reproduction Steps

  1. Follow the doc to set up the docker mailserver (https://docker-mailserver.github.io/docker-mailserver/v12.1/usage/) and follow session on Abusix (Abusix Integration)
  2. Specify the Rspamd related env var:
ENABLE_RSPAMD=1
ENABLE_RSPAMD_REDIS=1
RSPAMD_LEARN=1
RSPAMD_CHECK_AUTHENTICATED=1
RSPAMD_GREYLISTING=1
RSPAMD_HFILTER=1
RSPAMD_HFILTER_HOSTNAME_UNKNOWN_SCORE=6
# as suggested:
ENABLE_POLICYD_SPF=0
ENABLE_SPAMASSASSIN=0

🐋 DMS Version

v12.1.0

💻 Operating System and Architecture

Linux 5.15.0-86-generic #96-Ubuntu SMP Wed Sep 20 08:29:36 UTC 2023 aarch64 aarch64 aarch64 GNU/Linux

⚙️ Container configuration files

services:
  mailserver:
    #image: mailserver/docker-mailserver:edge
    image: mailserver/docker-mailserver
    #image: mailserver/docker-mailserver@sha256:aa60891530d01f7ef44f5c2ac30693a73c3d60693b5ca594b853005b2df6b145
    container_name: mailserver
    # Provide the FQDN of your mail server here (Your DNS MX record should point to this value)
    hostname: mail.mydomain.com
      #domain: mydomain.com
    dns: 1.1.1.1
    env_file: mailserver.env
    # More information about the mail-server ports:
    # https://docker-mailserver.github.io/docker-mailserver/v12.1/config/security/understanding-the-ports/
    # To avoid conflicts with yaml base-60 float, DO NOT remove the quotation marks.
    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)
      - "11334:11334"  # rspamd web ui
    volumes:
      - ./docker-data/dms/mail-data/:/var/mail/
        #Rspamd redis persistence
      - ./docker-data/dms/mail-state/:/var/mail-state/
      - ./docker-data/dms/mail-logs/:/var/log/mail/
      - ./docker-data/dms/config/:/tmp/docker-mailserver/
      - /etc/localtime:/etc/localtime:ro
      - /etc/letsencrypt:/etc/letsencrypt
        #- ./docker-data/dms/opendkim/:/tmp/docker-mailserver/opendkim/
        # Rsapmd + opendkim
      - ./docker-data/dms/rspamd/override.d/dkim-signing.conf:/etc/rspamd/override.d/dkim-signing.conf
        # Rspamd abusix
      - ./docker-data/dms/rspamd/local.d/groups.conf:/etc/rspamd/local.d/groups.conf
      - ./docker-data/dms/rspamd/local.d/rbl.conf:/etc/rspamd/local.d/rbl.conf
      - ./docker-data/dms/rspamd/rspamd.local.lua:/etc/rspamd/rspamd.local.lua
        # White lable of spf
      - ./docker-data/dms/config/postfix-policyd-spf.conf:/etc/postfix-policyd-spf-python/policyd-spf.conf
        # Mail encryption on the server
      - ./docker-data/dms/config/dovecot/10-custom.conf:/etc/dovecot/conf.d/10-custom.conf
        # Mail encrytion keys
      - ./docker-data/dms/certs:/certs
      - ./docker-data/dms/cron/sa-learn:/etc/cron.d/sa-learn

      # Certbot
      #- "${PWD}/docker-data/certbot/certs/:/etc/letsencrypt/" 
      #- "${PWD}/docker-data/certbot/logs/:/var/log/letsencrypt/" 
    restart: always
    stop_grace_period: 1m
    # Uncomment if using `ENABLE_FAIL2BAN=1`:
    cap_add:
      - NET_ADMIN
      - SYS_PTRACE
    healthcheck:
      test: "ss --listening --tcp | grep -P 'LISTEN.+:smtp' || exit 1"
      timeout: 3s
      retries: 0
  ipv6nat:
    image: robbertkl/ipv6nat
    restart: always
    network_mode: "host"
    cap_add:
      - NET_ADMIN
      - SYS_MODULE
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock:ro
      - /lib/modules:/lib/modules:ro
networks:
  default:
    driver: bridge
    enable_ipv6: true
    ipam:
      driver: default
      config:
        - subnet: fd00:0123:4567::/48
          gateway: fd00:0123:4567::1

📜 Relevant log output

2023-10-13 20:59:32 #3645(main) <7n3qic>; map; rspamd_map_read_http_cached_file: read cached data for https://maps.rspamd.com/rspamd/mid.inc.zst from /var/lib/rspamd/cb5a8189726ac3a8880e1c44ed6220c6d794521b.map, 966 bytes; next check at: 2023-10-13 23:58:54; last modified on: 2023-06-25 20:30:02; etag: (NULL)
2023-10-13 20:59:32 #3645(main) <7n3qic>; map; read_map_file: /etc/rspamd/local.d/maps.d/mid.inc: map file is not found; it will be read automatically if created
2023-10-13 20:59:32 #3645(main) <7n3qic>; map; read_map_file: /etc/rspamd/local.d/mid.inc: map file is not found; it will be read automatically if created
2023-10-13 20:59:32 #3645(main) <7n3qic>; map; rspamd_kv_list_fin: read hash of 39 elements from https://maps.rspamd.com/rspamd/mid.inc.zst
2023-10-13 20:59:32 #3645(main) <4dego7>; map; read_map_static: static: read map data, 180 bytes
2023-10-13 20:59:32 #3645(main) <4dego7>; map; rspamd_regexp_list_fin: read regexp list of 2 elements
2023-10-13 20:59:32 #3645(main) <4dego7>; map; read_map_static: static: read map data, 2466 bytes
2023-10-13 20:59:32 #3645(main) <4dego7>; map; rspamd_regexp_list_fin: read regexp list of 104 elements
2023-10-13 20:59:32 #3645(main) <4dego7>; map; read_map_static: static: read map data, 452 bytes
2023-10-13 20:59:32 #3645(main) <4dego7>; map; rspamd_regexp_list_fin: read regexp list of 24 elements
2023-10-13 20:59:32 #3645(main) <4dego7>; map; read_map_static: static: read map data, 47 bytes
2023-10-13 20:59:32 #3645(main) <4dego7>; map; rspamd_regexp_list_fin: read regexp list of 2 elements
2023-10-13 20:59:32 #3645(main) <ks7cha>; map; read_map_file: /etc/rspamd/local.d/greylist-whitelist-domains.inc: map file is not found; it will be read automatically if created
2023-10-13 20:59:32 #3645(main) <ks7cha>; map; read_map_file: /etc/rspamd/local.d/maps.d/greylist-whitelist-domains.inc: map file is not found; it will be read automatically if created
2023-10-13 20:59:32 #3645(main) <4dego7>; map; read_map_static: static: read map data, 10 bytes
2023-10-13 20:59:32 #3645(main) <4dego7>; map; rspamd_radix_fin: read radix trie of 1 elements: ents=1 dup=0 tbm=0 lc=3 mem=1k free=0 waste=0
2023-10-13 20:59:32 #3645(main) <ffb981>; main; main: rspamd 3.4 is starting, build id: release
2023-10-13 20:59:32 #3645(main) <ffb981>; main; main: cpu features: 
2023-10-13 20:59:32 #3645(main) <ffb981>; main; main: cryptobox configuration: curve25519(libsodium), chacha20(generic), poly1305(libsodium), siphash(libsodium), blake2(libsodium), base64(ref)
2023-10-13 20:59:32 #3645(main) <ffb981>; main; main: libottery prf: CHACHA20-CRYPTOBOX
2023-10-13 20:59:32 #3646(main) <ffb981>; main; rspamd_main_daemon: daemonized successfully; old pid 3645, new pid 3646; pid file: false
2023-10-13 20:59:32 #3646(main) <ffb981>; main; main: event loop initialised with backend: epoll
2023-10-13 20:59:32 #3646(main) <ffb981>; main; spawn_workers: worker of type fuzzy(localhost:11335) is disabled in the config, skip spawning
2023-10-13 20:59:32 #3646(main) rspamd_inet_address_listen: bind 127.0.0.1:11332 failed: 98, 'Address already in use'
2023-10-13 20:59:32 #3646(main) <ffb981>; main; spawn_workers: cannot listen on normal socket 127.0.0.1:11332: Address already in use
2023-10-13 20:59:32 #3646(main) <ffb981>; main; spawn_workers: cannot create listen socket for rspamd_proxy at 127.0.0.1:11332
2023-10-13 20:59:32 #3646(main) <ffb981>; main; rspamd_hard_terminate: shutting down Rspamd due to fatal error

Improvements to this form?

it's great

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions