1## Maddy Mail Server - default configuration file (2022-06-18)2## This is the copy of maddy.conf with changes necessary to run it in Docker.3# Suitable for small-scale deployments. Uses its own format for local users DB,4# should be managed via maddy subcommands.5#6# See tutorials at https://maddy.email for guidance on typical7# configuration changes.89# ----------------------------------------------------------------------------10# Base variables1112$(hostname) = {env:MADDY_HOSTNAME}13$(primary_domain) = {env:MADDY_DOMAIN}14$(local_domains) = $(primary_domain)1516tls file /data/tls/fullchain.pem /data/tls/privkey.pem1718# ----------------------------------------------------------------------------19# Local storage & authentication2021# pass_table provides local hashed passwords storage for authentication of22# users. It can be configured to use any "table" module, in default23# configuration a table in SQLite DB is used.24# Table can be replaced to use e.g. a file for passwords. Or pass_table module25# can be replaced altogether to use some external source of credentials (e.g.26# PAM, /etc/shadow file).27#28# If table module supports it (sql_table does) - credentials can be managed29# using 'maddy creds' command.3031auth.pass_table local_authdb {32 table sql_table {33 driver sqlite334 dsn credentials.db35 table_name passwords36 }37}3839# imapsql module stores all indexes and metadata necessary for IMAP using a40# relational database. It is used by IMAP endpoint for mailbox access and41# also by SMTP & Submission endpoints for delivery of local messages.42#43# IMAP accounts, mailboxes and all message metadata can be inspected using44# imap-* subcommands of maddy.4546storage.imapsql local_mailboxes {47 driver sqlite348 dsn imapsql.db49}5051# ----------------------------------------------------------------------------52# SMTP endpoints + message routing5354hostname $(hostname)5556table.chain local_rewrites {57 optional_step regexp "(.+)\+(.+)@(.+)" "$1@$3"58 optional_step static {59 entry postmaster postmaster@$(primary_domain)60 }61 optional_step file /etc/maddy/aliases62}6364msgpipeline local_routing {65 # Insert handling for special-purpose local domains here.66 # e.g.67 # destination lists.example.org {68 # deliver_to lmtp tcp://127.0.0.1:802469 # }7071 destination postmaster $(local_domains) {72 modify {73 replace_rcpt &local_rewrites74 }7576 deliver_to &local_mailboxes77 }7879 default_destination {80 reject 550 5.1.1 "User doesn't exist"81 }82}8384smtp tcp://0.0.0.0:25 {85 limits {86 # Up to 20 msgs/sec across max. 10 SMTP connections.87 all rate 20 1s88 all concurrency 1089 }9091 dmarc yes92 check {93 require_mx_record94 dkim95 spf96 }9798 source $(local_domains) {99 reject 501 5.1.8 "Use Submission for outgoing SMTP"100 }101 default_source {102 destination postmaster $(local_domains) {103 deliver_to &local_routing104 }105 default_destination {106 reject 550 5.1.1 "User doesn't exist"107 }108 }109}110111submission tls://0.0.0.0:465 tcp://0.0.0.0:587 {112 limits {113 # Up to 50 msgs/sec across any amount of SMTP connections.114 all rate 50 1s115 }116117 auth &local_authdb118119 source $(local_domains) {120 check {121 authorize_sender {122 prepare_email &local_rewrites123 user_to_email identity124 }125 }126127 destination postmaster $(local_domains) {128 deliver_to &local_routing129 }130 default_destination {131 modify {132 dkim $(primary_domain) $(local_domains) default133 }134 deliver_to &remote_queue135 }136 }137 default_source {138 reject 501 5.1.8 "Non-local sender domain"139 }140}141142target.remote outbound_delivery {143 limits {144 # Up to 20 msgs/sec across max. 10 SMTP connections145 # for each recipient domain.146 destination rate 20 1s147 destination concurrency 10148 }149 mx_auth {150 dane151 mtasts {152 cache fs153 fs_dir mtasts_cache/154 }155 local_policy {156 min_tls_level encrypted157 min_mx_level none158 }159 }160}161162target.queue remote_queue {163 target &outbound_delivery164165 autogenerated_msg_domain $(primary_domain)166 bounce {167 destination postmaster $(local_domains) {168 deliver_to &local_routing169 }170 default_destination {171 reject 550 5.0.0 "Refusing to send DSNs to non-local addresses"172 }173 }174}175176# ----------------------------------------------------------------------------177# IMAP endpoints178179imap tls://0.0.0.0:993 tcp://0.0.0.0:143 {180 auth &local_authdb181 storage &local_mailboxes182}