]> git.immae.eu Git - perso/Immae/Config/Nix.git/commitdiff
Move secrets to flakes
authorIsmaël Bouya <ismael.bouya@normalesup.org>
Wed, 13 Oct 2021 00:26:54 +0000 (02:26 +0200)
committerIsmaël Bouya <ismael.bouya@normalesup.org>
Fri, 15 Oct 2021 23:39:24 +0000 (01:39 +0200)
58 files changed:
flakes/private/openarc/flake.lock
flakes/private/openarc/flake.nix
flakes/private/opendmarc/flake.lock
flakes/private/opendmarc/flake.nix
flakes/secrets/flake.nix [new file with mode: 0644]
modules/default.nix
modules/duply_backup/default.nix
modules/private/buildbot/default.nix
modules/private/databases/mariadb.nix
modules/private/databases/mariadb_replication.nix
modules/private/databases/openldap/default.nix
modules/private/databases/openldap_replication.nix
modules/private/databases/postgresql.nix
modules/private/databases/redis.nix
modules/private/databases/redis_replication.nix
modules/private/dns.nix
modules/private/ftp.nix
modules/private/mail/milters.nix
modules/private/mail/postfix.nix
modules/private/monitoring/objects_backup-2.nix
modules/private/mpd.nix
modules/private/ssh/default.nix
modules/private/system.nix
modules/private/system/eldiron.nix
modules/private/system/monitoring-1.nix
modules/private/system/quatresaisons.nix
modules/private/system/quatresaisons/databases.nix
modules/private/tasks/default.nix
modules/private/websites/connexionswing/app/default.nix
modules/private/websites/default.nix
modules/private/websites/florian/app/default.nix
modules/private/websites/immae/temp.nix
modules/private/websites/ludivine/app/default.nix
modules/private/websites/piedsjaloux/app/default.nix
modules/private/websites/tools/cloud/default.nix
modules/private/websites/tools/dav/davical.nix
modules/private/websites/tools/dav/default.nix
modules/private/websites/tools/diaspora/default.nix
modules/private/websites/tools/ether/default.nix
modules/private/websites/tools/git/default.nix
modules/private/websites/tools/git/mantisbt.nix
modules/private/websites/tools/mail/default.nix
modules/private/websites/tools/mail/roundcubemail.nix
modules/private/websites/tools/mastodon/default.nix
modules/private/websites/tools/mgoblin/default.nix
modules/private/websites/tools/peertube/default.nix
modules/private/websites/tools/performance/default.nix
modules/private/websites/tools/tools/default.nix
modules/private/websites/tools/tools/dmarc_reports.nix
modules/private/websites/tools/tools/kanboard.nix
modules/private/websites/tools/tools/ldap.nix
modules/private/websites/tools/tools/shaarli.nix
modules/private/websites/tools/tools/ttrss.nix
modules/private/websites/tools/tools/wallabag.nix
modules/private/websites/tools/tools/webhooks.nix
modules/private/websites/tools/tools/yourls.nix
modules/secrets.nix [deleted file]
nixops/secrets

index f0f56c7126fb6c381004b7781ef5d4490bb39dc6..744d00240f38d4679cd29f3df93ef56a26794e49 100644 (file)
         "files-watcher": "files-watcher",
         "my-lib": "my-lib",
         "nix-lib": "nix-lib",
-        "openarc": "openarc"
+        "openarc": "openarc",
+        "secrets": "secrets"
+      }
+    },
+    "secrets": {
+      "locked": {
+        "narHash": "sha256-aRHKDVHDpnqpmgGhLGQxXwyTwmPuhUJTVcOLBYtY2ks=",
+        "path": "../../secrets",
+        "type": "path"
+      },
+      "original": {
+        "path": "../../secrets",
+        "type": "path"
       }
     }
   },
index 5c4b73cfeb83583d744d68973365cace139db684..b4ab4c8d410b39d0a871355248cf0b0e073b9ccd 100644 (file)
@@ -3,6 +3,10 @@
     path = "../../openarc";
     type = "path";
   };
+  inputs.secrets = {
+    path = "../../secrets";
+    type = "path";
+  };
   inputs.files-watcher = {
     path = "../../files-watcher";
     type = "path";
   inputs.nix-lib.url = "github:NixOS/nixpkgs";
 
   description = "Private configuration for openarc";
-  outputs = { self, nix-lib, my-lib, files-watcher, openarc }:
+  outputs = { self, nix-lib, my-lib, files-watcher, openarc, secrets }:
     let
       cfg = name': { config, lib, pkgs, name, ... }: {
         imports = [
           (my-lib.lib.withNarKey files-watcher "nixosModule")
           (my-lib.lib.withNarKey openarc "nixosModule")
-          #FIXME:
-          #(my-lib.lib.withNarKey secrets "nixosModule")
+          (my-lib.lib.withNarKey secrets "nixosModule")
         ];
         config = lib.mkIf (name == name') {
           services.openarc = {
index 121f51db5bb457ac8e3428ccd059f07e5e1fa105..bd5019c0e0e5649d6b52c1d7a1759cfddfdc6aac 100644 (file)
         "files-watcher": "files-watcher",
         "my-lib": "my-lib",
         "nix-lib": "nix-lib",
-        "opendmarc": "opendmarc"
+        "opendmarc": "opendmarc",
+        "secrets": "secrets"
+      }
+    },
+    "secrets": {
+      "locked": {
+        "narHash": "sha256-aRHKDVHDpnqpmgGhLGQxXwyTwmPuhUJTVcOLBYtY2ks=",
+        "path": "../../secrets",
+        "type": "path"
+      },
+      "original": {
+        "path": "../../secrets",
+        "type": "path"
       }
     }
   },
index debcfbda9d106cde115dcf811f771fef24c8abbe..2b73070f5df0cde63ca46aa2eaf9ddcb2acff151 100644 (file)
@@ -3,6 +3,10 @@
     path = "../../opendmarc";
     type = "path";
   };
