]>
Commit | Line | Data |
---|---|---|
1 | { lib, php, env, writeText, phpldapadmin, config }: | |
2 | rec { | |
3 | keys."webapps/tools-ldap" = { | |
4 | user = apache.user; | |
5 | group = apache.group; | |
6 | permissions = "0400"; | |
7 | text = '' | |
8 | <?php | |
9 | $config->custom->appearance['show_clear_password'] = true; | |
10 | $config->custom->appearance['hide_template_warning'] = true; | |
11 | $config->custom->appearance['theme'] = "tango"; | |
12 | $config->custom->appearance['minimalMode'] = false; | |
13 | $config->custom->appearance['tree'] = 'AJAXTree'; | |
14 | ||
15 | $servers = new Datastore(); | |
16 | ||
17 | $servers->newServer('ldap_pla'); | |
18 | $servers->setValue('server','name','Immae’s LDAP'); | |
19 | $servers->setValue('server','host','ldaps://${env.ldap.host}'); | |
20 | $servers->setValue('login','auth_type','cookie'); | |
21 | $servers->setValue('login','bind_id','${env.ldap.dn}'); | |
22 | $servers->setValue('login','bind_pass','${env.ldap.password}'); | |
23 | $servers->setValue('appearance','pla_password_hash','ssha'); | |
24 | $servers->setValue('login','attr','uid'); | |
25 | $servers->setValue('login','fallback_dn',true); | |
26 | ''; | |
27 | }; | |
28 | webRoot = phpldapadmin.override { config = config.secrets.fullPaths."webapps/tools-ldap"; }; | |
29 | apache = rec { | |
30 | user = "wwwrun"; | |
31 | group = "wwwrun"; | |
32 | modules = [ "proxy_fcgi" ]; | |
33 | root = "${webRoot}/htdocs"; | |
34 | vhostConf = socket: '' | |
35 | Alias /ldap "${root}" | |
36 | <Directory "${root}"> | |
37 | DirectoryIndex index.php | |
38 | <FilesMatch "\.php$"> | |
39 | SetHandler "proxy:unix:${socket}|fcgi://localhost" | |
40 | </FilesMatch> | |
41 | ||
42 | AllowOverride None | |
43 | Require all granted | |
44 | </Directory> | |
45 | ''; | |
46 | }; | |
47 | phpFpm = rec { | |
48 | serviceDeps = [ "openldap.service" ]; | |
49 | basedir = builtins.concatStringsSep ":" [ webRoot config.secrets.fullPaths."webapps/tools-ldap" ]; | |
50 | pool = { | |
51 | "listen.owner" = apache.user; | |
52 | "listen.group" = apache.group; | |
53 | "pm" = "ondemand"; | |
54 | "pm.max_children" = "60"; | |
55 | "pm.process_idle_timeout" = "60"; | |
56 | ||
57 | # Needed to avoid clashes in browser cookies (same domain) | |
58 | "php_value[session.name]" = "LdapPHPSESSID"; | |
59 | "php_admin_value[open_basedir]" = "${basedir}:/tmp"; | |
60 | "php_admin_value[session.save_handler]" = "redis"; | |
61 | "php_admin_value[session.save_path]" = "'unix:///run/redis-php-sessions/redis.sock?persistent=1&prefix=Tools:PhpLDAPAdmin:'"; | |
62 | }; | |
63 | }; | |
64 | monitoringPlugins = [ "http" ]; | |
65 | monitoringObjects.service = [ | |
66 | { | |
67 | service_description = "ldap website is running on tools.immae.eu"; | |
68 | host_name = config.hostEnv.fqdn; | |
69 | use = "external-web-service"; | |
70 | check_command = ["check_https" "tools.immae.eu" "/ldap/" "<title>phpLDAPadmin"]; | |
71 | ||
72 | servicegroups = "webstatus-webapps"; | |
73 | _webstatus_name = "LDAP"; | |
74 | _webstatus_url = "https://tools.immae.eu/ldap/"; | |
75 | } | |
76 | ]; | |
77 | } |