]> git.immae.eu Git - perso/Immae/Config/Nix.git/blame - modules/private/websites/tools/tools/ldap.nix
Compress sql dumps
[perso/Immae/Config/Nix.git] / modules / private / websites / tools / tools / ldap.nix
CommitLineData
f5efae0f 1{ lib, php, env, writeText, phpldapadmin }:
f80772dc 2rec {
4288c2f2
IB
3 activationScript = {
4 deps = [ "httpd" ];
5 text = ''
6 install -m 0755 -o ${apache.user} -g ${apache.group} -d /var/lib/php/sessions/phpldapadmin
7 '';
8 };
8db8e666
IB
9 keys = [{
10 dest = "webapps/tools-ldap";
a840a21c
IB
11 user = apache.user;
12 group = apache.group;
85f5ed68 13 permissions = "0400";
a840a21c
IB
14 text = ''
15 <?php
16 $config->custom->appearance['show_clear_password'] = true;
17 $config->custom->appearance['hide_template_warning'] = true;
18 $config->custom->appearance['theme'] = "tango";
7baabd01
IB
19 $config->custom->appearance['minimalMode'] = false;
20 $config->custom->appearance['tree'] = 'AJAXTree';
f80772dc 21
a840a21c 22 $servers = new Datastore();
f80772dc 23
a840a21c
IB
24 $servers->newServer('ldap_pla');
25 $servers->setValue('server','name','Immae&#x2019;s LDAP');
26 $servers->setValue('server','host','ldaps://${env.ldap.host}');
27 $servers->setValue('login','auth_type','cookie');
28 $servers->setValue('login','bind_id','${env.ldap.dn}');
29 $servers->setValue('login','bind_pass','${env.ldap.password}');
693f27df 30 $servers->setValue('appearance','pla_password_hash','ssha');
a840a21c
IB
31 $servers->setValue('login','attr','uid');
32 $servers->setValue('login','fallback_dn',true);
33 '';
8db8e666 34 }];
f5efae0f 35 webRoot = phpldapadmin.override { config = "/var/secrets/webapps/tools-ldap"; };
a95ab089 36 apache = rec {
f80772dc
IB
37 user = "wwwrun";
38 group = "wwwrun";
39 modules = [ "proxy_fcgi" ];
a95ab089
IB
40 webappName = "tools_ldap";
41 root = "/run/current-system/webapps/${webappName}";
5400b9b6 42 vhostConf = socket: ''
a95ab089
IB
43 Alias /ldap "${root}"
44 <Directory "${root}">
f80772dc
IB
45 DirectoryIndex index.php
46 <FilesMatch "\.php$">
5400b9b6 47 SetHandler "proxy:unix:${socket}|fcgi://localhost"
f80772dc
IB
48 </FilesMatch>
49
50 AllowOverride None
51 Require all granted
52 </Directory>
53 '';
54 };
55 phpFpm = rec {
8db8e666
IB
56 serviceDeps = [ "openldap.service" ];
57 basedir = builtins.concatStringsSep ":" [ webRoot "/var/secrets/webapps/tools-ldap" ];
5400b9b6
IB
58 pool = {
59 "listen.owner" = apache.user;
60 "listen.group" = apache.group;
61 "pm" = "ondemand";
62 "pm.max_children" = "60";
63 "pm.process_idle_timeout" = "60";
f80772dc 64
5400b9b6
IB
65 # Needed to avoid clashes in browser cookies (same domain)
66 "php_value[session.name]" = "LdapPHPSESSID";
67 "php_admin_value[open_basedir]" = "${basedir}:/tmp:/var/lib/php/sessions/phpldapadmin";
68 "php_admin_value[session.save_path]" = "/var/lib/php/sessions/phpldapadmin";
69 };
f80772dc
IB
70 };
71}