+  inputs.secrets = {
+    path = "../../secrets";
+    type = "path";
+  };
   inputs.files-watcher = {
     path = "../../files-watcher";
     type = "path";
   inputs.nix-lib.url = "github:NixOS/nixpkgs";
 
   description = "Private configuration for opendmarc";
-  outputs = { self, nix-lib, opendmarc, my-lib, files-watcher }:
+  outputs = { self, nix-lib, opendmarc, my-lib, files-watcher, secrets }:
     let
       cfg = name': { config, lib, pkgs, name, ... }: {
         imports = [
           (my-lib.lib.withNarKey files-watcher "nixosModule")
           (my-lib.lib.withNarKey opendmarc "nixosModule")
-          #FIXME:
-          #(my-lib.lib.withNarKey secrets "nixosModule")
+          (my-lib.lib.withNarKey secrets "nixosModule")
         ];
         config = lib.mkIf (name == name') {
           users.users."${config.services.opendmarc.user}".extraGroups = [ "keys" ];
diff --git a/flakes/secrets/flake.nix b/flakes/secrets/flake.nix
new file mode 100644 (file)
index 0000000..0ee6a40
--- /dev/null
@@ -0,0 +1,124 @@
+{
+  description = "Secrets handling";
+
+  outputs = { self }: {
+    nixosModule = { config, lib, pkgs, ... }: {
+      options.secrets = with lib; {
+        keys = mkOption {
+          type = types.listOf types.unspecified;
+          default = [];
+          description = "Keys to upload to server";
+        };
+        gpgKeys = mkOption {
+          type = types.listOf types.path;
+          default = [];
+          description = "GPG public keys files to encrypt to";
+        };
+        ageKeys = mkOption {
+          type = types.listOf types.str;
+          default = [];
+          description = "AGE keys to encrypt to";
+        };
+        decryptKey = mkOption {
+          type = types.str;
+          default = "/etc/ssh/ssh_host_ed25519_key";
+          description = "ed25519 key used to decrypt with AGE";
+        };
+        location = mkOption {
+          type = types.path;
+          default = "/var/secrets";
+          description = "Location where to put the keys";
+        };
+        secretsVars = mkOption {
+          type = types.path;
+          description = "Location where the secrets variables are defined, to be used to fill the templates in secrets";
+        };
+        deleteSecretsVars = mkOption {
+          type = types.bool;
+          default = false;
+          description = "Delete secrets file after deployment";
+        };
+        # Read-only variables
+        fullPaths = mkOption {
+          type = types.attrsOf types.path;
+          default = builtins.listToAttrs
+            (map (v: { name = v.dest; value = "${config.secrets.location}/${v.dest}"; }) config.secrets.keys);
+          readOnly = true;
+          description = "set of full paths to secrets";
+        };
+      };
+
+      config = let
+        location = config.secrets.location;
+        keys = config.secrets.keys;
+        empty = pkgs.runCommand "empty" { preferLocalBuild = true; } "mkdir -p $out && touch $out/done";
+        fpath = v: "secrets/${v.dest}${lib.optionalString (v.isTemplated or true) ".gucci.tpl"}";
+        dumpKey = v:
+          if v.isDir or false then
+            ''
+              mkdir -p secrets/${v.dest}
+              cat >> mods <<EOF
+              ${v.user or "root"} ${v.group or "root"} ${v.permissions or "0600"} secrets/${v.dest}
+              EOF
+            ''
+          else ''
+            mkdir -p secrets/$(dirname ${v.dest})
+            echo -n ${lib.strings.escapeShellArg v.text} > ${fpath v}
+            cat >> mods <<EOF
+            ${v.user or "root"} ${v.group or "root"} ${v.permissions or "0600"} ${fpath v}
+            EOF
+            '';
+        secrets = pkgs.runCommand "secrets.tar.enc" {
+          buildInputs = [ pkgs.gnupg pkgs.sops ];
+          } ''
+          touch mods
+          tar --format=ustar --mtime='1970-01-01' -P --transform="s@${empty}@secrets@" -cf $out ${empty}/done
+          ${builtins.concatStringsSep "\n" (map dumpKey keys)}
+          cat mods | while read u g p k; do
+          tar --no-recursion --format=ustar --mtime='1970-01-01' --owner="$u" --group="$g" --mode="$p" --append -f $out "$k"
+          done
+          export HOME=$(pwd)
+          fingerprints=
+          for key in ${builtins.concatStringsSep " " config.secrets.gpgKeys}; do
+            gpg --import $key 2>/dev/null
+            fingerprints=$fingerprints,$(cat $key | gpg --with-colons --import-options show-only --import 2>/dev/null | grep ^fpr | cut -d: -f10 | head -n1)
+          done
+
+          sops --age ${builtins.concatStringsSep "," config.secrets.ageKeys} --pgp ''${fingerprints#,} --input-type binary -i -e $out 2>/dev/null
+          '';
+        pathChmodExcl =
+          let
+            dirs = builtins.filter (v: v.isDir or false) keys;
+            exclPath = builtins.concatStringsSep " -o " (map (d: " -path $TMP/${d.dest}") dirs);
+          in
+            lib.optionalString (builtins.length dirs > 0) " -not \\( ${exclPath} \\) ";
+      in lib.mkIf (builtins.length keys > 0) {
+        system.activationScripts.secrets = {
+          deps = [ "users" "wrappers" ];
+          text = ''
+            install -m0750 -o root -g keys -d ${location}
+            TMP=$(${pkgs.coreutils}/bin/mktemp -d)
+            TMPWORK=$(${pkgs.coreutils}/bin/mktemp -d)
+            chmod go-rwx $TMPWORK
+            if [ -n "$TMP" -a -n "$TMPWORK" ]; then
+              install -m0750 -o root -g keys -d $TMP
+              ${pkgs.ssh-to-age}/bin/ssh-to-age -private-key -i ${config.secrets.decryptKey} -o $TMPWORK/keys.txt
+              SOPS_AGE_KEY_FILE=$TMPWORK/keys.txt ${pkgs.sops}/bin/sops -d ${secrets} | ${pkgs.gnutar}/bin/tar --strip-components 1 -C $TMP -x
+              if [ -f ${config.secrets.secretsVars} ]; then
+                SOPS_AGE_KEY_FILE=$TMPWORK/keys.txt ${pkgs.sops}/bin/sops -d ${config.secrets.secretsVars} > $TMPWORK/vars.yml
+              fi
+              if [ -f $TMPWORK/vars.yml ]; then
+                find $TMP -name "*.gucci.tpl" -exec \
+                  /bin/sh -c 'f="{}"; ${pkgs.gucci}/bin/gucci -f '$TMPWORK'/vars.yml "$f" > "''${f%.gucci.tpl}"; touch --reference "$f" ''${f%.gucci.tpl} ; chmod --reference="$f" ''${f%.gucci.tpl} ; chown --reference="$f" ''${f%.gucci.tpl}' \;
+              fi
+              find $TMP -type d ${pathChmodExcl}-exec chown root:keys {} \; -exec chmod o-rx {} \;
+              ${pkgs.rsync}/bin/rsync --exclude="*.gucci.tpl" -O -c -av --delete $TMP/ ${location}
+              rm -rf $TMP $TMPWORK ${lib.optionalString config.secrets.deleteSecretsVars config.secrets.secretsVars}
+            fi
+          '';
+        };
+
+      };
+    };
+  };
+}
index b6ac68a117c833477dafe1653ccb8e21043c0f40..cb2e7d99e76c13730757dea41f88d45c57d20a78 100644 (file)
@@ -4,7 +4,7 @@ let
 in
 {
   myids = (flakeCompat ../flakes/myuids).nixosModule;
-  secrets = ./secrets.nix;
+  secrets = flakeLib.withNarKeyCompat flakeCompat ../flakes/secrets "nixosModule";
   filesWatcher = flakeLib.withNarKeyCompat flakeCompat ../flakes/files-watcher "nixosModule";
 
   webstats = ./webapps/webstats;
index 88245a2a023f1933d5452732f38c9383e1f19602..7034a91fe0dc4b3d96e49eae5c987e1c91e1fe7f 100644 (file)
@@ -87,6 +87,11 @@ in
           dest = "backup/${varName k remote}/exclude";
           text = v.excludeFile;
         }
+        {
+          permissions = "0500";
+          dest = "backup/${varName k remote}";
+          isDir = true;
+        }
     ]) v.remotes) config.services.duplyBackup.profiles);
 
     services.cron = {
@@ -99,7 +104,7 @@ in
             map (remote: [
             ''
               touch ${varDir}/${varName k remote}.log
-              ${pkgs.duply}/bin/duply ${config.secrets.location}/backup/${varName k remote}/ ${action} --force >> ${varDir}/${varName k remote}.log
+              ${pkgs.duply}/bin/duply ${config.secrets.fullPaths."backup/${varName k remote}"}/ ${action} --force >> ${varDir}/${varName k remote}.log
               [[ $? = 0 ]] || echo -e "Error when doing backup for ${varName k remote}, see above\n---------------------------------------" >&2
             ''
             ]) v.remotes
index ea0bef682c5a65ac50fbf9053a04115fd744c8ee..903f453094c3041695b4c68fa5f826ffb207f61b 100644 (file)
@@ -42,7 +42,7 @@ in
     };
 
     services.websites.env.tools.watchPaths = lib.attrsets.mapAttrsToList
-      (k: project: "/var/secrets/buildbot/${project.name}/webhook-httpd-include")
+      (k: project: config.secrets.fullPaths."buildbot/${project.name}/webhook-httpd-include")
       config.myEnv.buildbot.projects;
 
     services.websites.env.tools.vhostConfs.git.extraConfig = lib.attrsets.mapAttrsToList (k: project: ''
@@ -62,7 +62,7 @@ in
           <RequireAny>
             Require local
             Require ldap-group cn=users,ou=${project.name},cn=buildbot,ou=services,dc=immae,dc=eu
-            Include /var/secrets/buildbot/${project.name}/webhook-httpd-include
+            Include ${config.secrets.fullPaths."buildbot/${project.name}/webhook-httpd-include"}
           </RequireAny>
         </Location>
         '') config.myEnv.buildbot.projects;
@@ -146,11 +146,11 @@ in
     services.filesWatcher = lib.attrsets.mapAttrs' (k: project: lib.attrsets.nameValuePair "buildbot-${project.name}" {
       restart = true;
       paths = [
-        "/var/secrets/buildbot/ldap"
-        "/var/secrets/buildbot/worker_password"
-        "/var/secrets/buildbot/ssh_key"
-        "/var/secrets/buildbot/${project.name}/environment_file"
-      ] ++ lib.attrsets.mapAttrsToList (k: v: "/var/secrets/buildbot/${project.name}/${k}") project.secrets;
+        config.secrets.fullPaths."buildbot/ldap"
+        config.secrets.fullPaths."buildbot/worker_password"
+        config.secrets.fullPaths."buildbot/ssh_key"
+        config.secrets.fullPaths."buildbot/${project.name}/environment_file"
+      ] ++ lib.attrsets.mapAttrsToList (k: v: config.secrets.fullPaths."buildbot/${project.name}/${k}") project.secrets;
     }) config.myEnv.buildbot.projects;
 
     systemd.slices.buildbot = {
@@ -206,13 +206,13 @@ in
       fi
       ln -sf ${tac_file} ${varDir}/${project.name}/buildbot.tac
       # different buildbots may be trying that simultaneously, add the || true to avoid complaining in case of race
-      install -Dm600 -o buildbot -g buildbot -T /var/secrets/buildbot/ssh_key ${varDir}/buildbot_key || true
+      install -Dm600 -o buildbot -g buildbot -T ${config.secrets.fullPaths."buildbot/ssh_key"} ${varDir}/buildbot_key || true
       buildbot_secrets=${varDir}/${project.name}/secrets
       install -m 0700 -o buildbot -g buildbot -d $buildbot_secrets
-      install -Dm600 -o buildbot -g buildbot -T /var/secrets/buildbot/ldap $buildbot_secrets/ldap
-      install -Dm600 -o buildbot -g buildbot -T /var/secrets/buildbot/worker_password $buildbot_secrets/worker_password
+      install -Dm600 -o buildbot -g buildbot -T ${config.secrets.fullPaths."buildbot/ldap"} $buildbot_secrets/ldap
+      install -Dm600 -o buildbot -g buildbot -T ${config.secrets.fullPaths."buildbot/worker_password"} $buildbot_secrets/worker_password
       ${builtins.concatStringsSep "\n" (lib.attrsets.mapAttrsToList
-        (k: v: "install -Dm600 -o buildbot -g buildbot -T /var/secrets/buildbot/${project.name}/${k} $buildbot_secrets/${k}") project.secrets
+        (k: v: "install -Dm600 -o buildbot -g buildbot -T ${config.secrets.fullPaths."buildbot/${project.name}/${k}"} $buildbot_secrets/${k}") project.secrets
       )}
       ${buildbot}/bin/buildbot upgrade-master ${varDir}/${project.name}
       '';
@@ -247,7 +247,7 @@ in
         SupplementaryGroups = "keys";
         WorkingDirectory = "${varDir}/${project.name}";
         ExecStart = "${buildbot}/bin/buildbot start";
-        EnvironmentFile = "/var/secrets/buildbot/${project.name}/environment_file";
+        EnvironmentFile = config.secrets.fullPaths."buildbot/${project.name}/environment_file";
       };
     }) config.myEnv.buildbot.projects;
   };
