2021-02-20 14:55:20 -08:00
|
|
|
{ lib, config, ... }:
|
2020-10-26 02:48:12 -07:00
|
|
|
|
|
|
|
{
|
|
|
|
## System security tweaks
|
2021-02-20 14:55:20 -08:00
|
|
|
# tmpfs = /tmp is mounted in ram. Doing so makes temp file management speedy
|
|
|
|
# on ssd systems, and volatile! Because it's wiped on reboot.
|
|
|
|
boot.tmpOnTmpfs = lib.mkDefault true;
|
|
|
|
systemd.mounts = lib.mkIf config.boot.tmpOnTmpfs [{
|
|
|
|
what = "tmpfs";
|
|
|
|
where = "/tmp";
|
|
|
|
type = "tmpfs";
|
|
|
|
# Added noexec (for added security), and reduced size from 50% to 25%
|
|
|
|
options = "mode=1777,strictatime,rw,nosuid,nodev,noexec,size=25%";
|
|
|
|
}];
|
|
|
|
# If not using tmpfs, which is naturally purged on reboot, we must clean it
|
|
|
|
# /tmp ourselves. /tmp should be volatile storage!
|
|
|
|
boot.cleanTmpDir = lib.mkDefault (!config.boot.tmpOnTmpfs);
|
|
|
|
|
2020-10-26 02:48:12 -07:00
|
|
|
security.hideProcessInformation = true;
|
|
|
|
security.protectKernelImage = true;
|
|
|
|
|
|
|
|
# Fix a security hole in place for backwards compatibility. See desc in
|
|
|
|
# nixpkgs/nixos/modules/system/boot/loader/systemd-boot/systemd-boot.nix
|
|
|
|
boot.loader.systemd-boot.editor = false;
|
|
|
|
|
|
|
|
# Change me later!
|
2020-12-31 14:31:29 -08:00
|
|
|
user.initialPassword = "nixos";
|
|
|
|
users.users.root.initialPassword = "nixos";
|
2021-01-01 21:24:20 -08:00
|
|
|
|
|
|
|
# So we don't have to do this later...
|
|
|
|
security.acme.acceptTerms = true;
|
2020-10-26 02:48:12 -07:00
|
|
|
}
|