Unterschiede
Hier werden die Unterschiede zwischen zwei Versionen angezeigt.
Beide Seiten der vorigen Revision Vorhergehende Überarbeitung Nächste Überarbeitung | Vorhergehende Überarbeitung | ||
server:mailserver [2009/09/06 16:51] – st | server:mailserver [2021/09/12 16:24] (aktuell) – OpenDKIM st | ||
---|---|---|---|
Zeile 1: | Zeile 1: | ||
+ | ====== MailServer ====== | ||
+ | |||
+ | |||
+ | ===== Bestandteile der eMail-Infrastruktur ===== | ||
+ | |||
+ | {{: | ||
+ | |||
+ | * [[wpde> | ||
+ | * [[netzwerke: | ||
+ | * [[wpde> | ||
+ | * MX-Record (Mail Exchange-Record) (siehe [[netzwerke: | ||
+ | * [[wpde> | ||
+ | * [[wpde> | ||
+ | * [[netzwerke: | ||
+ | |||
+ | |||
+ | * **[[Spamfilterung]]** | ||
+ | |||
+ | ==== DNS Blacklisting ==== | ||
+ | |||
+ | [[wpde> | ||
+ | |||
+ | * [[http:// | ||
+ | * [[http:// | ||
+ | * [[http:// | ||
+ | * [[http:// | ||
+ | |||
+ | ==== Greylisting ==== | ||
+ | |||
+ | [[wpde> | ||
+ | |||
+ | |||
+ | ==== Sender Policy Framework (SPF) ==== | ||
+ | |||
+ | Das Verfahren [[wpde> | ||
+ | Dazu wird in der [[netzwerke: | ||
+ | |||
+ | * [[http:// | ||
+ | |||
+ | |||
+ | Schema: | ||
+ | < | ||
+ | | ||
+ | </ | ||
+ | - **a** "Meine Webseiten verschicken Mails, z.B. über Formmailskripte oder als Teil der installierten Programme wie Forum, Shoplösung etc." ansonsten weglassen. | ||
+ | - **include: | ||
+ | - ip4: | ||
+ | - **~all** (=nicht alle aufgelistet); | ||
+ | |||
+ | **Problematisch an SPF ist**, das SMTP bewusst keine Aussage darüber treffen wollte wer den " | ||
+ | * Weiterleitungen an einen anderen Provider | ||
+ | * Mailinglisten die in meinem Namen mails weiterleiten (und nicht den Envelope umschreiben) | ||
+ | * Artikelempfehlungen/ | ||
+ | Da zudem Spammer die ersten waren die SPF korrekt umgesetzt haben wird heute von Spamassassin ein korrekter SPF (SPF_PASS) nur noch extrem minimal positiv bewertet und ein fehlgeschlagener SPF (SPF_FAIL) zur Zeit nur mit 0,919 Punkten bestraft (siehe [[http:// | ||
+ | |||
+ | ==== DomainKeys Identified Mail (DKIM) ==== | ||
+ | |||
+ | Das [[wpde> | ||
+ | |||
+ | * [[http:// | ||
+ | |||
+ | Wie testen? | ||
+ | * [[https:// | ||
+ | * [[https:// | ||
+ | * -> Google mail zeigt in der Originalansicht des Verifikationsstatus an | ||
+ | |||
+ | ===== OpenDKIM ===== | ||
+ | |||
+ | Die folgende Anleitung funktioniert mit opendkim als milter in Postfix. | ||
+ | !!! amavisd-new könnte das auch direkt: https:// | ||
+ | |||
+ | Quelle: https:// | ||
+ | |||
+ | <code bash> | ||
+ | apt install opendkim opendkim-tools | ||
+ | |||
+ | mkdir / | ||
+ | mkdir / | ||
+ | chown -R opendkim: | ||
+ | chmod go-rw / | ||
+ | </ | ||
+ | |||
+ | |||
+ | Template ''/ | ||
+ | < | ||
+ | # stefanux opendkim config | ||
+ | # For more advanced options, see opendkim.conf(5) and/or | ||
+ | # / | ||
+ | |||
+ | # Log to syslog | ||
+ | Syslog yes | ||
+ | # debug: | ||
+ | SyslogSuccess | ||
+ | LogWhy | ||
+ | |||
+ | # Required to use local socket with MTAs that access the socket as a non- | ||
+ | # privileged user (e.g. Postfix) | ||
+ | UMask 007 | ||
+ | |||
+ | # Sign for example.com with key in / | ||
+ | # selector ' | ||
+ | # | ||
+ | # | ||
+ | # | ||
+ | |||
+ | # Commonly-used options; the commented-out versions show the defaults. | ||
+ | Canonicalization relaxed/ | ||
+ | # Mode sv | ||
+ | # only sign: | ||
+ | Mode s | ||
+ | # | ||
+ | |||
+ | # Socket smtp:// | ||
+ | # | ||
+ | # ## Socket socketspec | ||
+ | # ## | ||
+ | # ## Names the socket where this filter should listen for milter connections | ||
+ | # ## from the MTA. Required. | ||
+ | # ## | ||
+ | # ## inet: | ||
+ | # ## inet: | ||
+ | # ## local:/ | ||
+ | # | ||
+ | # | ||
+ | Socket | ||
+ | |||
+ | ## PidFile filename | ||
+ | ### default (none) | ||
+ | ### | ||
+ | ### Name of the file where the filter should write its pid before beginning | ||
+ | ### normal operations. | ||
+ | # | ||
+ | PidFile | ||
+ | |||
+ | |||
+ | # Always oversign From (sign using actual From and a null From to prevent | ||
+ | # malicious signatures header fields (From and/or others) between the signer | ||
+ | # and the verifier. | ||
+ | # because it is often the identity key used by reputation systems and thus | ||
+ | # somewhat security sensitive. | ||
+ | OversignHeaders From | ||
+ | |||
+ | ## ResolverConfiguration filename | ||
+ | ## default (none) | ||
+ | ## | ||
+ | ## Specifies a configuration file to be passed to the Unbound library that | ||
+ | ## performs DNS queries applying the DNSSEC protocol. | ||
+ | ## documentation at http:// | ||
+ | ## The results of using this and the TrustAnchorFile setting at the same | ||
+ | ## time are undefined. | ||
+ | ## In Debian, / | ||
+ | ## unbound package | ||
+ | |||
+ | # ResolverConfiguration | ||
+ | |||
+ | ## TrustAnchorFile filename | ||
+ | ## default (none) | ||
+ | ## | ||
+ | ## Specifies a file from which trust anchor data should be read when doing | ||
+ | ## DNS queries and applying the DNSSEC protocol. | ||
+ | ## at http:// | ||
+ | |||
+ | TrustAnchorFile | ||
+ | |||
+ | ## Userid userid | ||
+ | ### default (none) | ||
+ | ### | ||
+ | ### Change to user " | ||
+ | ### a group ID as well, separated from the userid by a colon. | ||
+ | # | ||
+ | UserID | ||
+ | |||
+ | # OpenDKIM bei Problemen neustarten, | ||
+ | # aber max. 10 mal pro Stunde | ||
+ | AutoRestart | ||
+ | AutoRestartRate | ||
+ | |||
+ | # interne Mails (signieren, nicht verifizieren) | ||
+ | InternalHosts | ||
+ | |||
+ | # Hosts, denen vertraut wird (vermeidet Warnungen beim Logging) | ||
+ | ExternalIgnoreList | ||
+ | |||
+ | # welche Verschlüsselungs-Keys sollen für welche | ||
+ | # Domains verwendet werden | ||
+ | # (refile: für Dateien mit regulären Ausdrücke) | ||
+ | SigningTable | ||
+ | KeyTable | ||
+ | |||
+ | # diesen Signatur-Algorithmus verwenden | ||
+ | SignatureAlgorithm | ||
+ | </ | ||
+ | |||
+ | ''/ | ||
+ | < | ||
+ | # Host without signature | ||
+ | 127.0.0.1 | ||
+ | ::1 | ||
+ | localhost | ||
+ | meinMailserver.stefanux.net | ||
+ | </ | ||
+ | |||
+ | |||
+ | ''/ | ||
+ | < | ||
+ | # Domain keyname | ||
+ | *@stefanux.net stefanux | ||
+ | </ | ||
+ | |||
+ | ''/ | ||
+ | < | ||
+ | #Name Hostname: | ||
+ | stefanux stefanux.net: | ||
+ | </ | ||
+ | |||
+ | |||
+ | '' | ||
+ | opendkim-genkey -d stefanux.net -b 2048 -r -s 20201110'' | ||
+ | |||
+ | Ergebnis: | ||
+ | -> 20201110.private | ||
+ | < | ||
+ | -----BEGIN RSA PRIVATE KEY----- | ||
+ | ... | ||
+ | -----END RSA PRIVATE KEY----- | ||
+ | </ | ||
+ | |||
+ | 20201110.txt | ||
+ | < | ||
+ | 20201110._domainkey IN TXT ( " | ||
+ | " | ||
+ | " | ||
+ | </ | ||
+ | -> für den DNS Eintrag die Anführungszeichen + Leerzeichen wegnehmen, Ergebnis: | ||
+ | |||
+ | '' | ||
+ | < | ||
+ | " | ||
+ | </ | ||
+ | |||
+ | '' | ||
+ | mv / | ||
+ | |||
+ | '' | ||
+ | chmod -R go-rwx / | ||
+ | |||
+ | '' | ||
+ | |||
+ | '' | ||
+ | |||
+ | < | ||
+ | opendkim-testkey: | ||
+ | opendkim-testkey: | ||
+ | opendkim-testkey: | ||
+ | opendkim-testkey: | ||
+ | </ | ||
+ | |||
+ | < | ||
+ | opendkim-testkey: | ||
+ | Key not secure -> kein DNSSEC | ||
+ | record not found -> defekt | ||
+ | </ | ||
+ | |||
+ | ''/ | ||
+ | < | ||
+ | # openDKIM: | ||
+ | # accept mail when milter does not work: | ||
+ | milter_default_action = accept | ||
+ | # 6 is default: | ||
+ | milter_protocol | ||
+ | smtpd_milters | ||
+ | # local generated mails: | ||
+ | non_smtpd_milters = inet: | ||
+ | </ | ||
+ | |||
+ | < | ||
+ | Nov 10 20:16:16 mx1 opendkim[9055]: | ||
+ | Nov 10 20:16:16 mx1 opendkim[9055]: | ||
+ | Nov 10 20:16:16 mx1 opendkim[9321]: | ||
+ | Nov 10 20:16:36 mx1 opendkim[9321]: | ||
+ | </ | ||
+ | |||
+ | TXT für _dmarc.stefanux.net: | ||
+ | |||
+ | < | ||
+ | Type: TXT | ||
+ | Host/Name: _DMARC.stefanux.net | ||
+ | Value: v=DMARC1; p=none; rua=mailto: | ||
+ | </ | ||
+ | |||
+ | < | ||
+ | rua -> DMARC reports | ||
+ | ruf -> forensic DMARC failure reports | ||
+ | </ | ||
+ | |||
+ | [[https:// | ||
+ | ==== DMARC ==== | ||
+ | |||
+ | Das Domain-based Message Authentication, | ||
+ | DMARC legt zusätzlich fest auf welche Art der Empfänger mit einer Mail umgeht, die in einem oder beiden Fällen nicht den Anforderungen entspricht. | ||
+ | Es ist also erstmals ein Benachrichtigung (wieviel Spam unterwegs ist) und leichtere Auswertung auf Providerebene möglich. | ||
+ | |||
+ | [[http:// | ||
+ | |||
+ | < | ||
+ | < | ||
+ | |||
+ | |||
+ | |||
+ | ===== Felder einer eMail ===== | ||
+ | |||
+ | * Felder im Header einer eMAIL: | ||
+ | * To: Der Empfänger der eMail | ||
+ | * CC: grundsätzlich wie " | ||
+ | * BCC: Empfänger in diesem Feld sind für andere Empfänger nicht sichtbar. | ||
+ | * Subject: Betreff einer eMail | ||
+ | * X-... hinzugefügte Informationsfelder von Virenscanner, | ||
+ | |||
+ | |||
+ | Webserver richtigen Standardabsender angeben lassen ('' | ||
+ | < | ||
+ | php_admin_value sendmail_from user@domain.de | ||
+ | php_admin_value sendmail_path " | ||
+ | </ | ||
+ | ===== MailServer (Opensource) ===== | ||
+ | |||
+ | Unter [[linux: | ||
+ | * **cyrus** mail server: | ||
+ | * [[Courier]] Mail Server | ||
+ | * **[[server: | ||
+ | * Perdition: POP3 and IMAP4 Proxy server | ||
+ | * [[http:// | ||
+ | |||
+ | Unter [[windows: | ||
+ | * [[http:// | ||
+ | |||
+ | |||
+ | |||
+ | ==== Links und Anleitungen ==== | ||
+ | * [[http:// | ||
+ | * [[http:// | ||
+ | * [[http:// | ||
+ | * [[http:// | ||
+ | |||
+ | |||
+ | |||
+ | ==== kommerzielle ==== | ||
+ | [[http:// | ||
+ | |||
+ | |||
+ | |||
+ | ===== Mail Transfer Agents (MTAs) ===== | ||
+ | |||
+ | * [[Postfix]] - flexibel, schnell, erweiterbar | ||
+ | * [[exim]] | ||
+ | * sendmail (veraltet) | ||
+ | * [[wpde> | ||
+ | |||
+ | |||
+ | [[http:// | ||
+ | |||
+ | |||
+ | ===== Links ===== | ||
+ | * [[http:// | ||
+ | |||
+ | |||
+ | TIP: swaks: SMTP command-line test tool | ||
+ | |||
+ | ===== Push-mail ===== | ||
+ | Push-mail wird, im Gegensatz zum periodischen Abholen (pull) der eMail, direkt nach dem eintreffen auf mobile Geräte gesendet. | ||
+ | Es sind offene Lösungen (IMAP-IDLE) propritären Lösungen (wie Blackberry) vorzuziehen. | ||
+ | |||
+ | FIXME | ||
+ | ==== Anbieter ==== | ||
+ | |||
+ | * [[http:// | ||
+ | |||
+ | ===== Konfiguration ===== | ||
+ | |||
+ | ==== Checkliste ==== | ||
+ | |||
+ | |||
+ | |||
+ | * IP Addressen der MTAs/ | ||
+ | * nicht dynamisch sein (die werden von großen Providern blockiert und hat Kommunikationsprobleme) | ||
+ | * identische vorwärts- und Rückwärts-DNS-Auflösung haben | ||
+ | * nicht auf einer Blacklist sein | ||
+ | * der MTA/ | ||
+ | * kein offenes Relay sein (mail nur von authentizierten Benutzern annehmen bzw. nur für die eigenen Domains annehmen) | ||
+ | * korrekte (!) SPF/ | ||
+ | |||
+ | |||
+ | ==== Aliase ==== | ||
+ | Aliase für Nutzer trägt man in der Datei / | ||
+ | |||
+ | Das Format ist '' | ||
+ | < | ||
+ | benutzer: " | ||
+ | </ | ||
+ | Das Beispiel ist von [[software: | ||
+ | |||
+ | |||
+ | |||