index 36edaeb4ad5e52a8ef040c3afc775e6f8c5b5f08..75ea747147896437ad6480a2159a52a0e19f31e6 100644 (file)
@@ -169,14 +169,14 @@ in {
       mysql = {
         text = ''
           # https://mariadb.com/kb/en/mariadb/pam-authentication-plugin/
-          auth    required ${pam_ldap} config=${config.secrets.location}/mysql/pam
-          account required ${pam_ldap} config=${config.secrets.location}/mysql/pam
+          auth    required ${pam_ldap} config=${config.secrets.fullPaths."mysql/pam"}
+          account required ${pam_ldap} config=${config.secrets.fullPaths."mysql/pam"}
           '';
       };
       mysql_replication = {
         text = ''
-          auth    required ${pam_ldap} config=${config.secrets.location}/mysql/pam_replication
-          account required ${pam_ldap} config=${config.secrets.location}/mysql/pam_replication
+          auth    required ${pam_ldap} config=${config.secrets.fullPaths."mysql/pam_replication"}
+          account required ${pam_ldap} config=${config.secrets.fullPaths."mysql/pam_replication"}
           '';
       };
     };
index b89c764ec536d6e012a82b4aaeebcdd2c3e6ba85..e857c416d1d6ba638b7dd3148246eb6958ef2183 100644 (file)
@@ -140,7 +140,7 @@ in
 
               filename=${backupDir}/$(${pkgs.coreutils}/bin/date -Iminutes).sql
               ${hcfg.package}/bin/mysqldump \
-                --defaults-file=${config.secrets.location}/mysql_replication/${name}/mysqldump \
+                --defaults-file=${config.secrets.fullPaths."mysql_replication/${name}/mysqldump"} \
                 -S /run/mysqld_${name}/mysqld.sock \
                 --gtid \
                 --master-data \
@@ -194,7 +194,7 @@ in
           if ! test -e ${dataDir}/mysql; then
             if ! test -e ${dataDir}/initial.sql; then
               ${hcfg.package}/bin/mysqldump \
-                --defaults-file=${config.secrets.location}/mysql_replication/${name}/mysqldump_remote \
+                --defaults-file=${config.secrets.fullPaths."mysql_replication/${name}/mysqldump_remote"} \
                 -h ${hcfg.host} \
                 -P ${hcfg.port} \
                 --ssl \
@@ -235,7 +235,7 @@ in
                   cat \
                     ${sql_before} \
                     ${dataDir}/initial.sql \
-                    ${config.secrets.location}/mysql_replication/${name}/slave_init_commands \
+                    ${config.secrets.fullPaths."mysql_replication/${name}/slave_init_commands"} \
                     | ${hcfg.package}/bin/mysql \
                     --defaults-file=/etc/mysql/${name}_my.cnf \
                     -S /run/mysqld_${name}/mysqld.sock \
index e00f4c2af03b4201196224c2e4d150bc6c2e309e..f4851b5f885a09d3d98ff6994526619b873f2897 100644 (file)
@@ -98,7 +98,14 @@ in
         permissions = "0400";
         user = "openldap";
         group = "openldap";
-        text = builtins.readFile "${cfg.accessFile}";
+        text = builtins.readFile cfg.accessFile;
+      }
+      {
+        dest = "ldap";
+        permissions = "0500";
+        user = "openldap";
+        group = "openldap";
+        isDir = true;
       }
     ];
     users.users.openldap.extraGroups = [ "keys" ];
@@ -115,7 +122,7 @@ in
 
     services.filesWatcher.openldap = {
       restart = true;
-      paths = [ "${config.secrets.location}/ldap/" ];
+      paths = [ config.secrets.fullPaths."ldap" ];
     };
 
     services.openldap = {
@@ -132,9 +139,9 @@ in
         overlay         syncprov
         syncprov-checkpoint 100 10
 
-        include ${config.secrets.location}/ldap/access
+        include ${config.secrets.fullPaths."ldap/access"}
         '';
-      rootpwFile = "${config.secrets.location}/ldap/password";
+      rootpwFile = config.secrets.fullPaths."ldap/password";
       suffix = cfg.baseDn;
       rootdn = cfg.rootDn;
       database = "hdb";
index df4101be7c7e3398f10db7cd48fadca46b1d1256..350eecfc2a02a41de3d02b102dc6e72473a4acac 100644 (file)
@@ -23,7 +23,7 @@ let
     index   uid               pres,eq
     index   entryUUID         eq
 
-    include ${config.secrets.location}/openldap_replication/${name}/replication_config
+    include ${config.secrets.fullPaths."openldap_replication/${name}/replication_config"}
     '';
 in
 {
index c442a63c01b727913b41f5e275c130fd918497db..e73bf69eb7f78b5c73e6d2727b10fc8818ce0735 100644 (file)
@@ -214,14 +214,14 @@ in {
     in {
       postgresql = {
         text = ''
-          auth    required ${pam_ldap} config=${config.secrets.location}/postgresql/pam
-          account required ${pam_ldap} config=${config.secrets.location}/postgresql/pam
+          auth    required ${pam_ldap} config=${config.secrets.fullPaths."postgresql/pam"}
+          account required ${pam_ldap} config=${config.secrets.fullPaths."postgresql/pam"}
           '';
       };
       postgresql_replication = {
         text = ''
-          auth    required ${pam_ldap} config=${config.secrets.location}/postgresql/pam_replication
-          account required ${pam_ldap} config=${config.secrets.location}/postgresql/pam_replication
+          auth    required ${pam_ldap} config=${config.secrets.fullPaths."postgresql/pam_replication"}
+          account required ${pam_ldap} config=${config.secrets.fullPaths."postgresql/pam_replication"}
           '';
       };
     };
index bc6460ffa2405e2f94d213d3c78ece883ada78fd..5c5b8b032dac4ba58a907204d3c3967538e4ea15 100644 (file)
@@ -49,7 +49,7 @@ in {
         decrypt = true;
         source = "0.0.0.0:16379";
         target = "/run/redis/redis.sock";
-        keyfile = "${config.secrets.location}/redis/spiped_keyfile";
+        keyfile = config.secrets.fullPaths."redis/spiped_keyfile";
       };
     };
     systemd.services.spiped_redis = {
@@ -70,7 +70,7 @@ in {
 
     services.filesWatcher.predixy = {
       restart = true;
-      paths = [ "${config.secrets.location}/redis/predixy.conf" ];
+      paths = [ config.secrets.fullPaths."redis/predixy.conf" ];
     };
 
     networking.firewall.allowedTCPPorts = [ 7617 16379 ];
@@ -126,7 +126,7 @@ in {
         SupplementaryGroups = "keys";
         Type = "simple";
 
-        ExecStart = "${pkgs.predixy}/bin/predixy ${config.secrets.location}/redis/predixy.conf";
+        ExecStart = "${pkgs.predixy}/bin/predixy ${config.secrets.fullPaths."redis/predixy.conf"}";
       };
 
     };
index a3fe3bb775f0f412d846bc80f7b9049035fe38f6..3caa7e95af413fac62b330428fd8c7a1a500657c 100644 (file)
@@ -64,7 +64,7 @@ in
         encrypt = true;
         source = "127.0.0.1:16379";
         target = "${config.myEnv.servers.eldiron.ips.main.ip4}:16379";
-        keyfile = "${config.secrets.location}/redis/spiped_eldiron_keyfile";
+        keyfile = config.secrets.fullPaths."redis/spiped_eldiron_keyfile";
       };
     };
 
@@ -162,7 +162,7 @@ in
         unitConfig.RequiresMountsFor = dataDir;
 
         serviceConfig = {
-          ExecStart = "${hcfg.package}/bin/redis-server ${config.secrets.location}/redis_replication/${name}/config";
+          ExecStart = "${hcfg.package}/bin/redis-server ${config.secrets.fullPaths."redis_replication/${name}/config"}";
           User = "redis";
           RuntimeDirectory = "redis_${name}";
         };
index 7c59b43a0463568ad38f11d06fd081aa5b53b0b1..32c52a9f8575673fe7b4e0ef6428d71f5bce5512 100644 (file)
@@ -10,7 +10,7 @@
         ) listOfAttrs
       ) [{}] (attrNames attrsOfLists);
     cfg = config.services.bind;
-    keyIncludes = builtins.concatStringsSep "\n" (map (v: "include \"/var/secrets/bind/${v}.key\";") (builtins.attrNames config.myEnv.dns.keys));
+    keyIncludes = builtins.concatStringsSep "\n" (map (v: "include \"${config.secrets.fullPaths."bind/${v}.key"}\";") (builtins.attrNames config.myEnv.dns.keys));
     cartProduct = lib.foldr
       (s: servers: servers // { ${s.masters} = lib.unique ((servers.${s.masters} or []) ++ [s.keys]); })
       {}
index 233031a05ed335534dca26303e82927da2602b18..07db0f4b129bc0832acb1fc0ad63d80f50492165 100644 (file)
@@ -75,7 +75,7 @@ in
 
     services.filesWatcher.pure-ftpd = {
       restart = true;
-      paths = [ "/var/secrets/pure-ftpd-ldap" ];
+      paths = [ config.secrets.fullPaths."pure-ftpd-ldap" ];
     };
 
     systemd.services.pure-ftpd = let
@@ -94,7 +94,7 @@ in
         SyslogFacility               ftp
         DontResolve                  yes
         MaxIdleTime                  15
-        LDAPConfigFile               /var/secrets/pure-ftpd-ldap
+        LDAPConfigFile               ${config.secrets.fullPaths."pure-ftpd-ldap"}
         LimitRecursion               10000 8
         AnonymousCanCreateDirs       no
         MaxLoad                      4
index 4291993351a723d246abdd321ccc28c59766b0f4..172e216069e5142db5f46d0f746847cd731d35d0 100644 (file)
   };
   config = lib.mkIf (config.myServices.mail.enable || config.myServices.mailBackup.enable) {
     secrets.keys = [
+      {
+        dest = "opendkim";
+        isDir = true;
+        user = config.services.opendkim.user;
+        group = config.services.opendkim.group;
+        permissions = "0550";
+      }
       {
         dest = "opendkim/eldiron.private";
         user = config.services.opendkim.user;
@@ -45,7 +52,7 @@
         )
         config.myEnv.dns.masterZones
       ));
