Server/wetu/mail
Allgemein
Die Mail-Infrastruktur des c3d2 dient, wie man sich denken kann, der Kommunikation sowohl untereinander als auch nach außen.
Obwohl es sich von außen betrachtet nur um eine Funktionalität handelt, sind trotzdem mehrere Dienste notwendig, um diese auch herzustellen. In unserem speziellen Fall ist es Postfix als MTA und Dovecot als MDA.
virtuelle user anlegen
In dem Ordner /root/wetuscripts/mail/bin
liegt eine Datei create_vmail_user
, die, wenn man sie ausführt, selbsterklärend dabei hilft einen Virtuellen Benutzer anzulegen. Da der Ordner /root/wetuscripts/mail/bin
in export PATH
steht kann
create_vmail_user
auch einfach ausgeführt werden ohne den langen Pfad zu kennen.
Konfiguration
Postfix
Konfigurationsdateien für Postfix liegen in /etc/postfix/
. Grundsätzlich können alle Konfigurationparameter in der Dokumentation von Postfix nachgelesen werden. Nachfolgend soll nur auf Besonderheiten in unserer Konfiguration eingegangen werden.
main.cf
- in der Option
relay_domains
neben$mydestination
auchlists.c3d2.de
eintragen - Um für Mailman Funktionalität herzustellen, muss im Eintrag
relay_recipient_maps
hash:/var/lib/mailman/data/virtual-mailman
eingetragen werden. smtpd_banner
ist ein Scherz.- Um Bots, Spammern und Ähnlichen das Leben schwer zu machen, werden die folgenden Optionen verwendet:
smtpd_error_sleep_time = 20 smtpd_soft_error_limit = 1 smtpd_hard_error_limit = 3 smtpd_junk_command_limit = 2
- Da der c3d2 ein Netzwerk aus Rechnern betriebt, ist das auch hier zu berücksichtigen. Dazu setze man
mynetworks_style = subnet
. Inmynetwork
sind dann alle vom mailserver zu verwaltenden Netze einzutragen, welches momentan127.0.0.0/8 89.238.79.216/29 89.238.64.140/32 172.22.98.0/24 [::1]/128 [fe80::]/10 [2a00:1828:2000:655::]/64 [2a00:1828:a008::]/48
sind.
Daemon-Einstellungen
folgendes sind die grundlegenden Einstellungen für den Postfix-Daemon
queue_directory = /var/spool/postfix command_directory = /usr/sbin daemon_directory = /usr/lib/postfix mail_owner = postfix setgid_group = postdrop home_mailbox = .maildir/ smtpd_banner = $myhostname ESMTP Ia! Ia! Cthulhu Fthagn! debug_peer_level = 2 biff = no mail_spool_directory = /var/mail sendmail_path = /usr/sbin/sendmail newaliases_path = /usr/bin/newaliases mailq_path = /usr/bin/mailq manpage_directory = /usr/share/man mailbox_command = /usr/lib/dovecot/deliver defer_transports = mailbox_size_limit = 0 message_size_limit = 10240000
home_mailbox
gibt den Namen und gleichzeitig den Typ der Mailbox im Nutzerverzeichnis des Empfängers
SSL Konfiguration
smtp_sasl_auth_enable = no smtpd_sasl_auth_enable = yes smtpd_sasl_security_options = noanonymous, noplaintext smtpd_sasl_tls_security_options = noanonymous smtpd_sasl_authenticated_header = yes smtpd_sasl_type = dovecot smtpd_sasl_path = private/auth
TLS Konfiguration
tls_random_source = dev:/dev/urandom ### mail - server to server smtp_tls_cert_file = /etc/postfix/ssl/server.crt smtp_tls_key_file = /etc/postfix/ssl/server.key smtp_tls_note_starttls_offer = yes smtp_use_tls = yes ### _mandatory gilt fuer security_level = encrypt / _OHNE_mandatory gilt fuer security_level = may smtp_tls_mandatory_exclude_ciphers = MEDIUM, LOW, aNULL, eNULL, SEED, 3DES, DES, MD5, EXP, CBC, PSD, PSK, SRP, DSS, RC4 smtp_tls_exclude_ciphers = MEDIUM, LOW, aNULL, eNULL, SEED, 3DES, DES, MD5, EXP, CBC, PSD, PSK, SRP, DSS, RC4 smtp_tls_mandatory_protocols = TLSv1, TLSv1.1, Tlsv1.2, !SSLv2, !SSLv3 smtp_tls_ciphers = high smtp_tls_mandatory_ciphers = high smtp_tls_security_level = may smtp_tls_protocols = TLSv1, TLSv1.1, Tlsv1.2, !SSLv2, !SSLv3 smtp_tls_loglevel = 1 ### mail - client to server smtpd_tls_cert_file = /etc/postfix/ssl/server.crt smtpd_tls_key_file = /etc/postfix/ssl/server.key #smtpd_tls_CAfile = /etc/postfix/ssl/class3.crt smtpd_use_tls = yes smtpd_tls_auth_only = yes smtpd_tls_security_level = may smtpd_tls_received_header = yes smtpd_tls_session_cache_timeout = 3600s ### _mandatory gilt fuer security_level = encrypt / _OHNE_mandatory gilt fuer security_level = may smtpd_tls_ciphers = high smtpd_tls_mandatory_ciphers = high smtpd_tls_mandatory_exclude_ciphers = MEDIUM, LOW, aNULL, eNULL, SEED, 3DES, DES, MD5, EXP, CBC, PSD, PSK, SRP, DSS, RC4 smtpd_tls_exclude_ciphers = MEDIUM, LOW, aNULL, eNULL, SEED, 3DES, DES, MD5, EXP, CBC, PSD, PSK, SRP, DSS, RC4 smtpd_tls_mandatory_protocols = TLSv1, TLSv1.1, Tlsv1.2, !SSLv2, !SSLv3 smtpd_tls_protocols = TLSv1, TLSv1.1, Tlsv1.2, !SSLv2, !SSLv3 smtpd_tls_loglevel = 1
### smtpd security_level = MUSS may sein! ### ### --- sonst kann sich Amavis nicht connecten ### ### --- können NICHT-TLS fähige Mailserver Mails nicht zustellen ### ### ### From MTA(smtp:[127.0.0.1]:10025) during fwd-rundown-1 (Negative SMTP response to RSET: 530 5.7.0 Must issue a STARTTLS command first at ### Blocked MTA-BLOCKED {RejectedInbound} proxy-reject: END-OF-MESSAGE: 530 5.7.0 - Rejected by next-hop MTA on relaying, from MTA(smtp:[127.0.0.1]:10025): 530 5.7.0 Must issue a STARTTLS command first ### #smtpd_tls_security_level = may
SSL Cipher Suites Supported
Postfix:
Testing ECDHE-RSA-AES256-GCM-SHA384...YES Testing ECDHE-RSA-AES256-SHA384...YES Testing ECDHE-RSA-AES256-SHA...YES Testing DHE-RSA-AES256-GCM-SHA384...YES Testing DHE-RSA-AES256-SHA256...YES Testing DHE-RSA-AES256-SHA...YES Testing DHE-RSA-CAMELLIA256-SHA...YES Testing AES256-GCM-SHA384...YES ***Testing AES256-SHA256...YES ***Testing AES256-SHA...YES ***Testing CAMELLIA256-SHA...YES Testing ECDHE-RSA-AES128-GCM-SHA256...YES Testing ECDHE-RSA-AES128-SHA256...YES Testing ECDHE-RSA-AES128-SHA...YES Testing DHE-RSA-AES128-GCM-SHA256...YES Testing DHE-RSA-AES128-SHA256...YES Testing DHE-RSA-AES128-SHA...YES Testing DHE-RSA-CAMELLIA128-SHA...YES Testing AES128-GCM-SHA256...YES ***Testing AES128-SHA256...YES ***Testing AES128-SHA...YES ***Testing CAMELLIA128-SHA...YES
Dovecot:
Testing DHE-RSA-AES256-GCM-SHA384...YES Testing DHE-RSA-AES256-SHA...YES ***Testing AES256-SHA...YES
*** für Kompatibilität mit Microsoft Outlook & Co. / Clients mit OpenSSL < 0.9.8
virtual
In der virtual sind alle Weiterleitungen / Aliase konfiguriert. Wenn diese geändert wird, muss anschließend
postmap /etc/postfix/virtual
ausgeführt werden.
Dovecot
dovecot.conf
auth_mechanisms = plain login disable_plaintext_auth = yes ssl = required ssl_cipher_list = ECDHE-RSA-AES256-GCM-SHA384:ECDH-RSA-AES256-GCM-SHA384:DHE-RSA-AES256-GCM-SHA384:DHE-DSS-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-GCM-SHA384:ECDH-ECDSA-AES256-GCM-SHA384:DHE-RSA-AES256-SHA:AES256-SHA log_timestamp = "%Y-%m-%d %H:%M:%S " ### für protocol imap / pop3 ### { mail_max_userip_connections = 99 }
TEST: telnet pass plain login credentials
Sollte LOGINDISABLED sein!
telnet mail.c3d2.de 143 Connected to mail.c3d2.de. Escape character is '^]'. * OK [CAPABILITY IMAP4rev1 LITERAL+ SASL-IR LOGIN-REFERRALS ID ENABLE IDLE STARTTLS LOGINDISABLED AUTH=GSSAPI] Dovecot ready.