Skyler Grey | 07c947a | 2023-06-08 14:11:23 +0200 | [diff] [blame] | 1 | { config, lib, pkgs, ... }: { |
Skyler Grey | a7fbaee | 2023-05-12 00:29:20 +0000 | [diff] [blame] | 2 | users.users.parsedmarc = { |
| 3 | isSystemUser = true; |
| 4 | createHome = true; |
| 5 | home = "/services/parsedmarc"; |
| 6 | group = config.users.groups.clicks.name; |
| 7 | shell = pkgs.bashInteractive; |
| 8 | }; |
Skyler Grey | fe1740c | 2023-10-21 01:24:18 +0000 | [diff] [blame] | 9 | sops.secrets = lib.pipe [ "imap_password" "maxmind_license_key" ] [ |
Skyler Grey | a7fbaee | 2023-05-12 00:29:20 +0000 | [diff] [blame] | 10 | (map (name: { |
| 11 | inherit name; |
| 12 | value = { |
| 13 | mode = "0400"; |
| 14 | owner = config.users.users.parsedmarc.name; |
| 15 | group = config.users.users.parsedmarc.group; |
Samuel Shuert | f68685d | 2023-10-28 20:07:56 -0400 | [diff] [blame] | 16 | sopsFile = ../../secrets/dmarc.json; |
Skyler Grey | a7fbaee | 2023-05-12 00:29:20 +0000 | [diff] [blame] | 17 | format = "json"; |
| 18 | }; |
| 19 | })) |
| 20 | builtins.listToAttrs |
| 21 | ]; |
| 22 | |
| 23 | services.parsedmarc = { |
Skyler Grey | 40472b4 | 2024-03-16 15:11:29 +0000 | [diff] [blame] | 24 | enable = true; |
Skyler Grey | a7fbaee | 2023-05-12 00:29:20 +0000 | [diff] [blame] | 25 | settings.imap = { |
| 26 | host = "mail.clicks.codes"; |
| 27 | user = "dmarc@clicks.codes"; |
| 28 | password = { _secret = config.sops.secrets.imap_password.path; }; |
Skyler Grey | 07c947a | 2023-06-08 14:11:23 +0200 | [diff] [blame] | 29 | }; |
Skyler Grey | 40472b4 | 2024-03-16 15:11:29 +0000 | [diff] [blame] | 30 | settings.smtp.to = []; |
Skyler Grey | 07c947a | 2023-06-08 14:11:23 +0200 | [diff] [blame] | 31 | settings.mailbox = { |
Skyler Grey | a7fbaee | 2023-05-12 00:29:20 +0000 | [diff] [blame] | 32 | watch = true; |
| 33 | delete = false; |
| 34 | }; |
Skyler Grey | 40472b4 | 2024-03-16 15:11:29 +0000 | [diff] [blame] | 35 | settings.elasticsearch.hosts = lib.mkForce [ "http://localhost:9200" ]; |
Skyler Grey | a7fbaee | 2023-05-12 00:29:20 +0000 | [diff] [blame] | 36 | }; |
| 37 | services.geoipupdate.settings = { |
| 38 | AccountID = 863877; |
| 39 | LicenseKey = { _secret = config.sops.secrets.maxmind_license_key.path; }; |
| 40 | }; |
| 41 | systemd.services.geoipupdate-create-db-dir.script = lib.mkForce '' |
| 42 | set -o errexit -o pipefail -o nounset -o errtrace |
| 43 | shopt -s inherit_errexit |
| 44 | |
| 45 | mkdir -p ${config.services.geoipupdate.settings.DatabaseDirectory} |
| 46 | chmod 0750 ${config.services.geoipupdate.settings.DatabaseDirectory} |
| 47 | |
| 48 | chgrp clicks ${config.services.geoipupdate.settings.DatabaseDirectory} |
| 49 | # The license agreement does not allow us to let non-clicks users access the database |
| 50 | ''; |
Skyler Grey | a7fbaee | 2023-05-12 00:29:20 +0000 | [diff] [blame] | 51 | } |