]> git.immae.eu Git - perso/Immae/Config/Nix.git/blame - modules/private/websites/tools/tools/dmarc_reports.nix
Use attrs for secrets instead of lists
[perso/Immae/Config/Nix.git] / modules / private / websites / tools / tools / dmarc_reports.nix
CommitLineData
da30ae4f 1{ env, config }:
7df5e532 2rec {
4c4652aa 3 keys."webapps/tools-dmarc-reports.php" = {
7df5e532
IB
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 = "${env.mysql.port}";
9c08c3bc 14 $anonymous_key = "${env.anonymous_key}";
7df5e532
IB
15 ?>
16 '';
4c4652aa 17 };
7df5e532
IB
18 webRoot = ./dmarc_reports;
19 apache = rec {
20 user = "wwwrun";
21 group = "wwwrun";
22 modules = [ "proxy_fcgi" ];
23 webappName = "tools_dmarc_reports";
24 root = "/run/current-system/webapps/${webappName}";
25 vhostConf = socket: ''
26 Alias /dmarc-reports "${root}"
27 <Directory "${root}">
28 DirectoryIndex index.html
29 <FilesMatch "\.php$">
30 SetHandler "proxy:unix:${socket}|fcgi://localhost"
31 </FilesMatch>
32
33 AllowOverride None
34 Options +FollowSymlinks
9c08c3bc
IB
35
36 SetEnvIf Authorization "(.*)" HTTP_AUTHORIZATION=$1
37 Use LDAPConnect
7df5e532 38 Require all granted
9c08c3bc 39 Require ldap-attribute uid=immae
7df5e532
IB
40 </Directory>
41 '';
42 };
43 phpFpm = rec {
44 basedir = builtins.concatStringsSep ":"
da30ae4f 45 [ webRoot config.secrets.fullPaths."webapps/tools-dmarc-reports.php" ];
7df5e532
IB
46 pool = {
47 "listen.owner" = apache.user;
48 "listen.group" = apache.group;
49 "pm" = "ondemand";
50 "pm.max_children" = "60";
51 "pm.process_idle_timeout" = "60";
52
53 # Needed to avoid clashes in browser cookies (same domain)
54 "php_admin_value[open_basedir]" = "${basedir}:/tmp";
55 };
56 phpEnv = {
da30ae4f 57 SECRETS_FILE = config.secrets.fullPaths."webapps/tools-dmarc-reports.php";
7df5e532
IB
58 };
59 };
60}