]> git.immae.eu Git - perso/Immae/Config/Nix.git/blob - modules/private/websites/tools/tools/dmarc_reports.nix
5fdf0b62ad09394d19f3920a4137497d66d1d9fb
[perso/Immae/Config/Nix.git] / modules / private / websites / tools / tools / dmarc_reports.nix
1 { env, config }:
2 rec {
3 keys = [{
4 dest = "webapps/tools-dmarc-reports.php";
5 user = "wwwrun";
6 group = "wwwrun";
7 permissions = "0400";
8 text = ''
9 <?php
10 $dbhost = "${env.mysql.host}";
11 $dbname = "${env.mysql.database}";
12 $dbuser = "${env.mysql.user}";
13 $dbpass = "${env.mysql.password}";
14 $dbport = "${env.mysql.port}";
15 $anonymous_key = "${env.anonymous_key}";
16 ?>
17 '';
18 }];
19 webRoot = ./dmarc_reports;
20 apache = rec {
21 user = "wwwrun";
22 group = "wwwrun";
23 modules = [ "proxy_fcgi" ];
24 webappName = "tools_dmarc_reports";
25 root = "/run/current-system/webapps/${webappName}";
26 vhostConf = socket: ''
27 Alias /dmarc-reports "${root}"
28 <Directory "${root}">
29 DirectoryIndex index.html
30 <FilesMatch "\.php$">
31 SetHandler "proxy:unix:${socket}|fcgi://localhost"
32 </FilesMatch>
33
34 AllowOverride None
35 Options +FollowSymlinks
36
37 SetEnvIf Authorization "(.*)" HTTP_AUTHORIZATION=$1
38 Use LDAPConnect
39 Require all granted
40 Require ldap-attribute uid=immae
41 </Directory>
42 '';
43 };
44 phpFpm = rec {
45 basedir = builtins.concatStringsSep ":"
46 [ webRoot config.secrets.fullPaths."webapps/tools-dmarc-reports.php" ];
47 pool = {
48 "listen.owner" = apache.user;
49 "listen.group" = apache.group;
50 "pm" = "ondemand";
51 "pm.max_children" = "60";
52 "pm.process_idle_timeout" = "60";
53
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 }