]> Untitled Git - MarigoldOS/.git/blob - specialisations/hardened.nix
Initial Commit
[MarigoldOS/.git] / specialisations / hardened.nix
1 { pkgs,
2   lib,
3   config,
4   ... }:
5 {
6   specialisation.hardened.configuration = {
7     imports = [
8       # This includes a hardened kernel, and limiting the system information available to processes through the /sys and /proc filesystems. It also disables the User Namespaces feature of the kernel, which stops Nix from being able to build anything (this particular setting can be overriden via security.allowUserNamespaces). See the profile source for further detail on which settings are altered.
9       <nixpkgs/nixos/modules/profiles/hardened.nix>
10       # Manual section: https://nixos.org/manual/nixos/stable/index.html#sec-profile-hardened
11       # profile source: https://github.com/nixos/nixpkgs/tree/master/nixos/modules/profiles/hardened.nix
12     ];
13
14     # system.nixos.label = "marigoldOS-${config.system.nixos.release}-hardened";
15     # system.nixos.tags = [ "hardened" ];
16
17     networking.firewall.allowPing = false;
18
19     # doas instead of sudo
20     security.sudo.enable = false;
21     security.doas = {
22       enable = true;
23       extraRules = [{
24         groups = ["wheel"];
25         persist = false;
26         noPass = false;
27         keepEnv = true;
28       }];
29     };
30     # alias
31     environment.shellAliases = { sudo = "doas "; };
32
33     # Once this is in a spot where it looks good, move this to the main profile
34     # security.auditd.enable = true;
35     # security.audit.enable = true;
36     # TODO actually make the rules, lel.
37     # https://security.blogoverflow.com/2013/01/a-brief-introduction-to-auditd/
38     # https://security.blogoverflow.com/2013/09/stump-the-chump-with-auditd-01/
39
40     # TODO investigate this
41     # security.allowUserNamespaces
42
43     # TODO Investigate this
44     # boot.kernel.randstructSeed = "Change this. Also does hiding this from version control provide any (meaningful) security advantages? Maybe from a targeted attack, but enough to matter?";
45
46     # TODO Read then rip off archbros
47     # https://wiki.archlinux.org/title/Security
48   };
49 }