Server/wetu/mail

Aus C3D2
Zur Navigation springen Zur Suche springen

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.

Mail-Adressen verwalten

Mail-Adresse hinzufügen

Wer eine Mail-Adresse %@c3d2.de haben möchte, kann sich an Admins wenden, um einen virtuellen Account anlegen zu lassen.

virtuelle user anlegen

In dem Ordner /root/wetuscripts/mail/bin (oder cgit:wetuscripts/tree/mail/bin/) liegt die Datei create_vmail_user. Wenn sie ausführt wird, hilft sie selbsterklärend dabei einen virtuellen Account 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.

Passwort zum Mail-Account ändern

Accounts mit einer Mail-Adressen können das Passwort per ssh user@mail.c3d2.de ändern.

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 auch lists.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. In mynetwork sind dann alle vom mailserver zu verwaltenden Netze einzutragen, welches momentan 127.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
  • Dabei gibt home_mailbox
    • den Namen und gleichzeitig
    • den Typ der Mailbox im Nutzerverzeichnis des Empfängers
    an.
Fingerprint / Fingerabdruck
This is an OpenPGP/MIME signed message (RFC 4880 and 3156)
--===============5200945931581301021==
Content-Type: multipart/signed; micalg=pgp-sha1;
 protocol="application/pgp-signature";
 boundary="e66LpEthTo3EP2dWprOlHhlC7qbE7Tamu"

This is an OpenPGP/MIME signed message (RFC 4880 and 3156)
--e66LpEthTo3EP2dWprOlHhlC7qbE7Tamu
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable

Hi,

das Zertifikat f=C3=BCr mail.c3d2.de (IMAP, SMTP) =C3=A4ndert sich in K=C3=
=BCrze. Der
neue Fingerprint ist
SHA1 8F:A4:CE:59:5F:F4:BB:BF:96:9E:8B:51:81:49:BC:F6:77:EF:B9:19

Der alte Fingerprint war SHA1
85:A7:8B:4D:14:B4:E1:32:94:80:F6:48:20:51:67:A9:20:A6:CD:8D

Bitte eventuell auftretende Probleme via Jabber melden:
c3d2@chat.c3d2.de oder =C3=BCber die Webseite https://www.c3d2.de/muc.htm=
l


--e66LpEthTo3EP2dWprOlHhlC7qbE7Tamu
Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: OpenPGP digital signature
Content-Disposition: attachment; filename="signature.asc"

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1

iQIcBAEBAgAGBQJVfZKoAAoJEKAKIGjIaOoNRLQQALHXE2YMcACI+CNMwt6WTWdG
/EbDV9CKgqBlZtx+pFxwxQH2GEJQTlpCi6Fq7vf/SWxHtlt5peHKEjwEJlwWA03b
IqVbbdciOSeV8xKNHADrYmbeUjqFSBzlsdt+t+ebqtqUzrFRC1KAYUReB07m436t
yFp727zy2wMKHcnKFhkfxQTd3jKt2YqzcxdlbXE8mrh8LcVRwR0uqRoOTNR44LJK
dFDeODmi5g14jUiilKrgScYdWnhaafTuY09XnrhTSFtacwpKg4trHY/ad8ZfTza0
iv+e1drqDkPro/qZ5mI9lBWOj6i4QT7HRgKyoZZ6j4zGFVmQosHyaXrFKQ5HVvBR
TRTF7mP9lbiZUpRdiKrz5mBvr1QtZqAtTnF5sCuyrrFpDX9tV0gtyFi8zzdsGWjN
X+TueCJnomAT/18CWEQ5sk2uTP4ZiBa8qgFEfVU+19HsA/2zXJuvZ4KYHeOP+4ox
Rqrfgjq/Hr5w4Afq0ATCGA9DqEyHidgxxeHLIQeaxk+fIKsicg18G/9tcGgZfn/5
cTCu0RunjQ7E26P8ZhCWlTwwkq/tillUu9dTiXJBqRtE4As+5wMUGtDKT6wWZhef
l9J+84o6hIqUL1XtR4o1SAnNIHMt4E4G47GNdN2OhqNv/dQly/Nnp1TCpQWviu4c
ldOekwbbrQwUZqnRorO6
=wgqc
-----END PGP SIGNATURE-----
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

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.