From 643c772de7830a40c52580d1f6133cdda02a778b Mon Sep 17 00:00:00 2001 From: "Denis V. Dedkov" Date: Tue, 15 Jul 2025 16:09:36 +0200 Subject: [PATCH] =?UTF-8?q?=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB=D0=B5?= =?UTF-8?q?=D0=BD=D0=B0=20=D0=BA=D0=BE=D0=BD=D1=84=D0=B8=D0=B3=D1=83=D1=80?= =?UTF-8?q?=D0=B0=D1=86=D0=B8=D1=8F=20=D0=B4=D0=BB=D1=8F=20=D0=BF=D0=BE?= =?UTF-8?q?=D1=87=D1=82=D1=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docker-compose.yml | 40 +++++++++++++++++++++++++ dovecot/conf.d/10-auth.conf | 3 ++ dovecot/conf.d/auth-passwdfile.conf.ext | 9 ++++++ dovecot/users | 1 + postfix/main.cf | 26 ++++++++++++++++ postfix/virtual/aliases | 2 ++ postfix/virtual/domains | 1 + postfix/virtual/email2user | 1 + 8 files changed, 83 insertions(+) create mode 100644 docker-compose.yml create mode 100644 dovecot/conf.d/10-auth.conf create mode 100644 dovecot/conf.d/auth-passwdfile.conf.ext create mode 100644 dovecot/users create mode 100644 postfix/main.cf create mode 100644 postfix/virtual/aliases create mode 100644 postfix/virtual/domains create mode 100644 postfix/virtual/email2user diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..7237934 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,40 @@ +version: '3.3' + +services: + postfix: + image: docker.dended.ru/postfix:latest + container_name: postfix + restart: always + volumes: + - ./postfix/main.cf:/etc/postfix/main.cf + - ./postfix/master.cf:/etc/postfix/master.cf + - ./postfix/virtual:/etc/postfix/virtual + - /usb1/mail-data:/var/mail + environment: + - POSTFIX_myhostname=mail.dended.ru + ports: + - "25:25" + - "587:587" + networks: + - mail-network + + dovecot: + image: docker.dended.ru/dovecot:latest + container_name: dovecot + restart: always + volumes: + - ./dovecot/dovecot.conf:/etc/dovecot/dovecot.conf + - ./dovecot/conf.d/:/etc/dovecot/conf.d/ + - ./ssl/:/etc/ssl/dovecot/ + - ./mail-data:/var/mail + - ./dovecot/users:/etc/dovecot/users + ports: + - "143:143" + - "993:993" + networks: + - mail-network + +networks: + mail-network: + driver: bridge + diff --git a/dovecot/conf.d/10-auth.conf b/dovecot/conf.d/10-auth.conf new file mode 100644 index 0000000..34ed11c --- /dev/null +++ b/dovecot/conf.d/10-auth.conf @@ -0,0 +1,3 @@ +disable_plaintext_auth = no +auth_mechanisms = plain login +!include auth-passwdfile.conf.ext diff --git a/dovecot/conf.d/auth-passwdfile.conf.ext b/dovecot/conf.d/auth-passwdfile.conf.ext new file mode 100644 index 0000000..7591d07 --- /dev/null +++ b/dovecot/conf.d/auth-passwdfile.conf.ext @@ -0,0 +1,9 @@ +passdb { + driver = passwd-file + args = scheme=PLAIN username_format=%u /etc/dovecot/users +} + +userdb { + driver = passwd-file + args = username_format=%u /etc/dovecot/users +} diff --git a/dovecot/users b/dovecot/users new file mode 100644 index 0000000..e7b877d --- /dev/null +++ b/dovecot/users @@ -0,0 +1 @@ +user@yourdomain.com:{PLAIN}password diff --git a/postfix/main.cf b/postfix/main.cf new file mode 100644 index 0000000..eeaae2b --- /dev/null +++ b/postfix/main.cf @@ -0,0 +1,26 @@ +# Основные настройки +myhostname = mail.dended.ru +mydomain = dended.ru +inet_interfaces = all + +# Виртуальные домены и почтовые ящики +virtual_mailbox_domains = /etc/postfix/virtual/domains +virtual_mailbox_maps = hash:/etc/postfix/virtual/email2user +virtual_alias_maps = hash:/etc/postfix/virtual/aliases +virtual_uid_maps = static:5000 +virtual_gid_maps = static:5000 + +# Настройки доставки +virtual_mailbox_base = /var/mail +virtual_mailbox_limit = 512000000 +virtual_minimum_uid = 1000 +virtual_transport = dovecot +dovecot_destination_recipient_limit = 1 + +# Безопасность +smtpd_tls_security_level = may +smtpd_sasl_auth_enable = yes +smtpd_sasl_type = dovecot +smtpd_sasl_path = private/auth +smtpd_sasl_security_options = noanonymous +smtpd_relay_restrictions = permit_mynetworks, permit_sasl_authenticated, reject_unauth_destination diff --git a/postfix/virtual/aliases b/postfix/virtual/aliases new file mode 100644 index 0000000..d44c2bb --- /dev/null +++ b/postfix/virtual/aliases @@ -0,0 +1,2 @@ +# Перенаправления (опционально) +admin@dended.ru user@dended.ru diff --git a/postfix/virtual/domains b/postfix/virtual/domains new file mode 100644 index 0000000..9479bf7 --- /dev/null +++ b/postfix/virtual/domains @@ -0,0 +1 @@ +dended.ru OK diff --git a/postfix/virtual/email2user b/postfix/virtual/email2user new file mode 100644 index 0000000..3138e7a --- /dev/null +++ b/postfix/virtual/email2user @@ -0,0 +1 @@ +user@dended.ru user/