]> git.immae.eu Git - perso/Immae/Config/Nix.git/commitdiff
Move ssh ftp and mpd to new secrets
authorIsmaël Bouya <ismael.bouya@normalesup.org>
Thu, 25 Apr 2019 00:18:59 +0000 (02:18 +0200)
committerIsmaël Bouya <ismael.bouya@normalesup.org>
Thu, 25 Apr 2019 00:18:59 +0000 (02:18 +0200)
nixops/modules/ftp/default.nix
nixops/modules/mpd/default.nix
nixops/modules/ssh/default.nix
nixops/modules/websites/tools/tools/default.nix

index 0409f23e5ed72ab6e3468c7a7bc697ef854935f6..ff067f8d16445ae1553362098e363d66ee8ef67a 100644 (file)
@@ -47,7 +47,8 @@
       install -m 0755 -o ftp -g ftp -d /var/lib/ftp
       '';
 
-    deployment.keys.pure-ftpd-ldap = {
+    mySecrets.keys = [{
+      dest = "pure-ftpd-ldap";
       permissions = "0400";
       user = "ftp";
       group = "ftp";
@@ -70,7 +71,7 @@
         # Compile dans pure-ftpd directement avec immaeFtpUid / immaeFtpGid
         LDAPHomeDir         immaeFtpDirectory
         '';
-    };
+    }];
 
     systemd.services.pure-ftpd = let
       configFile = pkgs.writeText "pure-ftpd.conf" ''
@@ -88,7 +89,7 @@
         SyslogFacility               ftp
         DontResolve                  yes
         MaxIdleTime                  15
-        LDAPConfigFile               /run/keys/pure-ftpd-ldap
+        LDAPConfigFile               /var/secrets/pure-ftpd-ldap
         LimitRecursion               10000 8
         AnonymousCanCreateDirs       no
         MaxLoad                      4
index 2cf37adfe6b9be5fd8e840495daaf32c0d6ab4bd..09047329ba2bb1332fdfa3bd95553fd3ebefe7de 100644 (file)
@@ -4,20 +4,22 @@
     nixpkgs.overlays = [ (self: super: rec {
       mpd = (self.callPackage ./mpd.nix {}).mpd;
     }) ];
-    deployment.keys = {
-      mpd = {
+    mySecrets.keys = [
+      {
+        dest = "mpd";
         permissions = "0400";
         text = myconfig.env.mpd.password;
-      };
-      mpd-config = {
+      }
+      {
+        dest = "mpd-config";
         permissions = "0400";
         user = "mpd";
         group = "mpd";
         text = ''
           password "${myconfig.env.mpd.password}@read,add,control,admin"
         '';
-      };
-    };
+      }
+    ];
     networking.firewall.allowedTCPPorts = [ 6600 ];
     users.users.mpd.extraGroups = [ "wwwrun" "keys" ];
     system.activationScripts.mpd = ''
@@ -28,7 +30,7 @@
       network.listenAddress = "any";
       musicDirectory = myconfig.env.mpd.folder;
       extraConfig = ''
-        include "/run/keys/mpd-config"
+        include "/var/secrets/mpd-config"
         audio_output {
           type            "null"
           name            "No Output"
index 924f86e213427d18f9e16cc9298ebab2a1002c7f..ece4b9ff7518293967ca713d31953dba0c45c244 100644 (file)
@@ -8,16 +8,15 @@
       AuthorizedKeysCommandUser nobody
       '';
 
-    deployment.keys = {
-      ssh-ldap = {
-        user = "nobody";
-        group = "nobody";
-        permissions = "0400";
-        text = myconfig.env.sshd.ldap.password;
-      };
-    };
+    mySecrets.keys = [{
+      dest = "ssh-ldap";
+      user = "nobody";
+      group = "nobody";
+      permissions = "0400";
+      text = myconfig.env.sshd.ldap.password;
+    }];
     system.activationScripts.sshd = ''
-      install -Dm400 -o nobody -g nobody -T /run/keys/ssh-ldap /etc/ssh/ldap_password
+      install -Dm400 -o nobody -g nobody -T /var/secrets/ssh-ldap /etc/ssh/ldap_password
       '';
     # ssh is strict about parent directory having correct rights, don't
     # move it in the nix store.
index 1aa70b89bec7fbc30ea3e8bf58d23316b738bcef..463e0599677ff38091f8226a390df28b709457d1 100644 (file)
@@ -76,7 +76,7 @@ in {
       description = "Standalone MPD Web GUI written in C";
       wantedBy = [ "multi-user.target" ];
       script = ''
-        export MPD_PASSWORD=$(cat /run/keys/mpd)
+        export MPD_PASSWORD=$(cat /var/secrets/mpd)
         ${pkgs.ympd}/bin/ympd --host ${ympd.config.host} --port ${toString ympd.config.port} --webport ${ympd.config.webPort} --user nobody
         '';
     };