nixos/modules/system/security.nix

50 lines
1.5 KiB
Nix
Raw Normal View History

2023-09-02 21:47:12 +08:00
inputs:
{
config =
{
# allow non-root users to access intel gpu performance counters
boot.kernel.sysctl."dev.i915.perf_stream_paranoid" = false;
security =
2023-09-02 21:47:12 +08:00
{
pam =
2023-09-02 21:47:12 +08:00
{
u2f =
{
enable = true;
2024-07-31 08:40:09 +08:00
settings =
{
cue = true;
appid = "pam://chn.moe";
origin = "pam://chn.moe";
# generate using: `pamu2fcfg -u chn -o pam://chn.moe -i pam://chn.moe`
authfile = builtins.toString (inputs.pkgs.writeText "yubikey_mappings" (builtins.concatStringsSep "\n"
2023-09-02 21:47:12 +08:00
[
2024-07-31 08:40:09 +08:00
(builtins.concatStringsSep ":"
[
2024-07-31 08:40:09 +08:00
"chn"
(builtins.concatStringsSep ","
[
"83Y3cLxhcmwbDOH1h67SQ1xy0dFBcoKYM0VO/YVq+9lpOpdPdmFaB7BNngO3xCmAxJeO/Fg9jNmEF9vMJEmAaw=="
"9bSjr+12JVwtHlyoa70J7w3bEQff+MwLxg5elzdP1OGHcfWGkolRvS+luAgcWjKn1g0swaYdnklCYWYOoCAJbA=="
"es256"
"+presence"
])
])
2024-07-31 08:40:09 +08:00
]));
};
};
yubico = { enable = true; id = "91291"; };
2024-03-22 20:06:52 +08:00
loginLimits =
[
{ domain = "@users"; item = "nofile"; value = 65536; }
{ domain = "@users"; item = "stack"; value = "unlimited"; }
];
2023-09-02 21:47:12 +08:00
};
sudo.extraConfig = "Defaults pwfeedback";
2023-09-02 21:47:12 +08:00
};
2024-03-22 20:06:52 +08:00
systemd.user.extraConfig = "DefaultLimitNOFILE=65536:524288";
2024-09-20 01:43:27 +08:00
# needed by xray tproxy if we want to forward traffic from other machine
networking.firewall.checkReversePath = false;
2023-09-02 21:47:12 +08:00
};
}