diff options
Diffstat (limited to 'systems/eldiron/websites/tools/dmarc_reports.nix')
-rw-r--r-- | systems/eldiron/websites/tools/dmarc_reports.nix | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/systems/eldiron/websites/tools/dmarc_reports.nix b/systems/eldiron/websites/tools/dmarc_reports.nix new file mode 100644 index 0000000..8b3aa99 --- /dev/null +++ b/systems/eldiron/websites/tools/dmarc_reports.nix | |||
@@ -0,0 +1,61 @@ | |||
1 | { env, config }: | ||
2 | rec { | ||
3 | keys."webapps/tools-dmarc-reports.php" = { | ||
4 | user = "wwwrun"; | ||
5 | group = "wwwrun"; | ||
6 | permissions = "0400"; | ||
7 | text = '' | ||
8 | <?php | ||
9 | $dbhost = "${env.mysql.host}"; | ||
10 | $dbname = "${env.mysql.database}"; | ||
11 | $dbuser = "${env.mysql.user}"; | ||
12 | $dbpass = "${env.mysql.password}"; | ||
13 | $dbport = "${builtins.toString env.mysql.port}"; | ||
14 | $anonymous_key = "${env.anonymous_key}"; | ||
15 | ?> | ||
16 | ''; | ||
17 | }; | ||
18 | webRoot = ./dmarc_reports; | ||
19 | apache = rec { | ||
20 | user = "wwwrun"; | ||
21 | group = "wwwrun"; | ||
22 | modules = [ "proxy_fcgi" ]; | ||
23 | root = webRoot; | ||
24 | vhostConf = socket: '' | ||
25 | Alias /dmarc-reports "${root}" | ||
26 | <Directory "${root}"> | ||
27 | DirectoryIndex index.html | ||
28 | <FilesMatch "\.php$"> | ||
29 | SetHandler "proxy:unix:${socket}|fcgi://localhost" | ||
30 | </FilesMatch> | ||
31 | |||
32 | AllowOverride None | ||
33 | Options +FollowSymlinks | ||
34 | |||
35 | SetEnvIf Authorization "(.*)" HTTP_AUTHORIZATION=$1 | ||
36 | Use LDAPConnect | ||
37 | Require all granted | ||
38 | Require ldap-attribute uid=immae | ||
39 | </Directory> | ||
40 | ''; | ||
41 | }; | ||
42 | phpFpm = rec { | ||
43 | basedir = builtins.concatStringsSep ":" | ||
44 | [ webRoot config.secrets.fullPaths."webapps/tools-dmarc-reports.php" ]; | ||
45 | pool = { | ||
46 | "listen.owner" = apache.user; | ||
47 | "listen.group" = apache.group; | ||
48 | "pm" = "ondemand"; | ||
49 | "pm.max_children" = "60"; | ||
50 | "pm.process_idle_timeout" = "60"; | ||
51 | |||
52 | "php_admin_value[session.save_handler]" = "redis"; | ||
53 | "php_admin_value[session.save_path]" = "'unix:///run/redis-php-sessions/redis.sock?persistent=1&prefix=Tools:DmarcReports:'"; | ||
54 | # Needed to avoid clashes in browser cookies (same domain) | ||
55 | "php_admin_value[open_basedir]" = "${basedir}:/tmp"; | ||
56 | }; | ||
57 | phpEnv = { | ||
58 | SECRETS_FILE = config.secrets.fullPaths."webapps/tools-dmarc-reports.php"; | ||
59 | }; | ||
60 | }; | ||
61 | } | ||