]> git.immae.eu Git - perso/Immae/Config/Nix.git/blobdiff - modules/private/databases/openldap/default.nix
Add openldap replication
[perso/Immae/Config/Nix.git] / modules / private / databases / openldap / default.nix
index 9f72b297df0383abff8ad15102133a8ac288fcd6..22f6f7b3de3b8b5d9223b6034b3a203c32cc6a1d 100644 (file)
@@ -2,22 +2,9 @@
 let
   cfg = config.myServices.databases.openldap;
   ldapConfig = let
-    kerberosSchema = pkgs.fetchurl {
-      url = "https://raw.githubusercontent.com/krb5/krb5/master/src/plugins/kdb/ldap/libkdb_ldap/kerberos.schema";
-      sha256 = "17fnkkf6s3lznsl7wp6914pqsc78d038rh38l638big8z608ksww";
-    };
-    puppetSchema = pkgs.fetchurl {
-      url = "https://raw.githubusercontent.com/puppetlabs/puppet/master/ext/ldap/puppet.schema";
-      sha256 = "11bjf5zfvqlim7p9vddcafs0wiq3v8ys77x8h6fbp9c6bdfh0awh";
-    };
+    eldiron_schemas = pkgs.callPackage ./eldiron_schemas.nix {};
   in ''
-    include         ${pkgs.openldap}/etc/schema/core.schema
-    include         ${pkgs.openldap}/etc/schema/cosine.schema
-    include         ${pkgs.openldap}/etc/schema/inetorgperson.schema
-    include         ${pkgs.openldap}/etc/schema/nis.schema
-    include         ${puppetSchema}
-    include         ${kerberosSchema}
-    include         ${./immae.schema}
+    ${eldiron_schemas}
 
     pidfile         ${cfg.pids.pid}
     argsfile        ${cfg.pids.args}
@@ -33,6 +20,10 @@ let
     directory       ${cfg.dataDir}
     overlay         memberof
 
+    moduleload      syncprov
+    overlay         syncprov
+    syncprov-checkpoint 100 10
+
     TLSCertificateFile    ${config.security.acme.directory}/ldap/cert.pem
     TLSCertificateKeyFile ${config.security.acme.directory}/ldap/key.pem
     TLSCACertificateFile  ${config.security.acme.directory}/ldap/fullchain.pem
@@ -126,14 +117,6 @@ in
     users.users.openldap.extraGroups = [ "keys" ];
     networking.firewall.allowedTCPPorts = [ 636 389 ];
 
-    services.cron = {
-      systemCronJobs = [
-        ''
-          35 1,13 * * * root ${pkgs.openldap}/bin/slapcat -v -b "dc=immae,dc=eu" -f ${pkgs.writeText "slapd.conf" ldapConfig} -l ${cfg.dataDir}/backup.ldif | ${pkgs.gnugrep}/bin/grep -v "^# id=[0-9a-f]*$"
-        ''
-      ];
-    };
-
     security.acme.certs."ldap" = config.myServices.databasesCerts // {
       user = "openldap";
       group = "openldap";