blob: 62d847c4ef6f66bec6a42788bc331f887e1afa66 [file] [log] [blame]
Skyler Grey07c947a2023-06-08 14:11:23 +02001{ config, lib, pkgs, ... }: {
Skyler Greya7fbaee2023-05-12 00:29:20 +00002 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 Greyfe1740c2023-10-21 01:24:18 +00009 sops.secrets = lib.pipe [ "imap_password" "maxmind_license_key" ] [
Skyler Greya7fbaee2023-05-12 00:29:20 +000010 (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 Shuertf68685d2023-10-28 20:07:56 -040016 sopsFile = ../../secrets/dmarc.json;
Skyler Greya7fbaee2023-05-12 00:29:20 +000017 format = "json";
18 };
19 }))
20 builtins.listToAttrs
21 ];
22
23 services.parsedmarc = {
Skyler Grey22428b02023-11-19 13:20:56 +000024 enable = false;
Skyler Greya7fbaee2023-05-12 00:29:20 +000025 settings.imap = {
26 host = "mail.clicks.codes";
27 user = "dmarc@clicks.codes";
28 password = { _secret = config.sops.secrets.imap_password.path; };
Skyler Grey07c947a2023-06-08 14:11:23 +020029 };
30 settings.mailbox = {
Skyler Greya7fbaee2023-05-12 00:29:20 +000031 watch = true;
32 delete = false;
33 };
34 };
35 services.geoipupdate.settings = {
36 AccountID = 863877;
37 LicenseKey = { _secret = config.sops.secrets.maxmind_license_key.path; };
38 };
39 systemd.services.geoipupdate-create-db-dir.script = lib.mkForce ''
40 set -o errexit -o pipefail -o nounset -o errtrace
41 shopt -s inherit_errexit
42
43 mkdir -p ${config.services.geoipupdate.settings.DatabaseDirectory}
44 chmod 0750 ${config.services.geoipupdate.settings.DatabaseDirectory}
45
46 chgrp clicks ${config.services.geoipupdate.settings.DatabaseDirectory}
47 # The license agreement does not allow us to let non-clicks users access the database
48 '';
Skyler Greya7fbaee2023-05-12 00:29:20 +000049}