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/