feat: increase system security

This commit is contained in:
Swarsel 2024-08-10 16:45:55 +02:00
parent 5bb6e6038e
commit bbaee7acd8
Signed by: swarsel
GPG key ID: 26A54C31F2A4FD84
4 changed files with 53 additions and 7 deletions

View file

@ -4932,7 +4932,7 @@ First, we enable the use of =home-manager= as a NixoS module
#+begin_src nix :tangle profiles/common/nixos/default.nix #+begin_src nix :tangle profiles/common/nixos/default.nix
{ lib, ... }: { lib, inputs, ... }:
{ {
imports = [ imports = [
./xserver.nix ./xserver.nix
@ -5065,7 +5065,7 @@ Next, we will setup some environment variables that need to be set on the system
} }
#+end_src #+end_src
**** Enable PolicyKit **** Security
:PROPERTIES: :PROPERTIES:
:CUSTOM_ID: h:e2d40df9-0026-4caa-8476-9dc2353055a1 :CUSTOM_ID: h:e2d40df9-0026-4caa-8476-9dc2353055a1
:END: :END:
@ -5075,7 +5075,15 @@ Needed for control over system-wide privileges etc.
#+begin_src nix :tangle profiles/common/nixos/polkit.nix #+begin_src nix :tangle profiles/common/nixos/polkit.nix
_ : _ :
{ {
security.pam.services = {
login.u2fAuth = true;
sudo.u2fAuth = true;
swaylock.u2fAuth = true;
swaylock.fprintAuth = false;
};
security.polkit.enable = true; security.polkit.enable = true;
} }
#+end_src #+end_src
@ -5557,6 +5565,7 @@ Mostly used to install some compilers and lsp's that I want to have available wh
yubioath-flutter yubioath-flutter
yubikey-manager yubikey-manager
yubikey-manager-qt yubikey-manager-qt
yubikey-touch-detector
yubico-piv-tool yubico-piv-tool
cfssl cfssl
pcsctools pcsctools
@ -8226,23 +8235,26 @@ Currently, I am too lazy to explain every option here, but most of it is very se
in in
" "
exec_always autotiling exec_always autotiling
set $exit \"exit: [s]leep, [p]oweroff, [r]eboot, [l]ogout\" set $exit \"exit: [s]leep, [l]ock, [p]oweroff, [r]eboot, [u]ser logout\"
mode $exit { mode $exit {
bindsym --to-code { bindsym --to-code {
s exec \"systemctl suspend\", mode \"default\" s exec \"systemctl suspend\", mode \"default\"
l exec \"swaylock --screenshots --clock --effect-blur 7x5 --effect-vignette 0.5:0.5 --fade-in 0.2 --daemonize && systemctl suspend \", mode \"default \"
p exec \"systemctl poweroff\" p exec \"systemctl poweroff\"
r exec \"systemctl reboot\" r exec \"systemctl reboot\"
l exec \"swaymsg exit\" u exec \"swaymsg exit\"
Return mode \"default\" Return mode \"default\"
Escape mode \"default\" Escape mode \"default\"
${modifier}+x mode \"default\" ${modifier}+Escape mode \"default\"
} }
} }
exec systemctl --user import-environment exec systemctl --user import-environment
${swayfxSettings} ${swayfxSettings}
"; ";

View file

@ -1,4 +1,4 @@
{ lib, ... }: { lib, inputs, ... }:
{ {
imports = [ imports = [
./xserver.nix ./xserver.nix
@ -12,12 +12,14 @@
./network.nix ./network.nix
./time.nix ./time.nix
./hardware.nix ./hardware.nix
./pipewire.nix
./sops.nix ./sops.nix
./packages.nix ./packages.nix
./programs.nix ./programs.nix
./zsh.nix ./zsh.nix
./syncthing.nix ./syncthing.nix
./blueman.nix ./blueman.nix
./safeeyes.nix
./networkdevices.nix ./networkdevices.nix
./gvfs.nix ./gvfs.nix
./interceptiontools.nix ./interceptiontools.nix
@ -26,11 +28,32 @@
./stylix.nix ./stylix.nix
./power-profiles-daemon.nix ./power-profiles-daemon.nix
# ./impermanence.nix # ./impermanence.nix
./nvd-rebuild.nix
./nix-ld.nix ./nix-ld.nix
./gnome-keyring.nix ./gnome-keyring.nix
./sway.nix
./xdg-portal.nix
]; ];
nix.settings.trusted-users = [ "swarsel" ]; nix =
let
flakeInputs = lib.filterAttrs (_: lib.isType "flake") inputs;
in
{
settings = {
experimental-features = [
"nix-command"
"flakes"
"ca-derivations"
];
trusted-users = [ "swarsel" ];
flake-registry = "";
warn-dirty = false;
};
channel.enable = false;
registry = lib.mapAttrs (_: flake: { inherit flake; }) flakeInputs;
nixPath = lib.mapAttrsToList (n: _: "${n}=flake:${n}") flakeInputs;
};
home-manager = { home-manager = {
useGlobalPkgs = true; useGlobalPkgs = true;

View file

@ -9,6 +9,7 @@
yubioath-flutter yubioath-flutter
yubikey-manager yubikey-manager
yubikey-manager-qt yubikey-manager-qt
yubikey-touch-detector
yubico-piv-tool yubico-piv-tool
cfssl cfssl
pcsctools pcsctools
@ -18,6 +19,8 @@
ledger-live-desktop ledger-live-desktop
# pinentry # pinentry
dbus
swaylock-effects
# secure boot # secure boot
sbctl sbctl

View file

@ -1,4 +1,12 @@
_: _:
{ {
security.pam.services = {
login.u2fAuth = true;
sudo.u2fAuth = true;
swaylock.u2fAuth = true;
swaylock.fprintAuth = false;
};
security.polkit.enable = true; security.polkit.enable = true;
} }