]> git.immae.eu Git - perso/Immae/Config/Nix.git/blob - modules/private/websites/tools/tools/dmarc_reports.nix
Remove webappdirs
[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 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 # Needed to avoid clashes in browser cookies (same domain)
53 "php_admin_value[open_basedir]" = "${basedir}:/tmp";
54 };
55 phpEnv = {
56 SECRETS_FILE = config.secrets.fullPaths."webapps/tools-dmarc-reports.php";
57 };
58 };
59 }