Jelajahi Sumber

Добавлена конфигурация для почты

Denis V. Dedkov 6 bulan lalu
induk
melakukan
643c772de7

+ 40 - 0
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
+

+ 3 - 0
dovecot/conf.d/10-auth.conf

@@ -0,0 +1,3 @@
+disable_plaintext_auth = no
+auth_mechanisms = plain login
+!include auth-passwdfile.conf.ext

+ 9 - 0
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
+}

+ 1 - 0
dovecot/users

@@ -0,0 +1 @@
+user@yourdomain.com:{PLAIN}password

+ 26 - 0
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

+ 2 - 0
postfix/virtual/aliases

@@ -0,0 +1,2 @@
+# Перенаправления (опционально)
+admin@dended.ru user@dended.ru

+ 1 - 0
postfix/virtual/domains

@@ -0,0 +1 @@
+dended.ru OK

+ 1 - 0
postfix/virtual/email2user

@@ -0,0 +1 @@
+user@dended.ru  user/