-      keyPath = "${config.secrets.location}/opendkim";
+      keyPath = config.secrets.fullPaths."opendkim";
       selector = "eldiron";
       configFile = pkgs.writeText "opendkim.conf" ''
         SubDomains        yes
index 70c3f466f7376b204e62f32319bd008c3d4a255c..de5e59d71d41b7d91016057102642f69d7d9b7f7 100644 (file)
           fi
           '';
         scripts = lib.attrsets.mapAttrs (n: v:
-          toScript n (pkgs.callPackage (builtins.fetchGit { url = v.src.url; ref = "master"; rev = v.src.rev; }) { scriptEnv = "/var/secrets/postfix/scripts/${n}-env"; })
+          toScript n (pkgs.callPackage (builtins.fetchGit { url = v.src.url; ref = "master"; rev = v.src.rev; }) { scriptEnv = config.secrets.fullPaths."postfix/scripts/${n}-env"; })
         ) config.myEnv.mail.scripts // {
           testmail = pkgs.writeScript "testmail" ''
             #! ${pkgs.stdenv.shell}
index a930a7d7884fa24e7a482db7330e414305b8aec6..28032a477dea0e578758db67ea1240b8472372c0 100644 (file)
@@ -62,7 +62,7 @@ in
       passiveInfo = defaultPassiveInfo // { servicegroups = "webstatus-databases"; };
       service_description = "Mysql replication for eldiron is up to date";
       use = "local-service";
-      check_command = ["check_mysql_replication" "/run/mysqld_eldiron/mysqld.sock" "/var/secrets/mysql_replication/eldiron/client"];
+      check_command = ["check_mysql_replication" "/run/mysqld_eldiron/mysqld.sock" config.secrets.fullPaths."mysql_replication/eldiron/client"];
     }
     {
       passiveInfo = defaultPassiveInfo // { servicegroups = "webstatus-databases,webstatus-backup"; };
@@ -96,7 +96,7 @@ in
         "check_openldap_replication"
         hcfg.url
         hcfg.dn
-        "${config.secrets.location}/openldap_replication/eldiron/replication_password"
+        config.secrets.fullPaths."openldap_replication/eldiron/replication_password"
         hcfg.base
         ldapConfig
       ];
