]>
Commit | Line | Data |
---|---|---|
a1bb33c4 IB |
1 | { |
2 | network = { | |
3 | description = "Immae's network"; | |
4 | enableRollback = true; | |
5 | }; | |
6 | ||
ab5d04b8 | 7 | eldiron = { config, pkgs, ... }: |
5c101474 IB |
8 | with import ../libs.nix; |
9 | let | |
712ccefd | 10 | mypkgs = pkgs.callPackage ./packages.nix { |
5c101474 | 11 | inherit checkEnv fetchedGitPrivate fetchedGithub; |
5c101474 | 12 | }; |
ab5d04b8 IB |
13 | in |
14 | { | |
91493dc0 | 15 | nixpkgs.config.packageOverrides = oldpkgs: rec { |
c5aaa64a IB |
16 | gitolite = oldpkgs.gitolite.overrideAttrs(old: rec { |
17 | name = "gitolite-${version}"; | |
18 | version = "3.6.10"; | |
19 | src = pkgs.fetchFromGitHub { | |
20 | owner = "sitaramc"; | |
21 | repo = "gitolite"; | |
22 | rev = "v${version}"; | |
23 | sha256 = "0p2697mn6rwm03ndlv7q137zczai82n41aplq1g006ii7f12xy8h"; | |
24 | }; | |
25 | }); | |
712ccefd IB |
26 | gitweb = oldpkgs.gitweb.overrideAttrs(old: { |
27 | installPhase = old.installPhase + '' | |
28 | cp -r ${./packages/gitweb} $out/gitweb-theme; | |
29 | ''; | |
30 | }); | |
91493dc0 IB |
31 | postgresql = postgresql111; |
32 | postgresql111 = oldpkgs.postgresql100.overrideAttrs(old: rec { | |
33 | passthru = old.passthru // { psqlSchema = "11.0"; }; | |
34 | name = "postgresql-11.1"; | |
35 | src = pkgs.fetchurl { | |
36 | url = "mirror://postgresql/source/v11.1/${name}.tar.bz2"; | |
37 | sha256 = "026v0sicsh7avzi45waf8shcbhivyxmi7qgn9fd1x0vl520mx0ch"; | |
38 | }; | |
39 | }); | |
40 | mariadb = mariadbPAM; | |
41 | mariadbPAM = oldpkgs.mariadb.overrideAttrs(old: rec { | |
42 | cmakeFlags = old.cmakeFlags ++ [ "-DWITH_AUTHENTICATION_PAM=ON" ]; | |
43 | buildInputs = old.buildInputs ++ [ pkgs.pam ]; | |
44 | }); | |
45 | }; | |
46 | ||
a1bb33c4 IB |
47 | networking = { |
48 | firewall = { | |
49 | enable = true; | |
7611e4e2 | 50 | allowedTCPPorts = [ 22 80 443 3306 5432 9418 ]; |
a1bb33c4 IB |
51 | }; |
52 | }; | |
53 | ||
54 | deployment = { | |
55 | targetEnv = "hetzner"; | |
56 | hetzner = { | |
57 | #robotUser = "defined in HETZNER_ROBOT_USER"; | |
58 | #robotPass = "defined in HETZNER_ROBOT_PASS"; | |
59 | mainIPv4 = "176.9.151.89"; | |
60 | partitions = '' | |
61 | clearpart --all --initlabel --drives=sda,sdb | |
62 | ||
63 | part swap1 --recommended --label=swap1 --fstype=swap --ondisk=sda | |
64 | part swap2 --recommended --label=swap2 --fstype=swap --ondisk=sdb | |
65 | ||
66 | part raid.1 --grow --ondisk=sda | |
67 | part raid.2 --grow --ondisk=sdb | |
68 | ||
69 | raid / --level=1 --device=md0 --fstype=ext4 --label=root raid.1 raid.2 | |
70 | ''; | |
71 | }; | |
72 | }; | |
73 | ||
66b5bbf6 IB |
74 | environment.systemPackages = let |
75 | # FIXME: move it to nextcloud | |
76 | occ = pkgs.writeScriptBin "nextcloud-occ" '' | |
77 | #! ${pkgs.stdenv.shell} | |
78 | cd ${mypkgs.nextcloud.webRoot} | |
79 | NEXTCLOUD_CONFIG_DIR="${mypkgs.nextcloud.webRoot}/config" \ | |
80 | exec \ | |
81 | ${config.services.phpfpm.phpPackage}/bin/php \ | |
82 | -c ${config.services.phpfpm.phpPackage}/etc/php.ini \ | |
83 | occ $* | |
84 | ''; | |
85 | in [ | |
ce6ee3b8 IB |
86 | pkgs.telnet |
87 | pkgs.vim | |
66b5bbf6 | 88 | occ |
ce6ee3b8 IB |
89 | ]; |
90 | ||
a1bb33c4 | 91 | security.acme.certs = { |
e42ba74f IB |
92 | # /!\ To create a new certificate, add first the domain to an |
93 | # existing certificate, deploy, and then use it in httpd. | |
a1bb33c4 IB |
94 | "eldiron" = { |
95 | webroot = "/var/lib/acme/acme-challenge"; | |
96 | email = "ismael@bouya.org"; | |
97 | domain = "eldiron.immae.eu"; | |
e379fd29 IB |
98 | plugins = [ "cert.pem" "chain.pem" "fullchain.pem" "full.pem" "key.pem" "account_key.json" ]; |
99 | postRun = '' | |
e273ef92 | 100 | systemctl reload httpd.service |
e379fd29 | 101 | ''; |
a1bb33c4 IB |
102 | extraDomains = { |
103 | "db-1.immae.eu" = null; | |
1b81e079 | 104 | "git.immae.eu" = null; |
e379fd29 | 105 | "tools.immae.eu" = null; |
65fe7543 IB |
106 | "connexionswing.immae.eu" = null; |
107 | "sandetludo.immae.eu" = null; | |
66b5bbf6 | 108 | "cloud.immae.eu" = null; |
e42ba74f IB |
109 | "ludivine.immae.eu" = null; |
110 | "ludivinecassal.com" = null; | |
111 | }; | |
112 | }; | |
113 | "ludivinecassal" = { | |
114 | webroot = "/var/lib/acme/acme-challenge"; | |
115 | email = "ismael@bouya.org"; | |
116 | domain = "ludivinecassal.com"; | |
117 | plugins = [ "cert.pem" "chain.pem" "fullchain.pem" "full.pem" "key.pem" "account_key.json" ]; | |
118 | postRun = '' | |
119 | systemctl reload httpd.service | |
120 | ''; | |
121 | extraDomains = { | |
122 | "www.ludivinecassal.com" = null; | |
a1bb33c4 IB |
123 | }; |
124 | }; | |
e273ef92 IB |
125 | # "connexionswing" = { |
126 | # webroot = "/var/lib/acme/acme-challenge"; | |
127 | # email = "ismael@bouya.org"; | |
128 | # domain = "connexionswing.com"; | |
129 | # plugins = [ "cert.pem" "chain.pem" "fullchain.pem" "full.pem" "key.pem" "account_key.json" ]; | |
130 | # postRun = '' | |
131 | # systemctl reload httpd.service | |
132 | # ''; | |
133 | # extraDomains = { | |
134 | # "www.connexionswing.com" = null; | |
135 | # "sandetludo.com" = null; | |
136 | # "www.sandetludo.com" = null; | |
137 | # }; | |
138 | # }; | |
a1bb33c4 IB |
139 | }; |
140 | ||
5566d26d IB |
141 | services.openssh.extraConfig = '' |
142 | AuthorizedKeysCommand /etc/ssh/ldap_authorized_keys | |
143 | AuthorizedKeysCommandUser nobody | |
144 | ''; | |
145 | ||
cf80b4f2 IB |
146 | users.users.wwwrun.extraGroups = [ "gitolite" ]; |
147 | ||
19def671 IB |
148 | users.users.gitolite.packages = let |
149 | python-packages = python-packages: with python-packages; [ | |
150 | simplejson | |
151 | urllib3 | |
152 | ]; | |
153 | in | |
154 | [ | |
155 | (pkgs.python3.withPackages python-packages) | |
156 | ]; | |
5566d26d IB |
157 | # FIXME: after initial install, need to |
158 | # (1) copy rc file (adjust gitolite_ldap_groups.sh) | |
159 | # (2) (mark old readonly and) sync repos except gitolite-admin | |
160 | # rsync -av --exclude=gitolite-admin.git old:/var/lib/gitolite/repositories /var/lib/gitolite/ | |
161 | # chown -R gitolite:gitolite /var/lib/gitolite | |
162 | # (3) push force the gitolite-admin to new location (from external point) | |
163 | # Don't use an existing key, it will take precedence over | |
164 | # gitolite-admin | |
165 | # (4) su -u gitolite gitolite setup | |
166 | services.gitolite = { | |
167 | enable = true; | |
168 | # FIXME: key from ./ssh | |
169 | adminPubkey = "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDXqRbiHw7QoHADNIEuo4nUT9fSOIEBMdJZH0bkQAxXyJFyCM1IMz0pxsHV0wu9tdkkr36bPEUj2aV5bkYLBN6nxcV2Y49X8bjOSCPfx3n6Own1h+NeZVBj4ZByrFmqCbTxUJIZ2bZKcWOFncML39VmWdsVhNjg0X4NBBehqXRIKr2gt3E/ESAxTYJFm0BnU0baciw9cN0bsRGqvFgf5h2P48CIAfwhVcGmPQnnAwabnosYQzRWxR0OygH5Kd8mePh6FheIRIigfXsDO8f/jdxwut8buvNIf3m5EBr3tUbTsvM+eV3M5vKGt7sk8T64DVtepTSdOOWtp+47ktsnHOMh immae@immae.eu"; | |
170 | }; | |
171 | ||
a05f8abe IB |
172 | services.ympd = mypkgs.ympd.config // { enable = true; }; |
173 | ||
58d1a782 | 174 | services.phpfpm = { |
66b5bbf6 IB |
175 | # /!\ phppackage is used in nextcloud configuation |
176 | phpOptions = '' | |
177 | ; For nextcloud | |
178 | extension=${pkgs.phpPackages.redis}/lib/php/extensions/redis.so | |
179 | ; For nextcloud | |
180 | extension=${pkgs.phpPackages.apcu}/lib/php/extensions/apcu.so | |
ec9ff2b8 IB |
181 | ; For nextcloud |
182 | zend_extension=${pkgs.php}/lib/php/extensions/opcache.so | |
66b5bbf6 | 183 | ''; |
58d1a782 IB |
184 | extraConfig = '' |
185 | log_level = notice | |
186 | ''; | |
187 | poolConfigs = { | |
27e22b76 | 188 | adminer = mypkgs.adminer.phpFpm.pool; |
65fe7543 | 189 | connexionswing_dev = mypkgs.connexionswing_dev.phpFpm.pool; |
e273ef92 | 190 | connexionswing_prod = mypkgs.connexionswing_prod.phpFpm.pool; |
e42ba74f IB |
191 | ludivinecassal_dev = mypkgs.ludivinecassal_dev.phpFpm.pool; |
192 | ludivinecassal_prod = mypkgs.ludivinecassal_prod.phpFpm.pool; | |
66b5bbf6 | 193 | nextcloud = mypkgs.nextcloud.phpFpm.pool; |
50d8fa14 | 194 | mantisbt = mypkgs.mantisbt.phpFpm.pool; |
58d1a782 IB |
195 | }; |
196 | }; | |
197 | ||
65fe7543 IB |
198 | system.activationScripts = { |
199 | connexionswing_dev = mypkgs.connexionswing_dev.activationScript; | |
e273ef92 | 200 | connexionswing_prod = mypkgs.connexionswing_prod.activationScript; |
e42ba74f IB |
201 | ludivinecassal_dev = mypkgs.ludivinecassal_dev.activationScript; |
202 | ludivinecassal_prod = mypkgs.ludivinecassal_prod.activationScript; | |
66b5bbf6 | 203 | nextcloud = mypkgs.nextcloud.activationScript; |
5dd28b43 IB |
204 | httpd = '' |
205 | install -d -m 0755 /var/lib/acme/acme-challenge | |
5dd28b43 | 206 | ''; |
60f67ae3 IB |
207 | redis = '' |
208 | mkdir -p /run/redis | |
209 | chown redis /run/redis | |
210 | ''; | |
5566d26d | 211 | gitolite = |
5c101474 | 212 | assert checkEnv "NIXOPS_GITOLITE_LDAP_PASSWORD"; |
5566d26d | 213 | let |
5c101474 | 214 | gitolite_ldap_groups = wrap { |
5566d26d IB |
215 | name = "gitolite_ldap_groups.sh"; |
216 | file = ./packages/gitolite_ldap_groups.sh; | |
217 | vars = { | |
218 | LDAP_PASS = builtins.getEnv "NIXOPS_GITOLITE_LDAP_PASSWORD"; | |
219 | }; | |
220 | paths = [ pkgs.openldap pkgs.stdenv.shellPackage pkgs.gnugrep pkgs.coreutils ]; | |
221 | }; | |
222 | in { | |
223 | deps = [ "users" ]; | |
224 | text = '' | |
225 | if [ -d /var/lib/gitolite ]; then | |
226 | ln -sf ${gitolite_ldap_groups} /var/lib/gitolite/gitolite_ldap_groups.sh | |
cf80b4f2 IB |
227 | chmod g+rx /var/lib/gitolite |
228 | fi | |
229 | if [ -f /var/lib/gitolite/projects.list ]; then | |
230 | chmod g+r /var/lib/gitolite/projects.list | |
5566d26d IB |
231 | fi |
232 | ''; | |
233 | }; | |
234 | }; | |
235 | ||
236 | environment.etc."ssh/ldap_authorized_keys" = let | |
237 | ldap_authorized_keys = | |
5c101474 IB |
238 | assert checkEnv "NIXOPS_SSHD_LDAP_PASSWORD"; |
239 | wrap { | |
5566d26d IB |
240 | name = "ldap_authorized_keys"; |
241 | file = ./ldap_authorized_keys.sh; | |
242 | vars = { | |
243 | LDAP_PASS = builtins.getEnv "NIXOPS_SSHD_LDAP_PASSWORD"; | |
244 | GITOLITE_SHELL = "${pkgs.gitolite}/bin/gitolite-shell"; | |
245 | ECHO = "${pkgs.coreutils}/bin/echo"; | |
246 | }; | |
247 | paths = [ pkgs.openldap pkgs.stdenv.shellPackage pkgs.gnugrep pkgs.gnused pkgs.coreutils ]; | |
248 | }; | |
249 | in { | |
250 | enable = true; | |
251 | mode = "0755"; | |
252 | user = "root"; | |
253 | source = ldap_authorized_keys; | |
65fe7543 IB |
254 | }; |
255 | ||
7611e4e2 IB |
256 | services.gitDaemon = { |
257 | enable = true; | |
258 | user = "gitolite"; | |
259 | group = "gitolite"; | |
260 | basePath = "${mypkgs.git.web.varDir}/repositories"; | |
261 | }; | |
262 | ||
58d1a782 | 263 | services.httpd = let |
b7cd7e4b | 264 | withConf = domain: { |
58d1a782 | 265 | enableSSL = true; |
5dd28b43 | 266 | sslServerCert = "/var/lib/acme/${domain}/cert.pem"; |
58d1a782 IB |
267 | sslServerKey = "/var/lib/acme/${domain}/key.pem"; |
268 | sslServerChain = "/var/lib/acme/${domain}/fullchain.pem"; | |
b7cd7e4b IB |
269 | logFormat = "combinedVhost"; |
270 | listen = [ { ip = "*"; port = 443; } ]; | |
58d1a782 | 271 | }; |
94818b75 IB |
272 | apacheConfig = { |
273 | gzip = { | |
274 | modules = [ "deflate" "filter" ]; | |
275 | extraConfig = '' | |
276 | AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css text/javascript application/javascript | |
277 | ''; | |
278 | }; | |
279 | ldap = { | |
280 | modules = [ "ldap" "authnz_ldap" ]; | |
5c101474 | 281 | extraConfig = assert checkEnv "NIXOPS_HTTP_LDAP_PASSWORD"; '' |
94818b75 IB |
282 | <IfModule ldap_module> |
283 | LDAPSharedCacheSize 500000 | |
284 | LDAPCacheEntries 1024 | |
285 | LDAPCacheTTL 600 | |
286 | LDAPOpCacheEntries 1024 | |
287 | LDAPOpCacheTTL 600 | |
288 | </IfModule> | |
289 | ||
290 | <Macro LDAPConnect> | |
291 | <IfModule authnz_ldap_module> | |
292 | AuthLDAPURL ldap://ldap.immae.eu:389/dc=immae,dc=eu | |
293 | AuthLDAPBindDN cn=httpd,ou=services,dc=immae,dc=eu | |
294 | AuthLDAPBindPassword "${builtins.getEnv "NIXOPS_HTTP_LDAP_PASSWORD"}" | |
295 | AuthType Basic | |
296 | AuthName "Authentification requise (Acces LDAP)" | |
297 | AuthBasicProvider ldap | |
298 | </IfModule> | |
299 | </Macro> | |
300 | ''; | |
301 | }; | |
b7cd7e4b IB |
302 | http2 = { |
303 | modules = [ "http2" ]; | |
304 | extraConfig = '' | |
305 | Protocols h2 http/1.1 | |
306 | ''; | |
307 | }; | |
308 | customLog = { | |
309 | modules = []; | |
310 | extraConfig = '' | |
311 | LogFormat "%v %h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %p" combinedVhost | |
312 | ''; | |
313 | }; | |
94818b75 | 314 | }; |
58d1a782 | 315 | in rec { |
a1bb33c4 | 316 | enable = true; |
58d1a782 IB |
317 | logPerVirtualHost = true; |
318 | multiProcessingModule = "worker"; | |
319 | adminAddr = "httpd@immae.eu"; | |
b7cd7e4b | 320 | logFormat = "combinedVhost"; |
25fd1d16 IB |
321 | extraModules = pkgs.lib.lists.unique ( |
322 | mypkgs.adminer.apache.modules ++ | |
66b5bbf6 | 323 | mypkgs.nextcloud.apache.modules ++ |
65fe7543 | 324 | mypkgs.connexionswing_dev.apache.modules ++ |
e273ef92 | 325 | mypkgs.connexionswing_prod.apache.modules ++ |
e42ba74f IB |
326 | mypkgs.ludivinecassal_dev.apache.modules ++ |
327 | mypkgs.ludivinecassal_prod.apache.modules ++ | |
5f3e023d | 328 | mypkgs.ympd.apache.modules ++ |
cf80b4f2 | 329 | mypkgs.git.web.apache.modules ++ |
50d8fa14 | 330 | mypkgs.mantisbt.apache.modules ++ |
94818b75 IB |
331 | pkgs.lib.lists.flatten (pkgs.lib.attrsets.mapAttrsToList (n: v: v.modules) apacheConfig) ++ |
332 | [ "macro" ]); | |
333 | extraConfig = builtins.concatStringsSep "\n" | |
334 | (pkgs.lib.attrsets.mapAttrsToList (n: v: v.extraConfig) apacheConfig); | |
58d1a782 | 335 | virtualHosts = [ |
b7cd7e4b | 336 | (withConf "eldiron" // { |
58d1a782 | 337 | hostName = "eldiron.immae.eu"; |
1d4ccb2c IB |
338 | documentRoot = ./www; |
339 | extraConfig = '' | |
340 | DirectoryIndex index.htm | |
341 | ''; | |
58d1a782 | 342 | }) |
b7cd7e4b | 343 | (withConf "eldiron" // { |
58d1a782 IB |
344 | hostName = "db-1.immae.eu"; |
345 | documentRoot = null; | |
27e22b76 | 346 | extraConfig = builtins.concatStringsSep "\n" [ |
1bb2ff2c | 347 | mypkgs.adminer.apache.vhostConf |
27e22b76 | 348 | ]; |
58d1a782 | 349 | }) |
b7cd7e4b | 350 | (withConf "eldiron" // { |
e379fd29 IB |
351 | hostName = "tools.immae.eu"; |
352 | documentRoot = null; | |
353 | extraConfig = builtins.concatStringsSep "\n" [ | |
1bb2ff2c | 354 | mypkgs.adminer.apache.vhostConf |
a05f8abe | 355 | mypkgs.ympd.apache.vhostConf |
e379fd29 IB |
356 | ]; |
357 | }) | |
b7cd7e4b | 358 | (withConf "eldiron" // { |
65fe7543 IB |
359 | hostName = "connexionswing.immae.eu"; |
360 | serverAliases = [ "sandetludo.immae.eu" ]; | |
361 | documentRoot = mypkgs.connexionswing_dev.webRoot; | |
362 | extraConfig = builtins.concatStringsSep "\n" [ | |
363 | mypkgs.connexionswing_dev.apache.vhostConf | |
364 | ]; | |
365 | }) | |
e42ba74f IB |
366 | (withConf "eldiron" // { |
367 | hostName = "ludivine.immae.eu"; | |
368 | documentRoot = mypkgs.ludivinecassal_dev.webRoot; | |
369 | extraConfig = builtins.concatStringsSep "\n" [ | |
370 | mypkgs.ludivinecassal_dev.apache.vhostConf | |
371 | ]; | |
372 | }) | |
373 | (withConf "ludivinecassal" // { | |
374 | hostName = "ludivinecassal.com"; | |
375 | serverAliases = [ "www.ludivinecassal.com" ]; | |
376 | documentRoot = mypkgs.ludivinecassal_prod.webRoot; | |
377 | extraConfig = builtins.concatStringsSep "\n" [ | |
378 | mypkgs.ludivinecassal_prod.apache.vhostConf | |
379 | ]; | |
380 | }) | |
b7cd7e4b | 381 | (withConf "eldiron" // { |
66b5bbf6 IB |
382 | hostName = "cloud.immae.eu"; |
383 | documentRoot = mypkgs.nextcloud.webRoot; | |
384 | extraConfig = builtins.concatStringsSep "\n" [ | |
385 | mypkgs.nextcloud.apache.vhostConf | |
386 | ]; | |
387 | }) | |
b7cd7e4b | 388 | (withConf "eldiron" // { |
cf80b4f2 IB |
389 | hostName = "git.immae.eu"; |
390 | documentRoot = mypkgs.git.web.webRoot; | |
391 | extraConfig = builtins.concatStringsSep "\n" [ | |
392 | mypkgs.git.web.apache.vhostConf | |
50d8fa14 | 393 | mypkgs.mantisbt.apache.vhostConf |
cf80b4f2 IB |
394 | ] + '' |
395 | RewriteEngine on | |
396 | RewriteCond %{REQUEST_URI} ^/releases | |
397 | RewriteRule /releases(.*) https://release.immae.eu$1 [P,L] | |
398 | ''; | |
399 | }) | |
58d1a782 IB |
400 | { # Should go last, default fallback |
401 | listen = [ { ip = "*"; port = 80; } ]; | |
402 | hostName = "redirectSSL"; | |
403 | serverAliases = [ "*" ]; | |
404 | enableSSL = false; | |
b7cd7e4b | 405 | logFormat = "combinedVhost"; |
58d1a782 IB |
406 | documentRoot = "/var/lib/acme/acme-challenge"; |
407 | extraConfig = '' | |
408 | RewriteEngine on | |
409 | RewriteCond "%{REQUEST_URI}" "!^/\.well-known" | |
410 | RewriteRule ^(.+) https://%{HTTP_HOST}$1 [R=301] | |
411 | # To redirect in specific "VirtualHost *:80", do | |
412 | # RedirectMatch 301 ^/((?!\.well-known.*$).*)$ https://host/$1 | |
413 | # rather than rewrite | |
414 | ''; | |
415 | } | |
416 | ]; | |
417 | }; | |
418 | ||
dedf591d IB |
419 | security.pam.services = let |
420 | pam_ldap = pkgs.pam_ldap; | |
5c101474 | 421 | pam_ldap_mysql = assert checkEnv "NIXOPS_MYSQL_PAM_PASSWORD"; |
6cd8d6ce | 422 | pkgs.writeText "mysql.conf" '' |
dedf591d IB |
423 | host ldap.immae.eu |
424 | base dc=immae,dc=eu | |
425 | binddn cn=mysql,cn=pam,ou=services,dc=immae,dc=eu | |
426 | bindpw ${builtins.getEnv "NIXOPS_MYSQL_PAM_PASSWORD"} | |
427 | pam_filter memberOf=cn=users,cn=mysql,cn=pam,ou=services,dc=immae,dc=eu | |
428 | ''; | |
429 | in [ | |
430 | { | |
431 | name = "mysql"; | |
432 | text = '' | |
433 | # https://mariadb.com/kb/en/mariadb/pam-authentication-plugin/ | |
434 | auth required ${pam_ldap}/lib/security/pam_ldap.so config=${pam_ldap_mysql} | |
435 | account required ${pam_ldap}/lib/security/pam_ldap.so config=${pam_ldap_mysql} | |
436 | ''; | |
437 | } | |
438 | ]; | |
439 | ||
60f67ae3 IB |
440 | # FIXME: backup |
441 | services.redis = rec { | |
442 | enable = true; | |
443 | bind = "127.0.0.1"; | |
444 | unixSocket = "/run/redis/redis.sock"; | |
445 | extraConfig = '' | |
446 | unixsocketperm 777 | |
447 | maxclients 1024 | |
448 | ''; | |
449 | }; | |
450 | ||
dedf591d IB |
451 | # FIXME: initial sync |
452 | # FIXME: backup | |
453 | # FIXME: restart after pam | |
454 | # FIXME: pam access doesn’t work (because of php module) | |
27e22b76 | 455 | # FIXME: ssl |
dedf591d IB |
456 | services.mysql = rec { |
457 | enable = true; | |
91493dc0 | 458 | package = pkgs.mariadb; |
dedf591d IB |
459 | }; |
460 | ||
a1bb33c4 | 461 | # FIXME: initial sync |
dedf591d | 462 | # FIXME: backup |
27e22b76 | 463 | # FIXME: ssl |
a1bb33c4 IB |
464 | services.postgresql = rec { |
465 | enable = true; | |
91493dc0 | 466 | package = pkgs.postgresql; |
a1bb33c4 IB |
467 | enableTCPIP = true; |
468 | extraConfig = '' | |
469 | max_connections = 100 | |
470 | wal_level = logical | |
471 | shared_buffers = 128MB | |
472 | max_wal_size = 1GB | |
473 | min_wal_size = 80MB | |
474 | log_timezone = 'Europe/Paris' | |
475 | datestyle = 'iso, mdy' | |
476 | timezone = 'Europe/Paris' | |
477 | lc_messages = 'en_US.UTF-8' | |
478 | lc_monetary = 'en_US.UTF-8' | |
479 | lc_numeric = 'en_US.UTF-8' | |
480 | lc_time = 'en_US.UTF-8' | |
481 | default_text_search_config = 'pg_catalog.english' | |
482 | # ssl = on | |
483 | # ssl_cert_file = '/var/lib/acme/eldiron/fullchain.pem' | |
484 | # ssl_key_file = '/var/lib/acme/eldiron/key.pem' | |
485 | ''; | |
486 | authentication = '' | |
487 | local all postgres ident | |
488 | local all all md5 | |
50d8fa14 | 489 | host all all samehost md5 |
a1bb33c4 IB |
490 | host all all 178.33.252.96/32 md5 |
491 | host all all 188.165.209.148/32 md5 | |
492 | #host all all all pam | |
493 | ''; | |
494 | }; | |
495 | }; | |
496 | } |