diff --git a/bundles/rspamd/files/local.d/dmarc.conf b/bundles/rspamd/files/local.d/dmarc.conf new file mode 100644 index 0000000..ac1aa57 --- /dev/null +++ b/bundles/rspamd/files/local.d/dmarc.conf @@ -0,0 +1,10 @@ +reporting { + # Required attributes + enabled = true; # Enable reports in general + email = 'dmarc@${node.metadata.get('hostname')}'; # Source of DMARC reports + domain = '${node.metadata.get('hostname')}'; # Domain to serve + org_name = 'kunbox.net'; # Organisation + smtp = '127.0.0.1'; # SMTP server IP + smtp_port = 25; # SMTP server port + from_name = 'rspamd @ ${node.metadata.get('hostname')}'; # SMTP FROM +} diff --git a/bundles/rspamd/files/local.d/options.inc b/bundles/rspamd/files/local.d/options.inc new file mode 100644 index 0000000..afcb3fc --- /dev/null +++ b/bundles/rspamd/files/local.d/options.inc @@ -0,0 +1,7 @@ +dmarc { + reporting = true; + actions = { + quarantine = "add_header"; + reject = "reject"; + } +} diff --git a/bundles/rspamd/files/rspamd-dmarc-report.service b/bundles/rspamd/files/rspamd-dmarc-report.service new file mode 100644 index 0000000..089d4e6 --- /dev/null +++ b/bundles/rspamd/files/rspamd-dmarc-report.service @@ -0,0 +1,9 @@ +[Unit] +Description=Send rspamd dmarc reports +After=network.target +Requires=rspamd.service + +[Service] +User=_rspamd +Group=_rspamd +ExecStart=/usr/bin/rspamadm dmarc_report diff --git a/bundles/rspamd/files/rspamd-dmarc-report.timer b/bundles/rspamd/files/rspamd-dmarc-report.timer new file mode 100644 index 0000000..297485d --- /dev/null +++ b/bundles/rspamd/files/rspamd-dmarc-report.timer @@ -0,0 +1,9 @@ +[Unit] +Description=Trigger sending dmarc reports + +[Timer] +OnCalendar=*-*-* ${hour}:${minute}:00 +Persistent=true + +[Install] +WantedBy=timers.target diff --git a/bundles/rspamd/items.py b/bundles/rspamd/items.py index c94d0e4..ab04ee8 100644 --- a/bundles/rspamd/items.py +++ b/bundles/rspamd/items.py @@ -49,6 +49,12 @@ svc_systemd = { 'pkg_apt:clamav-freshclam', }, }, + 'rspamd-dmarc-report.timer': { + 'needs': { + 'file:/etc/systemd/system/rspamd-dmarc-report.service', + 'file:/etc/systemd/system/rspamd-dmarc-report.timer', + }, + }, } files = { @@ -58,6 +64,22 @@ files = { '/usr/local/bin/telegraf-rspamd-plugin': { 'mode': '0755', }, + '/etc/systemd/system/rspamd-dmarc-report.timer': { + 'content_type': 'mako', + 'context': { + 'hour': node.magic_number%24, + 'minute': node.magic_number%60, + }, + 'triggers': { + 'action:systemd-reload', + 'svc_systemd:rspamd-dmarc-report.timer:restart', + }, + }, + '/etc/systemd/system/rspamd-dmarc-report.service': { + 'triggers': { + 'action:systemd-reload', + }, + }, } @@ -107,6 +129,7 @@ local_config_path = join(repo.path, 'bundles', 'rspamd', 'files', 'local.d') for f in listdir(local_config_path): files[f'/etc/rspamd/local.d/{f}'] = { 'source': f'local.d/{f}', + 'content_type': 'mako', 'triggers': { 'svc_systemd:rspamd:restart', },