]> git.immae.eu Git - perso/Immae/Config/Nix.git/blame - systems/eldiron/websites/tools/dmarc_reports.nix
Squash changes containing private information
[perso/Immae/Config/Nix.git] / systems / eldiron / websites / 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}";
1a64deeb 13 $dbport = "${builtins.toString 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" ];
750fe5a4 23 root = webRoot;
7df5e532
IB
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
9c08c3bc
IB
34
35 SetEnvIf Authorization "(.*)" HTTP_AUTHORIZATION=$1
36 Use LDAPConnect
7df5e532 37 Require all granted
9c08c3bc 38 Require ldap-attribute uid=immae
7df5e532
IB
39 </Directory>
40 '';
41 };
42 phpFpm = rec {
43 basedir = builtins.concatStringsSep ":"
da30ae4f 44 [ webRoot config.secrets.fullPaths."webapps/tools-dmarc-reports.php" ];
7df5e532
IB
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
1a64deeb
IB
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:'";
7df5e532
IB
54 # Needed to avoid clashes in browser cookies (same domain)
55 "php_admin_value[open_basedir]" = "${basedir}:/tmp";
56 };
57 phpEnv = {
da30ae4f 58 SECRETS_FILE = config.secrets.fullPaths."webapps/tools-dmarc-reports.php";
7df5e532
IB
59 };
60 };
61}