index 1e6e666d978f6881a70f92f3aca66d04030e831e..f2e87bb8006c1152fec3f6f6583fba251e7e69ed 100644 (file)
@@ -26,7 +26,7 @@
     systemd.services.mpd.serviceConfig.RuntimeDirectory = "mpd";
     services.filesWatcher.mpd = {
       restart = true;
-      paths = [ "/var/secrets/mpd-config" ];
+      paths = [ config.secrets.fullPaths."mpd-config" ];
     };
 
     services.mpd = {
@@ -34,7 +34,7 @@
       network.listenAddress = "any";
       musicDirectory = config.myEnv.mpd.folder;
       extraConfig = ''
-        include "/var/secrets/mpd-config"
+        include "${config.secrets.fullPaths."mpd-config"}"
         audio_output {
           type            "null"
           name            "No Output"
index aea3ac0e79d1554b2fe70d6d4d1308d4c12d02e9..ca9b6fc34d525fb3258788a107c60c729cb9ed3a 100644 (file)
@@ -61,7 +61,7 @@ in
     system.activationScripts.sshd = {
       deps = [ "secrets" ];
       text = ''
-      install -Dm400 -o nobody -g nogroup -T /var/secrets/ssh-ldap /etc/ssh/ldap_password
+      install -Dm400 -o nobody -g nogroup -T ${config.secrets.fullPaths."ssh-ldap"} /etc/ssh/ldap_password
       '';
     };
     # ssh is strict about parent directory having correct rights, don't
index c7e277c4bb7313efdd72e57bc2b57a2c234ed8b2..8be7368d8d4a2e306f8307c691948062feeb0962 100644 (file)
@@ -1,6 +1,14 @@
 { pkgs, lib, config, name, nodes, ... }:
 {
   config = {
+    deployment.secrets."secret_vars.yml" = {
+      source = builtins.toString ../../nixops/secrets/vars.yml;
+      destination = config.secrets.secretsVars;
+      owner.user = "root";
+      owner.group = "root";
+      permissions = "0400";
+    };
+
     networking.extraHosts = builtins.concatStringsSep "\n"
       (lib.mapAttrsToList (n: v: "${v.config.hostEnv.ips.main.ip4} ${n}") nodes);
 
@@ -9,6 +17,7 @@
     secrets.gpgKeys = [
       ../../nixops/public_keys/Immae.pub
     ];
+    secrets.secretsVars = "/run/keys/vars.yml";
 
     services.openssh.enable = true;
 
index 6c570c8b2dcda93a797f14909d73c00d3b25215c..0830f185e3edf41a8156336f81d9330e8d7b1696 100644 (file)
   services.netdata.config.health."enabled" = "no";
   services.netdata.config.web.mode = "none";
   users.users."${config.services.netdata.user}".extraGroups = [ "keys" ];
-  environment.etc."netdata/stream.conf".source = "/var/secrets/netdata-stream.conf";
+  environment.etc."netdata/stream.conf".source = config.secrets.fullPaths."netdata-stream.conf";
   secrets.keys = [
     {
       dest = "netdata-stream.conf";
index e335080b88d66fda0163e86583215114b5f3aa5c..91d30fdbb7b31111924d89826e8db80c2ebdf11e 100644 (file)
@@ -43,7 +43,7 @@
   services.netdata.config.web."allow netdata.conf from" = "fd*";
   services.netdata.config.web."allow management from" = "fd*";
   networking.firewall.allowedTCPPorts = [ 19999 ];
-  environment.etc."netdata/stream.conf".source = "/var/secrets/netdata-stream.conf";
+  environment.etc."netdata/stream.conf".source = config.secrets.fullPaths."netdata-stream.conf";
 
   secrets.keys = [
     {
index 01486501760704c6a6ef073a44969bbf228b4f86..491e215eb180e18d7925dc84245e090203ca338e 100644 (file)
@@ -53,7 +53,7 @@ let
       chmod go-rwx /var/lib/nixos/sponsored_users
       echo "$mygroup $1 $2" >> /var/lib/nixos/sponsored_users
       (${pkgs.openldap}/bin/ldapadd -c -D cn=root,dc=salle-s,dc=org \
-        -y /var/secrets/ldap/sync_password 2>/dev/null >/dev/null || true) <<EOF
+        -y ${config.secrets.fullPaths."ldap/sync_password"} 2>/dev/null >/dev/null || true) <<EOF
     dn: uid=$1,uid=$mygroup,ou=users,dc=salle-s,dc=org
     objectClass: inetOrgPerson
     cn: $1
@@ -74,7 +74,7 @@ let
         userdel -r "$1"
         sed -i -e "/^$mygroup $1/d" /var/lib/nixos/sponsored_users
         ${pkgs.openldap}/bin/ldapdelete -D cn=root,dc=salle-s,dc=org \
-          -y /var/secrets/ldap/sync_password \
+          -y ${config.secrets.fullPaths."ldap/sync_password"} \
           "uid=$1,uid=$mygroup,ou=users,dc=salle-s,dc=org"
         echo "deleted"
         exit 0
@@ -103,7 +103,7 @@ let
       if [ "$1" = "$mygroup" ]; then
         log "resets web password"
         ${pkgs.openldap}/bin/ldappasswd -D cn=root,dc=salle-s,dc=org \
-          -y /var/secrets/ldap/sync_password \
+          -y ${config.secrets.fullPaths."ldap/sync_password"} \
           -S "uid=$mygroup,ou=users,dc=salle-s,dc=org"
       else
         IFS=",";
@@ -111,7 +111,7 @@ let
         if [ "$u" = "$1" ]; then
           log "resets web password of $1"
           ${pkgs.openldap}/bin/ldappasswd -D cn=root,dc=salle-s,dc=org \
-            -y /var/secrets/ldap/sync_password \
+            -y ${config.secrets.fullPaths."ldap/sync_password"} \
             -S "uid=$1,uid=$mygroup,ou=users,dc=salle-s,dc=org"
           exit 0
         fi
@@ -221,10 +221,10 @@ in
     deps = [ "secrets" "users" ];
     text =
       let
-        com = "-D cn=root,dc=salle-s,dc=org -y /var/secrets/ldap/sync_password";
+        com = "-D cn=root,dc=salle-s,dc=org -y ${config.secrets.fullPaths."ldap/sync_password"}";
       in ''
       # Add users
-      ${pkgs.openldap}/bin/ldapadd -c ${com} -f /var/secrets/ldap/ldaptree.ldif 2>/dev/null >/dev/null || true
+      ${pkgs.openldap}/bin/ldapadd -c ${com} -f ${config.secrets.fullPaths."ldap/ldaptree.ldif"} 2>/dev/null >/dev/null || true
 
       # Remove obsolete users
       ${pkgs.openldap}/bin/ldapsearch -LLL ${com} -s one -b "ou=users,dc=salle-s,dc=org" "uid" |\
index 8748058d6856d3450d25cb716f3f8db7e876d865..68ce27424f5279c81f00ec678f2865cb9f59b210 100644 (file)
@@ -2,7 +2,7 @@
 {
   config = let
     serverSpecificConfig = config.myEnv.serverSpecific.quatresaisons;
-    phpLdapAdmin = pkgs.webapps.phpldapadmin.override { config = "/var/secrets/webapps/tools-ldap"; };
+    phpLdapAdmin = pkgs.webapps.phpldapadmin.override { config = config.secrets.fullPaths."webapps/tools-ldap"; };
   in {
     services.postgresql.enable = true;
     services.postgresql.package = pkgs.postgresql_12;
@@ -94,7 +94,7 @@
           by anonymous auth
           by * break
       '';
-      rootpwFile = "${config.secrets.location}/ldap/password";
+      rootpwFile = config.secrets.fullPaths."ldap/password";
       suffix = "dc=salle-s,dc=org";
       rootdn = "cn=root,dc=salle-s,dc=org";
       database = "hdb";
       group = "wwwrun";
       settings =
         let
-          basedir = builtins.concatStringsSep ":" [ phpLdapAdmin "/var/secrets/webapps/tools-ldap" ];
+          basedir = builtins.concatStringsSep ":" [ phpLdapAdmin config.secrets.fullPaths."webapps/tools-ldap" ];
         in {
           "listen.owner" = "wwwrun";
           "listen.group" = "wwwrun";
index a6783741658acb809ebc2b073a5446a1868bfca5..b3f1b7bb4c86ccc238e3097503ea92be5d544b30 100644 (file)
@@ -161,7 +161,7 @@ in {
         dateformat=${dateFormat}
       '';
     }) env.taskwarrior-web);
-    services.websites.env.tools.watchPaths = [ "/var/secrets/webapps/tools-taskwarrior-web" ];
+    services.websites.env.tools.watchPaths = [ config.secrets.fullPaths."webapps/tools-taskwarrior-web" ];
     services.websites.env.tools.modules = [ "proxy_fcgi" "sed" ];
     services.websites.env.tools.vhostConfs.task = {
       certName    = "eldiron";
@@ -176,7 +176,7 @@ in {
           <FilesMatch "\.php$">
             SetHandler "proxy:unix:${config.services.phpfpm.pools.tasks.socket}|fcgi://localhost"
           </FilesMatch>
-          Include /var/secrets/webapps/tools-taskwarrior-web
+          Include ${config.secrets.fullPaths."webapps/tools-taskwarrior-web"}
         </Directory>
         ''
         ''
@@ -328,7 +328,7 @@ in {
         after = [ "network.target" ];
         path = [ pkgs.taskwarrior ];
 
-        environment.TASKRC = "/var/secrets/webapps/tools-taskwarrior/${name}-taskrc";
+        environment.TASKRC = config.secrets.fullPaths."webapps/tools-taskwarrior/${name}-taskrc";
         environment.BUNDLE_PATH = "${taskwarrior-web.gems}/${taskwarrior-web.gems.ruby.gemPath}";
         environment.BUNDLE_GEMFILE = "${taskwarrior-web.gems.confFiles}/Gemfile";
         environment.LC_ALL = "fr_FR.UTF-8";
index 31e88db75028e3a7ca46492b50bf2b93e447e4d4..b14b03b99a3ccad92acc92929916f0583e8555e8 100644 (file)
@@ -1,6 +1,4 @@
-{ environment ? "prod"
-, varDir ? "/var/lib/connexionswing_${environment}"
-, secretsPath ? "/var/secrets/webapps/${environment}-connexionswing"
+{ environment, varDir, secretsPath
 , composerEnv, fetchurl, fetchgit, sources }:
 let
   app = composerEnv.buildPackage (
index 809f6159eb0dd035335af198557faf4402bb2798..8fb6a4d3054ba3cdd3b7592edb8fc76b772a1b4c 100644 (file)
@@ -52,7 +52,7 @@ let
           LDAPOpCacheTTL 600
         </IfModule>
 
-        Include /var/secrets/apache-ldap
+        Include ${config.secrets.fullPaths."apache-ldap"}
       '';
     };
     global = {
@@ -149,9 +149,9 @@ in
       };
     };
 
-    services.filesWatcher.httpdProd.paths = [ "/var/secrets/apache-ldap" ];
-    services.filesWatcher.httpdInte.paths = [ "/var/secrets/apache-ldap" ];
-    services.filesWatcher.httpdTools.paths = [ "/var/secrets/apache-ldap" ];
+    services.filesWatcher.httpdProd.paths = [ config.secrets.fullPaths."apache-ldap" ];
+    services.filesWatcher.httpdInte.paths = [ config.secrets.fullPaths."apache-ldap" ];
+    services.filesWatcher.httpdTools.paths = [ config.secrets.fullPaths."apache-ldap" ];
 
     services.websites.env.production = {
       enable = true;
index 2ef0e865e4df24b996408b4270113c1856e8323a..28a7ec18834d53a1eaa9e9d7e7f34a4146cab3c5 100644 (file)
@@ -1,6 +1,4 @@
-{ environment ? "prod"
-, varDir ? "/var/lib/tellesflorian_${environment}"
-, secretsPath ? "/var/secrets/webapps/${environment}-tellesflorian"
+{ environment, varDir, secretsPath
 , composerEnv, fetchurl, sources }:
 let
   app = composerEnv.buildPackage (
index fd54f5e0d86708383b6972b3684dcf2b28e534ab..85182834a7bce60deeff6f81ee4e6fd69b21862f 100644 (file)
@@ -56,7 +56,7 @@ in {
         exec ${pkgs.webapps.surfer}/bin/surfer-server ${varDir}
       '';
       serviceConfig = {
-        EnvironmentFile = "/var/secrets/webapps/surfer";
+        EnvironmentFile = config.secrets.fullPaths."webapps/surfer";
         User = "wwwrun";
         Group = "wwwrun";
         StateDirectory = "surfer";
index 6e751b0a593c368d09e1a979dda0d2f23f5a07d9..323b6e03e9a2a7f91c02f3643c9f1e33a151af2c 100644 (file)
@@ -1,6 +1,4 @@
-{ environment ? "prod"
-, varDir ? "/var/lib/ludivinecassal_${environment}"
-, secretsPath ? "/var/secrets/webapps/${environment}-ludivinecassal"
+{ environment, varDir, secretsPath
 , composerEnv, fetchurl, fetchgit, imagemagick, sass, ruby, sources }:
 let
   app = composerEnv.buildPackage (
index a3d48bd2ed6e184db3f02495cfc2597b353e1dd3..4525a1814555b4f0a07cf4c6cfcf9b3866e87329 100644 (file)
@@ -1,6 +1,4 @@
-{ environment ? "prod"
-, varDir ? "/var/lib/piedsjaloux_${environment}"
-, secretsPath ? "/var/secrets/webapps/${environment}-piedsjaloux"
+{ environment, varDir, secretsPath
 , composerEnv, fetchurl, fetchgit, sources }:
 let
   app = composerEnv.buildPackage (
index c3749402a74c2a86166565a34e8e6fdc8af472d5..471858a191fa96109d5d141e3779ae9adc68b4af 100644 (file)
@@ -157,7 +157,7 @@ in {
         ${builtins.concatStringsSep "\n" (lib.attrsets.mapAttrsToList (n: v:
           "install -D -m 0644 -o wwwrun -g wwwrun -T ${v} ${varDir}/config/${n}.json"
           ) confs)}
-        #install -D -m 0600 -o wwwrun -g wwwrun -T /var/secrets/webapps/tools-nextcloud ${varDir}/config/config.php
+        #install -D -m 0600 -o wwwrun -g wwwrun -T ${config.secrets.fullPaths."webapps/tools-nextcloud"} ${varDir}/config/config.php
       '';
     };
     # FIXME: add a warning when config.php changes
index 9d6cd2136b10d20b85c21e756b00a314b0e77106..eeac1b5643d97171665c518deecdf83ae6b0d059 100644 (file)
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, gettext, writeText, env, awl, davical }:
+{ stdenv, fetchurl, gettext, writeText, env, awl, davical, config }:
 rec {
   activationScript = {
     deps = [ "httpd" ];
@@ -65,7 +65,7 @@ rec {
       include('drivers_ldap.php');
     '';
   }];
-  webapp = davical.override { davical_config = "/var/secrets/webapps/dav-davical"; };
+  webapp = davical.override { davical_config = config.secrets.fullPaths."webapps/dav-davical"; };
   webRoot = "${webapp}/htdocs";
   apache = rec {
     user = "wwwrun";
@@ -110,7 +110,7 @@ rec {
   };
   phpFpm = rec {
     serviceDeps = [ "postgresql.service" "openldap.service" ];
-    basedir = builtins.concatStringsSep ":" [ webapp "/var/secrets/webapps/dav-davical" awl ];
+    basedir = builtins.concatStringsSep ":" [ webapp config.secrets.fullPaths."webapps/dav-davical" awl ];
     pool = {
       "listen.owner" = apache.user;
       "listen.group" = apache.group;
index f53cf5803567e16e1228a112662f49ac82458a95..c54e1524dc59ae2c0eed1b1f203d4e02d6fe76a7 100644 (file)
@@ -18,6 +18,7 @@ let
     davical = pkgs.callPackage ./davical.nix {
       env = config.myEnv.tools.davical;
       inherit (pkgs.webapps) davical awl;
+      inherit config;
     };
 
     cfg = config.myServices.websites.tools.dav;
index 5d2b19f27fa88d7affd70518961155f53ab10161..663fe88d143596be0eb9be82ccffa9068d8ee572 100644 (file)
@@ -17,6 +17,13 @@ in {
     users.users.diaspora.extraGroups = [ "keys" ];
 
     secrets.keys = [
+      {
+        dest = "webapps/diaspora";
+        isDir = true;
+        user = "diaspora";
+        group = "diaspora";
+        permissions = "0500";
+      }
       {
         dest = "webapps/diaspora/diaspora.yml";
         user = "diaspora";
@@ -146,7 +153,7 @@ in {
       package = pkgs.webapps.diaspora.override { ldap = true; };
       dataDir = "/var/lib/diaspora_immae";
       adminEmail = "diaspora@tools.immae.eu";
-      configDir = "/var/secrets/webapps/diaspora";
+      configDir = config.secrets.fullPaths."webapps/diaspora";
     };
 
     services.filesWatcher.diaspora = {
index 3350a4a1bd802599c88d1f4a767d8aba22a99bd1..64e411de5c72ac6e00d3c9f0757ae126c5106e3a 100644 (file)
@@ -166,9 +166,9 @@ in {
         p.ep_timesliderdiff
       ]);
       modules = [];
-      sessionKeyFile = "/var/secrets/webapps/tools-etherpad-sessionkey";
-      apiKeyFile = "/var/secrets/webapps/tools-etherpad-apikey";
-      configFile = "/var/secrets/webapps/tools-etherpad";
+      sessionKeyFile = config.secrets.fullPaths."webapps/tools-etherpad-sessionkey";
+      apiKeyFile = config.secrets.fullPaths."webapps/tools-etherpad-apikey";
+      configFile = config.secrets.fullPaths."webapps/tools-etherpad";
     };
 
     systemd.services.etherpad-lite.serviceConfig.SupplementaryGroups = "keys";
index 8b1afa86bcacbecfe61899f9185773f9702755b4..755bab005bbf8a1539094192fb94212821230297 100644 (file)
@@ -3,6 +3,7 @@ let
     mantisbt = pkgs.callPackage ./mantisbt.nix {
       inherit (pkgs.webapps) mantisbt_2 mantisbt_2-plugins;
       env = config.myEnv.tools.mantisbt;
+      inherit config;
     };
     gitweb = pkgs.callPackage ./gitweb.nix {
       gitoliteDir = config.myServices.gitolite.gitoliteDir;
index 9996d230140ab4b32e565d449af6ed03e6fcab52..e6a8da78314d1c3c7d6d98411fb29e0452246b28 100644 (file)
@@ -1,4 +1,4 @@
-{ env, mantisbt_2, mantisbt_2-plugins }:
+{ env, mantisbt_2, mantisbt_2-plugins, config }:
 rec {
   activationScript = {
     deps = [ "httpd" ];
@@ -46,7 +46,7 @@ rec {
       $g_ldap_organization = '${env.ldap.filter}';
     '';
   }];
-  webRoot = (mantisbt_2.override { mantis_config = "/var/secrets/webapps/tools-mantisbt"; }).withPlugins (p: [p.slack p.source-integration]);
+  webRoot = (mantisbt_2.override { mantis_config = config.secrets.fullPaths."webapps/tools-mantisbt"; }).withPlugins (p: [p.slack p.source-integration]);
   apache = rec {
     user = "wwwrun";
     group = "wwwrun";
@@ -75,7 +75,7 @@ rec {
   phpFpm = rec {
     serviceDeps = [ "postgresql.service" "openldap.service" ];
     basedir = builtins.concatStringsSep ":" (
-      [ webRoot "/var/secrets/webapps/tools-mantisbt" ]
+      [ webRoot config.secrets.fullPaths."webapps/tools-mantisbt" ]
       ++ webRoot.plugins);
     pool = {
       "listen.owner" = apache.user;
index 4636a6cbfbbcd6b1e31b4e45345089d68b0b16bf..033a58724e9b101eb6c85b77a528924ec64111c8 100644 (file)
@@ -3,6 +3,7 @@ let
   roundcubemail = pkgs.callPackage ./roundcubemail.nix {
     inherit (pkgs.webapps) roundcubemail;
     env = config.myEnv.tools.roundcubemail;
+    inherit config;
   };
   rainloop = pkgs.callPackage ./rainloop.nix {
     rainloop = pkgs.rainloop-community;
index bb7dee9eba1e97072bc3100f3042220a0ae7c56f..7d8e733918237c7f5e8b63489d9076343ef861ec 100644 (file)
@@ -1,4 +1,4 @@
-{ env, roundcubemail, apacheHttpd }:
+{ env, roundcubemail, apacheHttpd, config }:
 rec {
   varDir = "/var/lib/roundcubemail";
   activationScript = {
@@ -75,7 +75,7 @@ rec {
         $config['mime_types'] = '${apacheHttpd}/conf/mime.types';
     '';
   }];
-  webRoot = (roundcubemail.override { roundcube_config = "/var/secrets/webapps/tools-roundcube"; }).withPlugins (p: [ p.automatic_addressbook p.carddav p.contextmenu p.contextmenu_folder p.html5_notifier p.ident_switch p.message_highlight p.thunderbird_labels ]);
+  webRoot = (roundcubemail.override { roundcube_config = config.secrets.fullPaths."webapps/tools-roundcube"; }).withPlugins (p: [ p.automatic_addressbook p.carddav p.contextmenu p.contextmenu_folder p.html5_notifier p.ident_switch p.message_highlight p.thunderbird_labels ]);
   apache = rec {
     user = "wwwrun";
     group = "wwwrun";
@@ -99,7 +99,7 @@ rec {
   phpFpm = rec {
     serviceDeps = [ "postgresql.service" ];
     basedir = builtins.concatStringsSep ":" (
-      [ webRoot "/var/secrets/webapps/tools-roundcube" varDir ]
+      [ webRoot config.secrets.fullPaths."webapps/tools-roundcube" varDir ]
       ++ webRoot.plugins
       ++ webRoot.skins);
     pool = {
index 80d74318daef949fc1aa3eeeb080fbbdefe8dfc3..cea8710451db0e1ac6ccd65a4d2f7b394f327221 100644 (file)
@@ -62,7 +62,7 @@ in {
     }];
     services.mastodon = {
       enable = true;
-      configFile = "/var/secrets/webapps/tools-mastodon";
+      configFile = config.secrets.fullPaths."webapps/tools-mastodon";
       socketsPrefix = "live_immae";
       dataDir = "/var/lib/mastodon_immae";
     };
index 719d3d3595d9b59689661a81efbe83e63db8abcb..6d6a5a4deb0fab86dda0415de27ed14ca638ec15 100644 (file)
@@ -84,7 +84,7 @@ in {
     services.mediagoblin = {
       enable     = true;
       package    = pkgs.webapps.mediagoblin.withPlugins (p: [p.basicsearch]);
-      configFile = "/var/secrets/webapps/tools-mediagoblin";
+      configFile = config.secrets.fullPaths."webapps/tools-mediagoblin";
     };
     services.filesWatcher.mediagoblin-web = {
       restart = true;
index d2cbe406e1ba1f6397a2ab7ec503b817f1fcd586..7dcc9985124551cd1c08b926c7d2935cbf9a7572 100644 (file)
@@ -14,7 +14,7 @@ in {
     };
     services.peertube = {
       enable = true;
-      configFile = "/var/secrets/webapps/tools-peertube";
+      configFile = config.secrets.fullPaths."webapps/tools-peertube";
     };
     users.users.peertube.extraGroups = [ "keys" ];
 
index df2b58d36b7c15c620e4fd696cec32867c03ad1a..5afd639dfb7fed82c776a016574be4896c295c9e 100644 (file)
@@ -80,7 +80,7 @@ in
         "pm.min_spare_servers" = "1";
         "pm.max_spare_servers" = "10";
 
-        "php_admin_value[open_basedir]" = "${package}:/tmp:/var/secrets/status_engine_ui";
+        "php_admin_value[open_basedir]" = "${package}:/tmp:${config.secrets.fullPaths."status_engine_ui"}";
       };
       phpPackage = pkgs.php74;
     };
index ac92ef48f33d5407bc58f6665f2d5634ef8e407d..ada62537fb04021ef6e5ac759bd7622e0fa00b43 100644 (file)
@@ -12,8 +12,10 @@ let
     inherit (pkgs.webapps) ttrss ttrss-plugins;
     env = config.myEnv.tools.ttrss;
     php = pkgs.php72;
+    inherit config;
   };
   kanboard = pkgs.callPackage ./kanboard.nix  {
+    inherit config;
     env = config.myEnv.tools.kanboard;
   };
   wallabag = pkgs.callPackage ./wallabag.nix {
@@ -23,10 +25,12 @@ let
       };
     };
     env = config.myEnv.tools.wallabag;
+    inherit config;
   };
   yourls = pkgs.callPackage ./yourls.nix {
     inherit (pkgs.webapps) yourls yourls-plugins;
     env = config.myEnv.tools.yourls;
+    inherit config;
   };
   rompr = pkgs.callPackage ./rompr.nix {
     inherit (pkgs.webapps) rompr;
@@ -34,6 +38,7 @@ let
   };
   shaarli = pkgs.callPackage ./shaarli.nix {
     env = config.myEnv.tools.shaarli;
+    inherit config;
   };
   dokuwiki = pkgs.callPackage ./dokuwiki.nix {
     inherit (pkgs.webapps) dokuwiki dokuwiki-plugins;
@@ -41,6 +46,7 @@ let
   ldap = pkgs.callPackage ./ldap.nix {
     inherit (pkgs.webapps) phpldapadmin;
     env = config.myEnv.tools.phpldapadmin;
+    inherit config;
   };
   grocy = pkgs.callPackage ./grocy.nix {
     grocy = pkgs.webapps.grocy.override { composerEnv = pkgs.composerEnv.override { php = pkgs.php72; }; };
@@ -56,6 +62,7 @@ let
   };
   dmarc-reports = pkgs.callPackage ./dmarc_reports.nix {
     env = config.myEnv.tools.dmarc_reports;
+    inherit config;
   };
   csp-reports = pkgs.callPackage ./csp_reports.nix {
     env = config.myEnv.tools.csp_reports;
@@ -188,8 +195,8 @@ in {
             Require all granted
           </Directory>
 
-          Alias /webhooks ${config.secrets.location}/webapps/webhooks
-          <Directory "${config.secrets.location}/webapps/webhooks">
+          Alias /webhooks ${config.secrets.fullPaths."webapps/webhooks"}
+          <Directory "${config.secrets.fullPaths."webapps/webhooks"}">
             Options -Indexes
             Require all granted
             AllowOverride None
@@ -271,7 +278,7 @@ in {
         description = "Standalone MPD Web GUI written in C";
         wantedBy = [ "multi-user.target" ];
         script = ''
-          export MPD_PASSWORD=$(cat /var/secrets/mpd)
+          export MPD_PASSWORD=$(cat ${config.secrets.fullPaths."mpd"})
           ${pkgs.ympd}/bin/ympd --host ${ympd.config.host} --port ${toString ympd.config.port} --webport ${ympd.config.webPort} --user nobody
           '';
       };
@@ -293,7 +300,7 @@ in {
 
     services.filesWatcher.ympd = {
       restart = true;
-      paths = [ "/var/secrets/mpd" ];
+      paths = [ config.secrets.fullPaths."mpd" ];
     };
 
     services.phpfpm.pools = {
@@ -313,9 +320,9 @@ in {
           "php_value[session.name]" = "ToolsPHPSESSID";
           "php_admin_value[open_basedir]" = builtins.concatStringsSep ":" [
             "/run/wrappers/bin/sendmail" landing "/tmp"
-            "${config.secrets.location}/webapps/webhooks"
+            config.secrets.fullPaths."webapps/webhooks"
           ];
-          "include" = "${config.secrets.location}/webapps/tools-csp-reports.conf";
+          "include" = config.secrets.fullPaths."webapps/tools-csp-reports.conf";
         };
         phpEnv = {
           CONTACT_EMAIL = config.myEnv.tools.contact;
@@ -438,11 +445,11 @@ in {
     };
 
     services.websites.env.tools.watchPaths = [
-      "/var/secrets/webapps/tools-shaarli"
+      config.secrets.fullPaths."webapps/tools-shaarli"
     ];
     services.filesWatcher.phpfpm-wallabag = {
       restart = true;
-      paths = [ "/var/secrets/webapps/tools-wallabag" ];
+      paths = [ config.secrets.fullPaths."webapps/tools-wallabag" ];
     };
 
   };
index e264e80f421ed1d4ccbd15a23b004642c1739d51..5fdf0b62ad09394d19f3920a4137497d66d1d9fb 100644 (file)
@@ -1,4 +1,4 @@
-{ env }:
+{ env, config }:
 rec {
   keys = [{
     dest = "webapps/tools-dmarc-reports.php";
@@ -43,7 +43,7 @@ rec {
   };
   phpFpm = rec {
     basedir = builtins.concatStringsSep ":"
-      [ webRoot "/var/secrets/webapps/tools-dmarc-reports.php" ];
+      [ webRoot config.secrets.fullPaths."webapps/tools-dmarc-reports.php" ];
     pool = {
       "listen.owner" = apache.user;
       "listen.group" = apache.group;
@@ -55,7 +55,7 @@ rec {
       "php_admin_value[open_basedir]" = "${basedir}:/tmp";
     };
     phpEnv = {
-      SECRETS_FILE = "/var/secrets/webapps/tools-dmarc-reports.php";
+      SECRETS_FILE = config.secrets.fullPaths."webapps/tools-dmarc-reports.php";
     };
   };
 }
index 0f6fefc7a67009e259662c3152585ac808a03e3c..1a7049930c2f634c570ff38985410f77a29fbf68 100644 (file)
@@ -1,4 +1,4 @@
-{ env, kanboard }:
+{ env, kanboard, config }:
 rec {
   backups = {
     rootDir = varDir;
@@ -42,7 +42,7 @@ rec {
       ?>
       '';
   }];
-  webRoot = kanboard { kanboard_config = "/var/secrets/webapps/tools-kanboard"; };
+  webRoot = kanboard { kanboard_config = config.secrets.fullPaths."webapps/tools-kanboard"; };
   apache = rec {
     user = "wwwrun";
     group = "wwwrun";
@@ -68,7 +68,7 @@ rec {
   };
   phpFpm = rec {
     serviceDeps = [ "postgresql.service" "openldap.service" ];
-    basedir = builtins.concatStringsSep ":" [ webRoot varDir "/var/secrets/webapps/tools-kanboard" ];
+    basedir = builtins.concatStringsSep ":" [ webRoot varDir config.secrets.fullPaths."webapps/tools-kanboard" ];
     pool = {
       "listen.owner" = apache.user;
       "listen.group" = apache.group;
index 0c1a21f9a0c768fb4f9500a7ed2ca4722056e1b4..cb90edc5f54f40bcd010eff6fef1f4617384e575 100644 (file)
@@ -1,4 +1,4 @@
-{ lib, php, env, writeText, phpldapadmin }:
+{ lib, php, env, writeText, phpldapadmin, config }:
 rec {
   activationScript = {
     deps = [ "httpd" ];
@@ -32,7 +32,7 @@ rec {
       $servers->setValue('login','fallback_dn',true);
       '';
   }];
-  webRoot = phpldapadmin.override { config = "/var/secrets/webapps/tools-ldap"; };
+  webRoot = phpldapadmin.override { config = config.secrets.fullPaths."webapps/tools-ldap"; };
   apache = rec {
     user = "wwwrun";
     group = "wwwrun";
@@ -54,7 +54,7 @@ rec {
   };
   phpFpm = rec {
     serviceDeps = [ "openldap.service" ];
-    basedir = builtins.concatStringsSep ":" [ webRoot "/var/secrets/webapps/tools-ldap" ];
+    basedir = builtins.concatStringsSep ":" [ webRoot config.secrets.fullPaths."webapps/tools-ldap" ];
     pool = {
       "listen.owner" = apache.user;
       "listen.group" = apache.group;
index d11f52517b5977b76d23247dfec2cc7dd56440fb..80c6a897923cb2745117ef4d1dcd9febbb17b382 100644 (file)
@@ -1,4 +1,4 @@
-{ lib, env, stdenv, fetchurl, shaarli }:
+{ lib, env, stdenv, fetchurl, shaarli, config }:
 let
   varDir = "/var/lib/shaarli";
 in rec {
@@ -21,7 +21,7 @@ in rec {
     vhostConf = socket: ''
       Alias /Shaarli "${root}"
 
-      Include /var/secrets/webapps/tools-shaarli
+      Include ${config.secrets.fullPaths."webapps/tools-shaarli"}
       <Location /Shaarli>
         Header set Access-Control-Allow-Origin "*"
         Header set Access-Control-Allow-Methods "GET, POST, PUT, DELETE, OPTIONS"
index ce1ab8e9dac3851410c141d1f8695982f89feea0..eb1d415f73d399f8927702b62a04517301b82631 100644 (file)
@@ -1,4 +1,4 @@
-{ php, env, ttrss, ttrss-plugins }:
+{ php, env, ttrss, ttrss-plugins, config }:
 rec {
   backups = {
     rootDir = varDir;
@@ -88,7 +88,7 @@ rec {
         define('LDAP_AUTH_DEBUG', FALSE);
       '';
   }];
-  webRoot = (ttrss.override { ttrss_config = "/var/secrets/webapps/tools-ttrss"; }).withPlugins (p: [
+  webRoot = (ttrss.override { ttrss_config = config.secrets.fullPaths."webapps/tools-ttrss"; }).withPlugins (p: [
     p.auth_ldap p.ff_instagram p.tumblr_gdpr_ua
     (p.af_feedmod.override { patched = true; })
     (p.feediron.override { patched = true; })
@@ -116,7 +116,7 @@ rec {
   phpFpm = rec {
     serviceDeps = [ "postgresql.service" "openldap.service" ];
     basedir = builtins.concatStringsSep ":" (
-      [ webRoot "/var/secrets/webapps/tools-ttrss" varDir ]
+      [ webRoot config.secrets.fullPaths."webapps/tools-ttrss" varDir ]
       ++ webRoot.plugins);
     pool = {
       "listen.owner" = apache.user;
index 1cb064551af9f77d54d614b3ff82540789433546..1a604c7e766f1777acb12e2375937f6819f8b60c 100644 (file)
@@ -1,4 +1,4 @@
-{ env, wallabag, mylibs }:
+{ env, wallabag, mylibs, config }:
 rec {
   backups = {
     rootDir = varDir;
@@ -69,7 +69,7 @@ rec {
               arguments: ['/run/wrappers/bin/sendmail -bs']
       '';
   }];
-  webappDir = wallabag.override { ldap = true; wallabag_config = "/var/secrets/webapps/tools-wallabag"; };
+  webappDir = wallabag.override { ldap = true; wallabag_config = config.secrets.fullPaths."webapps/tools-wallabag"; };
   activationScript = ''
     install -m 0755 -o ${apache.user} -g ${apache.group} -d ${varDir} \
       ${varDir}/var ${varDir}/data/db ${varDir}/assets/images
@@ -125,11 +125,11 @@ rec {
         /run/wrappers/bin/sudo -u wwwrun ./bin/console --env=prod doctrine:migrations:migrate --no-interaction
         popd > /dev/null
         echo -n "${webappDir}" > ${varDir}/currentWebappDir
-        sha512sum /var/secrets/webapps/tools-wallabag > ${varDir}/currentKey
+        sha512sum ${config.secrets.fullPaths."webapps/tools-wallabag"} > ${varDir}/currentKey
       fi
     '';
     serviceDeps = [ "postgresql.service" "openldap.service" ];
-    basedir = builtins.concatStringsSep ":" [ webappDir "/var/secrets/webapps/tools-wallabag" varDir ];
+    basedir = builtins.concatStringsSep ":" [ webappDir config.secrets.fullPaths."webapps/tools-wallabag" varDir ];
     pool = {
       "listen.owner" = apache.user;
       "listen.group" = apache.group;
index 885b68bc9c8909b559ce9880e563852c9bb5347b..8ffb81be5f9cc471eaa3617621c71e2015bd7e0d 100644 (file)
@@ -6,5 +6,11 @@
     group = "wwwrun";
     permissions = "0400";
     text = v;
-  }) env;
+  }) env ++ [{
+    dest = "webapps/webhooks";
+    isDir = true;
+    user = "wwwrun";
+    group = "wwwrun";
+    permissions = "0500";
+  }];
 }
index 77ac0a32130f5af9e98e0e57785cf27e822b5d4e..0f977f2842dac4b61a29f95d8baf6bbaba5379a5 100644 (file)
@@ -1,4 +1,4 @@
-{ env, yourls, yourls-plugins }:
+{ env, yourls, yourls-plugins, config }:
 rec {
   activationScript = {
     deps = [ "httpd" ];
@@ -40,7 +40,7 @@ rec {
       define( 'LDAPAUTH_USERCACHE_TYPE', 0);
     '';
   }];
-  webRoot = (yourls.override { yourls_config = "/var/secrets/webapps/tools-yourls"; }).withPlugins (p: [p.ldap]);
+  webRoot = (yourls.override { yourls_config = config.secrets.fullPaths."webapps/tools-yourls"; }).withPlugins (p: [p.ldap]);
   apache = rec {
     user = "wwwrun";
     group = "wwwrun";
@@ -70,7 +70,7 @@ rec {
   phpFpm = rec {
     serviceDeps = [ "mysql.service" "openldap.service" ];
     basedir = builtins.concatStringsSep ":" (
-      [ webRoot "/var/secrets/webapps/tools-yourls" ]
+      [ webRoot config.secrets.fullPaths."webapps/tools-yourls" ]
       ++ webRoot.plugins);
     pool = {
       "listen.owner" = apache.user;
diff --git a/modules/secrets.nix b/modules/secrets.nix
deleted file mode 100644 (file)
index 86d276a..0000000
+++ /dev/null
@@ -1,113 +0,0 @@
-{ lib, pkgs, config, ... }:
-{
-  options.secrets = {
-    keys = lib.mkOption {
-      type = lib.types.listOf lib.types.unspecified;
-      default = [];
-      description = "Keys to upload to server";
-    };
-    gpgKeys = lib.mkOption {
-      type = lib.types.listOf lib.types.path;
-      default = [];
-      description = "GPG public keys files to encrypt to";
-    };
-    ageKeys = lib.mkOption {
-      type = lib.types.listOf lib.types.str;
-      default = [];
-      description = "AGE keys to encrypt to";
-    };
-    decryptKey = lib.mkOption {
-      type = lib.types.str;
-      default = "/etc/ssh/ssh_host_ed25519_key";
-      description = "ed25519 key used to decrypt with AGE";
-    };
-    location = lib.mkOption {
-      type = lib.types.path;
-      default = "/var/secrets";
-      description = "Location where to put the keys";
-    };
-    secretsVars = lib.mkOption {
-      type = lib.types.path;
-      default = "/run/keys/vars.yml";
-      description = "Location where the secrets variables are defined, to be used to fill the templates in secrets";
-    };
-    deleteSecretsVars = lib.mkOption {
-      type = lib.types.bool;
-      default = false;
-      description = "Delete secrets file after deployment";
-    };
-    # Read-only variables
-    fullPaths = lib.mkOption {
-      type = lib.types.attrsOf lib.types.path;
-      default = builtins.listToAttrs
-        (map (v: { name = v.dest; value = "${config.secrets.location}/${v.dest}"; }) config.secrets.keys);
-      readOnly = true;
-      description = "set of full paths to secrets";
-    };
-  };
-
-  config = let
-    location = config.secrets.location;
-    keys = config.secrets.keys;
-    empty = pkgs.runCommand "empty" { preferLocalBuild = true; } "mkdir -p $out && touch $out/done";
-    fpath = v: "secrets/${v.dest}${lib.optionalString (v.isTemplated or true) ".gucci.tpl"}";
-    dumpKey = v: ''
-        mkdir -p secrets/$(dirname ${v.dest})
-        echo -n ${lib.strings.escapeShellArg v.text} > ${fpath v}
-        cat >> mods <<EOF
-        ${v.user or "root"} ${v.group or "root"} ${v.permissions or "0600"} ${fpath v}
-        EOF
-        '';
-    secrets = pkgs.runCommand "secrets.tar.enc" {
-      buildInputs = [ pkgs.gnupg pkgs.sops ];
-      } ''
-      touch mods
-      tar --format=ustar --mtime='1970-01-01' -P --transform="s@${empty}@secrets@" -cf $out ${empty}/done
-      ${builtins.concatStringsSep "\n" (map dumpKey keys)}
-      cat mods | while read u g p k; do
-      tar --format=ustar --mtime='1970-01-01' --owner="$u" --group="$g" --mode="$p" --append -f $out "$k"
-      done
-      export HOME=$(pwd)
-      fingerprints=
-      for key in ${builtins.concatStringsSep " " config.secrets.gpgKeys}; do
-        gpg --import $key 2>/dev/null
-        fingerprints=$fingerprints,$(cat $key | gpg --with-colons --import-options show-only --import 2>/dev/null | grep ^fpr | cut -d: -f10 | head -n1)
-      done
-
-      sops --age ${builtins.concatStringsSep "," config.secrets.ageKeys} --pgp ''${fingerprints#,} --input-type binary -i -e $out 2>/dev/null
-      '';
-  in lib.mkIf (builtins.length keys > 0) {
-    system.activationScripts.secrets = {
-      deps = [ "users" "wrappers" ];
-      text = ''
-        install -m0750 -o root -g keys -d ${location}
-        TMP=$(${pkgs.coreutils}/bin/mktemp -d)
-        TMPWORK=$(${pkgs.coreutils}/bin/mktemp -d)
-        chmod go-rwx $TMPWORK
-        if [ -n "$TMP" -a -n "$TMPWORK" ]; then
-          install -m0750 -o root -g keys -d $TMP
-          ${pkgs.ssh-to-age}/bin/ssh-to-age -private-key -i ${config.secrets.decryptKey} -o $TMPWORK/keys.txt
-          SOPS_AGE_KEY_FILE=$TMPWORK/keys.txt ${pkgs.sops}/bin/sops -d ${secrets} | ${pkgs.gnutar}/bin/tar --strip-components 1 -C $TMP -x
-          if [ -f ${config.secrets.secretsVars} ]; then
-            SOPS_AGE_KEY_FILE=$TMPWORK/keys.txt ${pkgs.sops}/bin/sops -d ${config.secrets.secretsVars} > $TMPWORK/vars.yml
-          fi
-          if [ -f $TMPWORK/vars.yml ]; then
-            find $TMP -name "*.gucci.tpl" -exec \
-              /bin/sh -c 'f="{}"; ${pkgs.gucci}/bin/gucci -f '$TMPWORK'/vars.yml "$f" > "''${f%.gucci.tpl}"; touch --reference "$f" ''${f%.gucci.tpl} ; chmod --reference="$f" ''${f%.gucci.tpl} ; chown --reference="$f" ''${f%.gucci.tpl}' \;
-          fi
-          find $TMP -type d -exec chown root:keys {} \; -exec chmod o-rx {} \;
-          ${pkgs.rsync}/bin/rsync --exclude="*.gucci.tpl" -O -c -av --delete $TMP/ ${location}
-          rm -rf $TMP $TMPWORK ${lib.optionalString config.secrets.deleteSecretsVars config.secrets.secretsVars}
-        fi
-        '';
-    };
-
-    deployment.secrets."secret_vars.yml" = {
-      source = builtins.toString ../nixops/secrets/vars.yml;
-      destination = config.secrets.secretsVars;
-      owner.user = "root";
-      owner.group = "root";
-      permissions = "0400";
-     };
-  };
-}
index a1e6498139cc51a3d68e5655480542e6ccd3a45f..0b9f489a7e2e01208d4285c26348b4fa09607e1b 160000 (submodule)
@@ -1 +1 @@
-Subproject commit a1e6498139cc51a3d68e5655480542e6ccd3a45f
+Subproject commit 0b9f489a7e2e01208d4285c26348b4fa09607e1b