1 <chapter xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xml:id="module-services-parsedmarc">
2 <title>parsedmarc</title>
4 <link xlink:href="https://domainaware.github.io/parsedmarc/">parsedmarc</link>
5 is a service which parses incoming
6 <link xlink:href="https://dmarc.org/">DMARC</link> reports and
7 stores or sends them to a downstream service for further analysis.
8 In combination with Elasticsearch, Grafana and the included Grafana
9 dashboard, it provides a handy overview of DMARC reports over time.
11 <section xml:id="module-services-parsedmarc-basic-usage">
12 <title>Basic usage</title>
14 A very minimal setup which reads incoming reports from an external
15 email address and saves them to a local Elasticsearch instance
18 <programlisting language="bash">
19 services.parsedmarc = {
22 host = "imap.example.com";
23 user = "alice@example.com";
24 password = "/path/to/imap_password_file";
27 provision.geoIp = false; # Not recommended!
31 Note that GeoIP provisioning is disabled in the example for
32 simplicity, but should be turned on for fully functional reports.
35 <section xml:id="local-mail">
36 <title>Local mail</title>
38 Instead of watching an external inbox, a local inbox can be
39 automatically provisioned. The recipient’s name is by default set
40 to <literal>dmarc</literal>, but can be configured in
41 <link xlink:href="options.html#opt-services.parsedmarc.provision.localMail.recipientName">services.parsedmarc.provision.localMail.recipientName</link>.
42 You need to add an MX record pointing to the host. More
43 concretely: for the example to work, an MX record needs to be set
44 up for <literal>monitoring.example.com</literal> and the complete
45 email address that should be configured in the domain’s dmarc
46 policy is <literal>dmarc@monitoring.example.com</literal>.
48 <programlisting language="bash">
49 services.parsedmarc = {
54 hostname = monitoring.example.com;
56 geoIp = false; # Not recommended!
61 <section xml:id="grafana-and-geoip">
62 <title>Grafana and GeoIP</title>
64 The reports can be visualized and summarized with parsedmarc’s
65 official Grafana dashboard. For all views to work, and for the
66 data to be complete, GeoIP databases are also required. The
67 following example shows a basic deployment where the provisioned
68 Elasticsearch instance is automatically added as a Grafana
69 datasource, and the dashboard is added to Grafana as well.
71 <programlisting language="bash">
72 services.parsedmarc = {
86 # Not required, but recommended for full functionality
87 services.geoipupdate = {
90 LicenseKey = "/path/to/license_key_file";
96 addr = "0.0.0.0";
98 rootUrl = "https://" + url;
99 protocol = "socket";
101 adminUser = "admin";
102 adminPasswordFile = "/path/to/admin_password_file";
103 secretKeyFile = "/path/to/secret_key_file";
109 recommendedTlsSettings = true;
110 recommendedOptimisation = true;
111 recommendedGzipSettings = true;
112 recommendedProxySettings = true;
113 upstreams.grafana.servers."unix:/${config.services.grafana.socket}" = {};
114 virtualHosts.${url} = {
115 root = config.services.grafana.staticRootPath;
118 locations."/".tryFiles = "$uri @grafana";
119 locations."@grafana".proxyPass = "http://grafana";
122 users.users.nginx.extraGroups = [ "grafana" ];