Compare commits

..

2 Commits

Author SHA1 Message Date
h7x4
ecc4417e0f base/hardening: ban a few more modules 2026-05-20 16:33:55 +09:00
h7x4
ffce1bd607 base/mitigations: blacklist modules for copyfail and pintheft 2026-05-20 16:33:55 +09:00
4 changed files with 5 additions and 57 deletions

View File

@@ -1,6 +1,7 @@
{ pkgs, lib, ... }: { ... }:
let
modulesToBan = [ {
boot.blacklistedKernelModules = [
# copy.fail # copy.fail
"af_alg" "af_alg"
"algif_aead" "algif_aead"
@@ -16,9 +17,4 @@ let
# PinTheft # PinTheft
"rds" "rds"
]; ];
in
{
boot.blacklistedKernelModules = modulesToBan;
boot.extraModprobeConfig = lib.concatMapStringsSep "\n" (mod: "install ${mod} ${lib.getExe' pkgs.coreutils "false"}") modulesToBan;
} }

View File

@@ -64,11 +64,4 @@ in
''; '';
}; };
}; };
networking.firewall.allowedUDPPortRanges = [
{
from = cfg.settings.rtc.port_range_start;
to = cfg.settings.rtc.port_range_end;
}
];
} }

View File

@@ -1,37 +0,0 @@
{ config, lib, pkgs, ... }:
let
cfg = config.services.postgresql;
in
{
config = lib.mkIf cfg.enable {
systemd.services = {
postgresql-repack = {
requires = [ "postgresql.service" ];
after = [ "postgresql.target" ];
description = "Repack all PostgreSQL databases";
startAt = "Mon 06:00:00";
serviceConfig = {
Type = "oneshot";
User = "postgres";
Group = "postgres";
ExecStart = "${lib.getExe cfg.package.pkgs.pg_repack} --port=${builtins.toString cfg.settings.port} --all";
};
};
postgresql-vacuum-analyze = {
requires = [ "postgresql.service" ];
after = [ "postgresql.target" ];
description = "Vacuum and analyze all PostgreSQL databases";
startAt = "Tue 06:00:00";
serviceConfig = {
Type = "oneshot";
User = "postgres";
Group = "postgres";
ExecStart = "${lib.getExe' cfg.package "psql"} --port=${builtins.toString cfg.settings.port} -tAc 'VACUUM ANALYZE'";
};
};
};
};
}

View File

@@ -3,15 +3,11 @@ let
cfg = config.services.postgresql; cfg = config.services.postgresql;
in in
{ {
imports = [ imports = [ ./backup.nix ];
./backup.nix
./cleanup-timers.nix
];
services.postgresql = { services.postgresql = {
enable = true; enable = true;
package = pkgs.postgresql_18; package = pkgs.postgresql_18;
extensions = ps: with ps; [ pg_repack ];
enableTCPIP = true; enableTCPIP = true;
authentication = '' authentication = ''