Skip to content

exadra37-docker-forks/docker-exim-relay

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Exim Relay Docker Image

GitHub Tag Layers License Automated Build Docker Pulls

Exim relay Docker image based on Alpine Linux and support DKIM.

Create docker volume for dkim keys:

docker volume create --name=smtp-dkim

Create docker container:

docker run \
    -d \
    --name smtp \
    --restart=always \
    -u exim \
    -p 25:25 \
    -v smtp-dkim:/dkim \
    -h mail.example.com \
    -e DKIM_DOMAINS=example.com \
    bambucha/exim-relay
version: "2"
services:
  smtp:
    restart: always
    image: bambucha/exim-relay
    user: exim
    ports:
      - "25:25"
    volumes:
      - smtp-dkim:/dkim
    hostname: mail.example.com
    environment:
      - RELAY_FROM_HOSTS=10.0.0.0/8:172.16.0.0/12:192.168.0.0/16
      - DKIM_KEY_SIZE=1024
      - DKIM_SELECTOR=dkim
      - DKIM_SIGN_HEADERS=Date:From:To:Subject:Message-ID
      - DKIM_DOMAINS=example.com
volumes:
  smtp-dkim:
    driver: local

Reverse PTR

Create Reverse PTR DNS record:

1.0.168.192.in-addr.arpa. 300 IN PTR mail.example.com.

SPF

Create SPF DNS record:

example.com. 300 IN TXT "v=spf1 a mx -all"

DKIM

Get dkim public key with docker exec:

docker exec -it smtp cat /dkim/example.com.pub

or get dkim public key with docker-compose exec:

docker-compose exec smtp cat /dkim/example.com.pub

or get dkim public key from docker volume:

sudo cat /var/lib/docker/volumes/smtp-dkim/_data/example.com.pub

Create DKIM DNS record:

dkim._domainkey.example.com. 300 IN TXT "v=DKIM1; p=MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCqGPU5V6weixC6zPq+muZ2q0F7VkAfIV37ZjmZIK0Y0Kiz7ZiBIOjcVS958ncFnyqleSroqPV7ftgAykbxkIX/Rnq58VkxsCk7vO0nav0/cF0VlTP7/Pxe2PO4BYRW53rWUI6iOi7Y49q/1zWgcEa+fqc8FUqFvDebKtkeQy84BwIDAQAB"

Debug

Print a count of the messages in the queue:

docker exec -it smtp exim -bpc

Print a listing of the messages in the queue (time queued, size, message-id, sender, recipient):

docker exec -it smtp exim -bp

Remove all frozen messages:

docker exec -it smtp exim -bpu | grep frozen | awk {'print $3'} | xargs exim -Mrm

Test how exim will route a given address:

docker exec -it smtp exim -bt test@gmail.com
test@gmail.com
  router = dnslookup, transport = remote_smtp
  host gmail-smtp-in.l.google.com      [64.233.164.27] MX=5
  host alt1.gmail-smtp-in.l.google.com [64.233.187.27] MX=10
  host alt2.gmail-smtp-in.l.google.com [173.194.72.27] MX=20
  host alt3.gmail-smtp-in.l.google.com [74.125.25.27]  MX=30
  host alt4.gmail-smtp-in.l.google.com [74.125.198.27] MX=40

Display all of Exim's configuration settings:

docker exec -it smtp exim -bP

View a message's headers:

docker exec -it smtp exim -Mvh <message-id>

View a message's body:

docker exec -it smtp exim -Mvb <message-id>

View a message's logs:

docker exec -it smtp exim -Mar <message-id>

Remove a message from the queue:

docker exec -it smtp exim -Mrm <message-id> [ <message-id> ... ]

Send a message:

echo "Test message" | mailx -v -r "sender@example.com" -s "Test subject" -S smtp="localhost:25" recipient@example.com

License

The MIT License

About

Exim relay Docker image based on Alpine Linux and support DKIM

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Shell 100.0%