]> git.immae.eu Git - perso/Immae/Config/Nix.git/blob - 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
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 = "${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 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
35
36 SetEnvIf Authorization "(.*)" HTTP_AUTHORIZATION=$1
37 Use LDAPConnect
38 Require all granted
39 Require ldap-attribute uid=immae
40 </Directory>
41 '';
42 };
43 phpFpm = rec {
44 basedir = builtins.concatStringsSep ":"
45 [ webRoot config.secrets.fullPaths."webapps/tools-dmarc-reports.php" ];
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 = {
57 SECRETS_FILE = config.secrets.fullPaths."webapps/tools-dmarc-reports.php";
58 };
59 };
60 }