ctucx.git: nixfiles

ctucx' nixfiles

commit 3fa1f80cc280e588c078ed1dbe9bd703279ad4bd
parent 2ed9bd3c99a7c938b391c0939922c14d020133ce
Author: Leah (ctucx) <git@ctu.cx>
Date: Thu, 13 Oct 2022 15:38:57 +0200

machines/lollo: add yubikey support
2 files changed, 40 insertions(+), 1 deletion(-)
M
machines/lollo/configuration.nix
|
4
+++-
A
machines/lollo/remote-admin.nix
|
37
+++++++++++++++++++++++++++++++++++++
diff --git a/machines/lollo/configuration.nix b/machines/lollo/configuration.nix
@@ -1,4 +1,4 @@
-{ config, pkgs, ... }:
+{ config, pkgs, lib, ... }:
 
 {
 

@@ -21,6 +21,8 @@
     ./gotosocial.nix
     ./scanner-sftp.nix
     ./airsane.nix
+
+    ./remote-admin.nix
   ];
 
   age.secrets.restic-server-desastro.file = ../../secrets/restic-server/desastro.age;
diff --git a/machines/lollo/remote-admin.nix b/machines/lollo/remote-admin.nix
@@ -0,0 +1,37 @@
+{ pkgs, lib, ... }:
+
+{
+
+  imports = [
+    ../../configurations/common/programs/gpg.nix
+    ../../configurations/common/programs/password-store.nix
+  ];
+
+  home-manager.users.leah.services.gpg-agent = {
+    pinentryFlavor     = lib.mkForce "tty";
+    defaultCacheTtl    = lib.mkForce 300;
+    defaultCacheTtlSsh = lib.mkForce 300;
+    maxCacheTtl        = lib.mkForce 300;
+    maxCacheTtlSsh     = lib.mkForce 300;
+  };
+
+  security.polkit.extraConfig = ''
+    polkit.addRule(function(action, subject) {
+      if ((action.id == "org.debian.pcsc-lite.access_pcsc" || action.id == "org.debian.pcsc-lite.access_card") && subject.isInGroup("wheel")) {
+        return polkit.Result.YES;
+      }
+    });
+  '';
+
+  systemd.services.lockGPGCard = {
+    wantedBy = [ "multi-user.target" ];
+    startAt  = [ "*-*-* *:*/5" ];
+    serviceConfig.User  = "leah";
+    serviceConfig.Group = "users";
+    script   = ''
+      ${pkgs.gnupg}/bin/gpgconf --reload scdaemon;
+      ${pkgs.coreutils-full}/bin/rm -rf /home/leah/.ssh/master*;
+    '';
+  };
+
+}