Unterschiede
Hier werden die Unterschiede zwischen zwei Versionen angezeigt.
Beide Seiten der vorigen Revision Vorhergehende Überarbeitung Nächste Überarbeitung | Vorhergehende Überarbeitung | ||
centos:mail_c7:spam_12 [17.12.2014 20:54. ] – [Installation] django | centos:mail_c7:spam_12 [18.11.2024 19:13. ] (aktuell) – Externe Bearbeitung 127.0.0.1 | ||
---|---|---|---|
Zeile 1: | Zeile 1: | ||
- | <WRAP center round info 60%> | + | <WRAP center round info 60%> |
Artikel befindet sich gerade in der Bearbeitung! | Artikel befindet sich gerade in der Bearbeitung! | ||
</ | </ | ||
Zeile 21: | Zeile 21: | ||
Das nachfolgende Schaubild zeigt den Bearbeitungsverlauf einer eMail mit Berücksichtigung auf DMARC auf. | Das nachfolgende Schaubild zeigt den Bearbeitungsverlauf einer eMail mit Berücksichtigung auf DMARC auf. | ||
- | < | + | <uml> |
skinparam defaultFontName Courier | skinparam defaultFontName Courier | ||
state " | state " | ||
Zeile 54: | Zeile 54: | ||
smtpd_b : Bewertung der eMail | smtpd_b : Bewertung der eMail | ||
smtpd_b : mit Hilfe von Blacklists | smtpd_b : mit Hilfe von Blacklists | ||
- | smtpd_b : und greylisting | + | smtpd_b : und postscreen |
state "SPAM- und Virenüberprüfung" | state "SPAM- und Virenüberprüfung" | ||
Zeile 174: | Zeile 174: | ||
regelmäßiger forensischer | regelmäßiger forensischer | ||
Bericht an den im DMARC-Record | Bericht an den im DMARC-Record | ||
- | hinterlegten "ruaf=mailto" | + | hinterlegten "rua=mailto" |
Adresse des Mailserver- | Adresse des Mailserver- | ||
betreibers des Absender- | betreibers des Absender- | ||
Zeile 289: | Zeile 289: | ||
===== Installation ===== | ===== Installation ===== | ||
- | Die einfachste und schnellste Variante bei der Installation ist die aus dem Repository **[[centos:mailserver.guru|mailserver.guru]]**. Hier reicht ein einfacher Aufruf von **yum** und alles wird automatisch installiert inkl. der Paketabhängigkeiten. | + | Die einfachste und schnellste Variante bei der Installation ist die aus dem Repository **[[centos:nausch.org|nausch.org]]**. Hier reicht ein einfacher Aufruf von **yum** und alles wird automatisch installiert inkl. der Paketabhängigkeiten. |
# yum install opendmarc | # yum install opendmarc | ||
- | Will oder kann man nicht auf das Repository **[[centos:mailserver.guru|mailserver.guru]]** zurückgreifen, | + | Will oder kann man nicht auf das Repository **[[centos:nausch.org|nausch.org]]** zurückgreifen, |
- | # yum localinstall http:// | + | # yum localinstall http:// |
- | http:// | + | http:// |
Was das RPM alle mitbrachte zeigt ein Blick in die RPM-Datenbank. | Was das RPM alle mitbrachte zeigt ein Blick in die RPM-Datenbank. | ||
Zeile 1414: | Zeile 1414: | ||
</ | </ | ||
+ | ===== Konfiguration ===== | ||
+ | ==== opendmarc ==== | ||
+ | === opendmarc.conf === | ||
+ | Die Konfiguration von OpenDMARC erfolgt über die Konfigurationsdatei **opendmarc.conf** im Verzeichnis // | ||
+ | # vim / | ||
+ | |||
+ | <file bash / | ||
+ | ## opendmarc.conf -- configuration file for OpenDMARC filter | ||
+ | ## | ||
+ | ## Copyright (c) 2012-2014, The Trusted Domain Project. | ||
+ | ## | ||
+ | |||
+ | ## AuthservID (string) | ||
+ | ## defaults to MTA name | ||
+ | ## | ||
+ | ## Sets the " | ||
+ | ## header field after verifying a message. | ||
+ | ## provided, the name of the host running the filter (as returned by the | ||
+ | ## gethostname(3) function) will be used. | ||
+ | # | ||
+ | # AuthservID name | ||
+ | # Django : 2014-12-17 | ||
+ | AuthservID mx01.nausch.org | ||
+ | |||
+ | ## AuthservIDWithJobID { true | false } | ||
+ | ## default " | ||
+ | ## | ||
+ | ## If " | ||
+ | ## Authentication-Results header fields contain the job ID of the message | ||
+ | ## being evaluated. | ||
+ | # | ||
+ | # AuthservIDWithJobID false | ||
+ | # Django : 2014-02-17 | ||
+ | AuthservIDWithJobID true | ||
+ | |||
+ | ## AutoRestart { true | false } | ||
+ | ## default " | ||
+ | ## | ||
+ | ## Automatically re-start on failures. Use with caution; if the filter fails | ||
+ | ## instantly after it starts, this can cause a tight fork(2) loop. | ||
+ | # | ||
+ | # AutoRestart false | ||
+ | |||
+ | ## AutoRestartCount n | ||
+ | ## default 0 | ||
+ | ## | ||
+ | ## Sets the maximum automatic restart count. | ||
+ | ## restarts, the filter will give up and terminate. | ||
+ | ## limit. | ||
+ | # | ||
+ | # AutoRestartCount 0 | ||
+ | |||
+ | ## AutoRestartRate n/t[u] | ||
+ | ## default (no limit) | ||
+ | ## | ||
+ | ## Sets the maximum automatic restart rate. If the filter begins restarting | ||
+ | ## faster than the rate defined here, it will give up and terminate. | ||
+ | ## is a string of the form n/t[u] where n is an integer limiting the count | ||
+ | ## of restarts in the given interval and t[u] defines the time interval | ||
+ | ## through which the rate is calculated; t is an integer and u defines the | ||
+ | ## units thus represented (" | ||
+ | ## for minutes; " | ||
+ | ## value of " | ||
+ | ## default, meaning restart rate is not limited. | ||
+ | # | ||
+ | # AutoRestartRate n/t[u] | ||
+ | |||
+ | ## Background { true | false } | ||
+ | ## default " | ||
+ | ## | ||
+ | ## Causes opendmarc to fork and exits immediately, | ||
+ | ## running in the background. | ||
+ | # | ||
+ | # Background true | ||
+ | |||
+ | ## BaseDirectory (string) | ||
+ | ## default (none) | ||
+ | ## | ||
+ | ## If set, instructs the filter to change to the specified directory using | ||
+ | ## chdir(2) before doing anything else. This means any files referenced | ||
+ | ## elsewhere in the configuration file can be specified relative to this | ||
+ | ## directory. | ||
+ | ## saved to a specific location. | ||
+ | # | ||
+ | # BaseDirectory / | ||
+ | |||
+ | ## ChangeRootDirectory (string) | ||
+ | ## default (none) | ||
+ | ## | ||
+ | ## Requests that the operating system change the effective root directory of | ||
+ | ## the process to the one specified here prior to beginning execution. | ||
+ | ## chroot(2) requires superuser access. | ||
+ | ## UserID is not also set. | ||
+ | # | ||
+ | # ChangeRootDirectory / | ||
+ | |||
+ | ## CopyFailuresTo (string) | ||
+ | ## default (none) | ||
+ | ## | ||
+ | ## Requests addition of the specified email address to the envelope of | ||
+ | ## any message that fails the DMARC evaluation. | ||
+ | # | ||
+ | # CopyFailuresTo postmaster@localhost | ||
+ | |||
+ | ## DNSTimeout (integer) | ||
+ | ## default 5 | ||
+ | ## | ||
+ | ## Sets the DNS timeout in seconds. | ||
+ | ## (NOT YET IMPLEMENTED) | ||
+ | # | ||
+ | # DNSTimeout 5 | ||
+ | |||
+ | ## EnableCoredumps { true | false } | ||
+ | ## default " | ||
+ | ## | ||
+ | ## On systems that have such support, make an explicit request to the kernel | ||
+ | ## to dump cores when the filter crashes for some reason. | ||
+ | ## systems suppress core dumps during crashes for security reasons if the | ||
+ | ## user ID has changed during the lifetime of the process. | ||
+ | ## supported on Linux. | ||
+ | # | ||
+ | # EnableCoreDumps false | ||
+ | |||
+ | ## FailureReports { true | false } | ||
+ | ## default " | ||
+ | ## | ||
+ | ## Enables generation of failure reports when the DMARC test fails and the | ||
+ | ## purported sender of the message has requested such reports. | ||
+ | ## formatted per RFC6591. | ||
+ | # | ||
+ | # FailureReports false | ||
+ | # Django : 2014-12-17 | ||
+ | FailureReports true | ||
+ | |||
+ | ## FailureReportsBcc (string) | ||
+ | ## default (none) | ||
+ | ## | ||
+ | ## When failure reports are enabled and one is to be generated, always | ||
+ | ## send one to the address(es) specified here. If a failure report is | ||
+ | ## requested by the domain owner, the address(es) are added in a Bcc: field. | ||
+ | ## If no request is made, they address(es) are used in a To: field. | ||
+ | ## is no default. | ||
+ | # | ||
+ | # FailureReportsBcc postmaster@example.coom | ||
+ | |||
+ | ## FailureReportsOnNone { true | false } | ||
+ | ## default " | ||
+ | ## | ||
+ | ## Supplements the " | ||
+ | ## domains that advertise " | ||
+ | ## generated (when enabled) for sending domains advertising a " | ||
+ | ## or " | ||
+ | # | ||
+ | # FailureReportsOnNone false | ||
+ | |||
+ | ## FailureReportsSentBy string | ||
+ | ## default " | ||
+ | ## | ||
+ | ## Specifies the email address to use in the From: field of failure | ||
+ | ## reports generated by the filter. | ||
+ | ## the user running the filter and the local hostname to construct an | ||
+ | ## email address. | ||
+ | ## could not be determined. | ||
+ | # | ||
+ | # FailureReportsSentBy USER@HOSTNAME | ||
+ | # Django : 2014-12-17 | ||
+ | FailureReportsSentBy dmarc-admin@nausch.org | ||
+ | |||
+ | ## HistoryFile path | ||
+ | ## default (none) | ||
+ | ## | ||
+ | ## If set, specifies the location of a text file to which records are written | ||
+ | ## that can be used to generate DMARC aggregate reports. | ||
+ | ## of rows containing information about a single received message, and | ||
+ | ## include all relevant information needed to generate a DMARC aggregate | ||
+ | ## report. | ||
+ | ## rather periodically imported into a relational database from which the | ||
+ | ## aggregate reports can be extracted by a tool such as opendmarc-import(8). | ||
+ | # | ||
+ | HistoryFile / | ||
+ | |||
+ | ## IgnoreAuthenticatedClients { true | false } | ||
+ | ## default " | ||
+ | ## | ||
+ | ## If set, causes mail from authenticated clients (i.e., those that used | ||
+ | ## SMTP AUTH) to be ignored by the filter. | ||
+ | # | ||
+ | # IgnoreAuthenticatedClients false | ||
+ | |||
+ | ## IgnoreHosts path | ||
+ | ## default (internal) | ||
+ | ## | ||
+ | ## Specifies the path to a file that contains a list of hostnames, IP | ||
+ | ## addresses, and/or CIDR expressions identifying hosts whose SMTP | ||
+ | ## connections are to be ignored by the filter. | ||
+ | ## to " | ||
+ | # | ||
+ | # IgnoreHosts / | ||
+ | # Django : 2014-12-17 | ||
+ | IgnoreHosts / | ||
+ | |||
+ | ## IgnoreMailFrom domain[, | ||
+ | ## default (none) | ||
+ | ## | ||
+ | ## Gives a list of domain names whose mail (based on the From: domain) is to | ||
+ | ## be ignored by the filter. | ||
+ | ## against this list is case-insensitive. | ||
+ | ## meaning no mail is ignored. | ||
+ | # | ||
+ | # IgnoreMailFrom example.com | ||
+ | |||
+ | ## MilterDebug (integer) | ||
+ | ## default 0 | ||
+ | ## | ||
+ | ## Sets the debug level to be requested from the milter library. | ||
+ | # | ||
+ | # MilterDebug 0 | ||
+ | # Django : 2014-12-17 | ||
+ | MilterDebug 5 | ||
+ | |||
+ | ## PidFile path | ||
+ | ## default (none) | ||
+ | ## | ||
+ | ## Specifies the path to a file that should be created at process start | ||
+ | ## containing the process ID. | ||
+ | ## | ||
+ | # | ||
+ | # PidFile / | ||
+ | |||
+ | ## PublicSuffixList path | ||
+ | ## default (none) | ||
+ | ## | ||
+ | ## Specifies the path to a file that contains top-level domains (TLDs) that | ||
+ | ## will be used to compute the Organizational Domain for a given domain name, | ||
+ | ## as described in the DMARC specification. | ||
+ | ## not be able to determine the Organizational Domain and only the presented | ||
+ | ## domain will be evaluated. | ||
+ | # | ||
+ | # PublicSuffixList path | ||
+ | |||
+ | ## RecordAllMessages { true | false } | ||
+ | ## default " | ||
+ | ## | ||
+ | ## If set and " | ||
+ | ## to the history file. If not set (the default), only messages for which | ||
+ | ## the From: domain published a DMARC record will be recorded in the | ||
+ | ## history file. | ||
+ | # | ||
+ | # RecordAllMessages false | ||
+ | |||
+ | ## RejectFailures { true | false } | ||
+ | ## default " | ||
+ | ## | ||
+ | ## If set, messages will be rejected if they fail the DMARC evaluation, or | ||
+ | ## temp-failed if evaluation could not be completed. | ||
+ | ## will be rejected or temp-failed regardless of the outcome of the DMARC | ||
+ | ## evaluation of the message. | ||
+ | ## field will be added. | ||
+ | # | ||
+ | # RejectFailures false | ||
+ | |||
+ | ## ReportCommand string | ||
+ | ## default "/ | ||
+ | ## | ||
+ | ## Indicates the shell command to which failure reports should be passed for | ||
+ | ## delivery when " | ||
+ | # | ||
+ | # ReportCommand / | ||
+ | |||
+ | ## RequiredHeaders { true | false } | ||
+ | ## default " | ||
+ | ## | ||
+ | ## If set, the filter will ensure the header of the message conforms to the | ||
+ | ## basic header field count restrictions laid out in RFC5322, Section 3.6. | ||
+ | ## Messages failing this test are rejected without further processing. | ||
+ | ## From: field from which no domain name could be extracted will also be | ||
+ | ## rejected. | ||
+ | # | ||
+ | # RequiredHeaders false | ||
+ | |||
+ | ## Socket socketspec | ||
+ | ## default (none) | ||
+ | ## | ||
+ | ## Specifies the socket that should be established by the filter to receive | ||
+ | ## connections from sendmail(8) in order to provide service. | ||
+ | ## in one of two forms: local:path, which creates a UNIX domain socket at | ||
+ | ## the specified path, or inet: | ||
+ | ## a TCP socket on the specified port for the appropriate protocol family. | ||
+ | ## If the host is not given as either a hostname or an IP address, the | ||
+ | ## socket will be listening on all interfaces. | ||
+ | ## either in the configuration file or on the command line. If an IP | ||
+ | ## address is used, it must be enclosed in square brackets. | ||
+ | # | ||
+ | # Socket inet: | ||
+ | # Django : 2014-12-17 | ||
+ | Socket inet: | ||
+ | |||
+ | ## SoftwareHeader { true | false } | ||
+ | ## default " | ||
+ | ## | ||
+ | ## Causes the filter to add a " | ||
+ | ## presence of this filter in the path of the message from injection to | ||
+ | ## delivery. | ||
+ | ## the header field' | ||
+ | # | ||
+ | # SoftwareHeader false | ||
+ | # Django : 2014-12-17 | ||
+ | SoftwareHeader true | ||
+ | |||
+ | ## SPFIgnoreResults { true | false } | ||
+ | ## default " | ||
+ | ## | ||
+ | ## Causes the filter to ignore any SPF results in the header of the | ||
+ | ## message. | ||
+ | ## itself, or because you don't trust the arriving header. | ||
+ | # | ||
+ | # SPFIgnoreResults false | ||
+ | |||
+ | ## SPFSelfValidate { true | false } | ||
+ | ## default false | ||
+ | ## | ||
+ | ## Enable internal spf checking with --with-spf | ||
+ | ## To use libspf2 instead: | ||
+ | ## | ||
+ | ## Causes the filter to perform a fallback SPF check itself when | ||
+ | ## it can find no SPF results in the message header. | ||
+ | ## is also set, it never looks for SPF results in headers and | ||
+ | ## always performs the SPF check itself when this is set. | ||
+ | # | ||
+ | # SPFSelfValidate false | ||
+ | |||
+ | ## Syslog { true | false } | ||
+ | ## default " | ||
+ | ## | ||
+ | ## Log via calls to syslog(3) any interesting activity. | ||
+ | # | ||
+ | # Syslog false | ||
+ | # Django : 2014-12-17 | ||
+ | Syslog true | ||
+ | |||
+ | ## SyslogFacility facility-name | ||
+ | ## default " | ||
+ | ## | ||
+ | ## Log via calls to syslog(3) using the named facility. | ||
+ | ## are the same as the ones allowed in syslog.conf(5). | ||
+ | # | ||
+ | # SyslogFacility mail | ||
+ | |||
+ | ## TemporaryDirectory path | ||
+ | ## default /var/tmp | ||
+ | ## | ||
+ | ## Specifies the directory in which temporary files should be written. | ||
+ | # | ||
+ | # TemporaryDirectory /var/tmp | ||
+ | |||
+ | ## TrustedAuthservIDs string | ||
+ | ## default HOSTNAME | ||
+ | ## | ||
+ | ## Specifies one or more " | ||
+ | ## upstream DKIM and SPF results. | ||
+ | ## the MTA processing the message. | ||
+ | ## with a comma. | ||
+ | ## the host running the filter as reported by the gethostname(3) function. | ||
+ | # | ||
+ | # TrustedAuthservIDs HOSTNAME | ||
+ | |||
+ | |||
+ | ## UMask mask | ||
+ | ## default (none) | ||
+ | ## | ||
+ | ## Requests a specific permissions mask to be used for file creation. | ||
+ | ## only really applies to creation of the socket when Socket specifies a | ||
+ | ## UNIX domain socket, and to the HistoryFile and PidFile (if any); temporary | ||
+ | ## files are normally created by the mkstemp(3) function that enforces a | ||
+ | ## specific file mode on creation regardless of the process umask. | ||
+ | ## umask(2) for more information. | ||
+ | # | ||
+ | # UMask 077 | ||
+ | # Django : 2014-12-17 | ||
+ | UMask 007 | ||
+ | |||
+ | ## UserID user[: | ||
+ | ## default (none) | ||
+ | ## | ||
+ | ## Attempts to become the specified userid before starting operations. | ||
+ | ## The process will be assigned all of the groups and primary group ID of | ||
+ | ## the named userid unless an alternate group is specified. | ||
+ | # | ||
+ | # UserID opendmarc | ||
+ | # Django : 2014-12-17 | ||
+ | #UserID opendmarc: | ||
+ | </ | ||
+ | |||
+ | === ignore.hosts ==== | ||
+ | # vim / | ||
+ | <file bash / | ||
+ | # CIDR expressions identifying hosts whose SMTP connections are to be | ||
+ | # ignored by the filter. | ||
+ | # to " | ||
+ | 127.0.0.1 | ||
+ | </ | ||
+ | |||
+ | === Public Suffix List ==== | ||
+ | Im [[https:// | ||
+ | |||
+ | Zuvor holen wir uns aber erst einmal diese Liste von der Webseite **[[https:// | ||
+ | # wget --no-check-certificate -q -N https:// | ||
+ | |||
+ | In unregelmäßigen Abständen, meist mehrmals pro Monat, wird diese Liste aktualisiert. Damit wir nun nicht händisch für die Aktualität dieser Liste sorgen müssen, legen wir uns einen kleinen cronjob an, der 1x pro Woche ausgeführt werden soll. | ||
+ | # vim / | ||
+ | |||
+ | <file bash / | ||
+ | # Script zum Aktualisieren der Public Suffix List für opendmarc | ||
+ | # Django < | ||
+ | # | ||
+ | / | ||
+ | |||
+ | Was nun noch fehlt, ist die Aktivierung dieser Option in der Konfigurationsdatei von **opendmarc**. | ||
+ | # vim / | ||
+ | <code bash / | ||
+ | |||
+ | ## PublicSuffixList path | ||
+ | ## default (none) | ||
+ | ## | ||
+ | ## Specifies the path to a file that contains top-level domains (TLDs) that | ||
+ | ## will be used to compute the Organizational Domain for a given domain name, | ||
+ | ## as described in the DMARC specification. | ||
+ | ## not be able to determine the Organizational Domain and only the presented | ||
+ | ## domain will be evaluated. | ||
+ | # | ||
+ | # Django : 2015-12-10 | ||
+ | # default: unset | ||
+ | PublicSuffixList / | ||
+ | |||
+ | ... | ||
+ | </ | ||
+ | |||
+ | Zum Aktivieren der **Public Suffix List** brauchen wir dann nur noch den Daemon 1x durchstarten. | ||
+ | # systemctl restart opendmarc.service | ||
+ | |||
+ | ==== mysql Konfiguration ==== | ||
+ | Eigentlich könnten wir nun schon unseren DMARC-Daemon starten. Jedoch wollen wir noch kurz die nötige mySQL-Datenbank anlegen, damit der Daemon die gewünschten aufbereiteten Statiskdaten und forensischen Berichte generieren und dann per eMail verschicken kann. | ||
+ | |||
+ | Wir melden uns also als berechtigter Datenbankuser an der mySQL-Datenbank an. | ||
+ | # mysql -h localhost -u root -p | ||
+ | |||
+ | < | ||
+ | Welcome to the MySQL monitor. | ||
+ | Your MySQL connection id is 1942 | ||
+ | Server version: 5.1.67 Source distribution | ||
+ | |||
+ | Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved. | ||
+ | |||
+ | Oracle is a registered trademark of Oracle Corporation and/or its | ||
+ | affiliates. Other names may be trademarks of their respective | ||
+ | owners. | ||
+ | |||
+ | Type ' | ||
+ | |||
+ | mysql> | ||
+ | </ | ||
+ | Dort legen wir als aller erst einmal eine Datenbank mit dem Namen **opendmarc** an. | ||
+ | | ||
+ | |||
+ | Anschließend legen wir uns dann einen Datenbankuser an, dem wir entsprechende Rechte an der Datenbank **opendmarc** einräumen. | ||
+ | | ||
+ | |||
+ | Query OK, 0 rows affected (0.00 sec) | ||
+ | |||
+ | | ||
+ | |||
+ | Query OK, 0 rows affected (0.00 sec) | ||
+ | |||
+ | Anschließend setzen wir noch die Nutzerberechtigungen unseres Datenbanknutzers **opendmarc_user** für die Datenbank **opendmarc** | ||
+ | | ||
+ | |||
+ | Query OK, 0 rows affected (0.00 sec) | ||
+ | |||
+ | mysql> GRANT ALL PRIVILEGES ON opendmarc.* TO ' | ||
+ | |||
+ | Query OK, 0 rows affected (0.00 sec) | ||
+ | |||
+ | Zur Aktivierung weisen wir nun noch die Berechtigungen zu: | ||
+ | mysql> FLUSH PRIVILEGES; | ||
+ | |||
+ | Query OK, 0 rows affected (0.00 sec) | ||
+ | |||
+ | Abschließend melden wir uns wieder von unserem Datenbankhost ab. | ||
+ | mysql> quit | ||
+ | |||
+ | Bye | ||
+ | |||
+ | Bevor wir die benötigten Tabellen anlegen, testen wir noch, ob der Zugriff von unserem Mail- bzw. Datenimportserver funktioniert. | ||
+ | # mysql -h mysql.dmz.nausch.org -D opendmarc -u opendmarc_user -p | ||
+ | |||
+ | < | ||
+ | Welcome to the MySQL monitor. | ||
+ | Your MySQL connection id is 2889 | ||
+ | Server version: 5.1.73 Source distribution | ||
+ | |||
+ | Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. | ||
+ | |||
+ | Oracle is a registered trademark of Oracle Corporation and/or its | ||
+ | affiliates. Other names may be trademarks of their respective | ||
+ | owners. | ||
+ | |||
+ | Type ' | ||
+ | |||
+ | mysql> | ||
+ | </ | ||
+ | | ||
+ | < | ||
+ | | Database | ||
+ | +--------------------+ | ||
+ | | information_schema | | ||
+ | | opendmarc | ||
+ | +--------------------+ | ||
+ | 2 rows in set (0.00 sec) | ||
+ | </ | ||
+ | | ||
+ | |||
+ | Bye | ||
+ | |||
+ | Mit Hilfe der Datei // | ||
+ | # mysql -h mysql.dmz.nausch.org -D opendmarc -u opendmarc_user -p < / | ||
+ | |||
+ | Auch hier können wir uns bei Bedarf noch überprüfen, | ||
+ | # mysql -h mysql.dmz.nausch.org -D opendmarc -u opendmarc_user -p | ||
+ | |||
+ | < | ||
+ | Reading table information for completion of table and column names | ||
+ | You can turn off this feature to get a quicker startup with -A | ||
+ | |||
+ | Welcome to the MySQL monitor. | ||
+ | Your MySQL connection id is 2933 | ||
+ | Server version: 5.1.73 Source distribution | ||
+ | |||
+ | Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. | ||
+ | |||
+ | Oracle is a registered trademark of Oracle Corporation and/or its | ||
+ | affiliates. Other names may be trademarks of their respective | ||
+ | owners. | ||
+ | |||
+ | Type ' | ||
+ | |||
+ | mysql> | ||
+ | </ | ||
+ | | ||
+ | |||
+ | < | ||
+ | | Database | ||
+ | +--------------------+ | ||
+ | | information_schema | | ||
+ | | opendmarc | ||
+ | +--------------------+ | ||
+ | 2 rows in set (0.00 sec) | ||
+ | |||
+ | mysql> | ||
+ | </ | ||
+ | | ||
+ | |||
+ | Database changed | ||
+ | mysql> | ||
+ | |||
+ | | ||
+ | < | ||
+ | | Tables_in_opendmarc | | ||
+ | +---------------------+ | ||
+ | | domains | ||
+ | | ipaddr | ||
+ | | messages | ||
+ | | reporters | ||
+ | | requests | ||
+ | | signatures | ||
+ | +---------------------+ | ||
+ | 6 rows in set (0.00 sec) | ||
+ | |||
+ | mysql> | ||
+ | </ | ||
+ | | ||
+ | |||
+ | Bye | ||
+ | |||
+ | |||
+ | ==== dbCollecting User einrichten ==== | ||
+ | Nicht immer möchte oder kann man von seinem oder seinen Mailservern eine Verbindung zum Datenbankhost ermöglichen. Um jetzt nicht von jedem einzelnen MX-Server einzurichten, | ||
+ | |||
+ | Wir legen uns nun unseren Nutzer an. Als UID und GID verwenden wir eine entsprechend freie Nummer, die wir entsprechend vorher abprüfen. | ||
+ | # grep 989 /etc/group | ||
+ | |||
+ | # grep 989 /etc/passwd | ||
+ | |||
+ | Anschließend legen wir uns unseren User an. | ||
+ | # groupadd -g 989 dmarc && useradd dmarc -c " | ||
+ | |||
+ | Anschließend erzeugen wir uns noch einen entsprechenden SSH-Key und verteilen diesen auf unseren Mailservern. Entsprechende Schritte sind im Wiki [[https:// | ||
+ | |||
+ | ==== dbCollecting Script anlegen ==== | ||
+ | Zum Einsammeln der Statistikdaten legen wir uns nun ein einfaches Shellscript an. | ||
+ | # vim / | ||
+ | <file bash / | ||
+ | # Script zum Importieren der DMARC-Daten aus dem lokalen cache-Datei in die mySQL Datenbank | ||
+ | # und Generieren der DMARC-reports | ||
+ | # Das Script wird um 03:33 Uhr via cronjob aufgerufen. | ||
+ | # | ||
+ | # crontab | ||
+ | # einmal in der Nacht die DMARC-Statistikdaten abholen und die mySQL-Datenbank damit befüllen. | ||
+ | # 33 3 * * * / | ||
+ | # | ||
+ | # Django : 2014-03-20 | ||
+ | |||
+ | WORKDIR="/ | ||
+ | WORKFILE=" | ||
+ | SSHKEYFILE=" | ||
+ | MXHOSTS=" | ||
+ | DBFILE=" | ||
+ | DBHOST=" | ||
+ | DBPORT=" | ||
+ | DBUSER=" | ||
+ | DBPASSWD=" | ||
+ | DBNAME=" | ||
+ | |||
+ | # DMARC Datenfile von den Mailservern abholen | ||
+ | cd $WORKDIR | ||
+ | for HOST in $MXHOSTS; do | ||
+ | scp -i $WORKDIR$SSHKEYFILE dmarc@${HOST}:/ | ||
+ | ssh -i $WORKDIR$SSHKEYFILE dmarc@${HOST} "/ | ||
+ | cat ${HOST}.dat >> $WORKFILE | ||
+ | done | ||
+ | |||
+ | # DMARC Daten in die mySQL-Datenbank opendmarc schreiben | ||
+ | / | ||
+ | --dbpasswd=$DBPASSWD < $WORKDIR$WORKFILE | ||
+ | |||
+ | # DMARC Statistik-Report erstellen | ||
+ | / | ||
+ | --dbpasswd=$DBPASSWD --verbose --interval=86400 --report-email ' | ||
+ | |||
+ | # DMARC Datenbank aufräumen, Datensätze die älter als 90 Tage sind werden gelöscht | ||
+ | / | ||
+ | --dbpasswd=$DBPASSWD --verbose --expire=90 | ||
+ | |||
+ | # Work-Verzeichnis wieder aufräumen | ||
+ | cd $WORKDIR | ||
+ | rm $WORKDIR*.dat -rf | ||
+ | </ | ||
+ | Anschließen setzen wir die Ausführungsrechte unseres neuen Scriptes. | ||
+ | # chmod +x / | ||
+ | |||
+ | Zu guter Letzt aktivieren wir dann noch einen Cronjob für die tägliche Ausführung. | ||
+ | # crontab -e | ||
+ | <code bash>... | ||
+ | |||
+ | # Django : 2014-03-20 | ||
+ | # einmal in der Nacht die DMARC-Statistikdaten abholen und die mySQL-Datenbank damit befüllen. | ||
+ | 33 3 * * * / | ||
+ | |||
+ | ... | ||
+ | </ | ||
+ | |||
+ | ==== Postfix ==== | ||
+ | In der Konfigurationsdatei **main.cf** unseres Postfix-Mailserver definieren wir uns nun eine eigene Variable, die wir dann in der Datei // | ||
+ | # vim / | ||
+ | <file bash / | ||
+ | |||
+ | ################################################################################ | ||
+ | ## MILTER | ||
+ | # Django : 2014-11-18 | ||
+ | # DMARC Test | ||
+ | spf_milter | ||
+ | opendkim_milter | ||
+ | opendmarc_milter = inet: | ||
+ | amavisd_milter | ||
+ | ... | ||
+ | </ | ||
+ | |||
+ | In der Konfigurationsdatei // | ||
+ | # vim / | ||
+ | |||
+ | < | ||
+ | |||
+ | smtp inet n | ||
+ | smtpd | ||
+ | -o smtpd_milters=${spf_milter}, | ||
+ | -o smtpd_sasl_auth_enable=no | ||
+ | dnsblog | ||
+ | tlsproxy | ||
+ | </ | ||
+ | |||
+ | ===== Programmstart ===== | ||
+ | Das Starten des Daemon erfolgt über folgenden Aufruf. | ||
+ | # systemctl start opendmarc | ||
+ | |||
+ | Den erfolgreichen Start bzw. den Status des **smf-spf**-Daemon können wir bei Bedarf mit folgendem Aufruf abfragen. | ||
+ | # systemctl status opendmarc | ||
+ | |||
+ | < | ||
+ | | ||
+ | | ||
+ | Main PID: 2370 (opendmarc) | ||
+ | | ||
+ | | ||
+ | |||
+ | Dec 17 20:58:56 vml000087.dmz.nausch.org systemd[1]: Starting opendmarc - DMARC email policy filter for MTAs.... | ||
+ | Dec 17 20:58:56 vml000087.dmz.nausch.org systemd[1]: Started opendmarc - DMARC email policy filter for MTAs.. | ||
+ | Dec 17 20:58:56 vml000087.dmz.nausch.org opendmarc[2370]: | ||
+ | Dec 17 20:58:56 vml000087.dmz.nausch.org opendmarc[2370]: | ||
+ | Dec 17 20:58:56 vml000087.dmz.nausch.org opendmarc[2370]: | ||
+ | </ | ||
+ | |||
+ | |||
+ | Im Maillog wird der Start des Daemon entsprechend dokumentiert. | ||
+ | # less / | ||
+ | |||
+ | Dec 17 22:45:08 vml000087 opendmarc[2912]: | ||
+ | Dec 17 22:45:08 vml000087 opendmarc[2912]: | ||
+ | Dec 17 22:45:08 vml000087 opendmarc[2912]: | ||
+ | |||
+ | Mit Hilfe von **netstat** können wir überprüfen, | ||
+ | # netstat -tulpen | ||
+ | |||
+ | < | ||
+ | Proto Recv-Q Send-Q Local Address | ||
+ | tcp 0 0 0.0.0.0: | ||
+ | tcp 0 0 127.0.0.1: | ||
+ | tcp 0 0 127.0.0.1: | ||
+ | tcp 0 0 127.0.0.1: | ||
+ | </ | ||
+ | |||
+ | Gleiches können wir natürlich auch mit dem Befehl **lsof** erreichen. | ||
+ | # lsof -i:8893 | ||
+ | |||
+ | | ||
+ | | ||
+ | |||
+ | Damit der Daemon automatisch beim Hochfahren des Servers gestartet wird, nutzen wir folgenden Aufruf. | ||
+ | # systemctl enable opendmarc.service | ||
+ | |||
+ | ln -s '/ | ||
+ | |||
+ | Wollen wir überprüfen ob der Dienst automatisch startet, verwenden wir folgenden Aufruf. | ||
+ | |||
+ | # systemctl is-enabled opendmarc.service | ||
+ | |||
+ | | ||
+ | |||
+ | Die Rückmeldung **enabled** zeigt an, dass der Dienst automatisch startet; ein **disabled** zeigt entsprechend an, dass der Dienst __nicht__ automatisch startet. | ||
+ | |||
+ | ===== Logging / Mailheader ===== | ||
+ | Im Maillog werden entsprechend unserer zuvor festgelegten Konfiguration, | ||
+ | Folgender Logeintrag zeigt einen erfolgreiche DMARC-Überprüfung. | ||
+ | Mar 23 22:46:01 vml000080 opendmarc[25914]: | ||
+ | |||
+ | Im Mailheader der Nachricht, wird dies auch entsprechend vermerkt. | ||
+ | DMARC-Filter: | ||
+ | Authentication-Results: | ||
+ | |||
+ | Hat der Domainbetreiber keinen DMARC-Eintrag im DNS hinterlegt, sieht die betreffende Zeile im Maillog entsprechend so aus. | ||
+ | Mar 19 00:22:36 vml000080 opendmarc[14508]: | ||
+ | |||
+ | Auch dies wird im Mailheader entsprechend vermerkt. | ||
+ | DMARC-Filter: | ||
+ | Authentication-Results: | ||
+ | |||
+ | <WRAP center round alert 35%> \\ | ||
+ | FIXME //... do geds weida!// | ||
+ | </ | ||