Back to normal firewall. Updated systemD container start service.
This commit is contained in:
@@ -1,24 +1,8 @@
|
|||||||
{ config, pkgs, lib, ... }:
|
{ config, pkgs, lib, ... }:
|
||||||
|
|
||||||
let
|
|
||||||
trustedSubnets = [ "192.168.27.0/24" "10.89.0.0/16" ]
|
|
||||||
++ lib.optional (config.numbus.networking.networkSubnet != "") config.numbus.networking.networkSubnet;
|
|
||||||
trustedSubnetsStr = lib.concatStringsSep ", " trustedSubnets;
|
|
||||||
in
|
|
||||||
|
|
||||||
{
|
{
|
||||||
config = {
|
config = {
|
||||||
networking.nftables.enable = true;
|
networking.nftables.enable = true;
|
||||||
networking.nftables.tables."numbus-filter" = {
|
|
||||||
family = "inet";
|
|
||||||
content = ''
|
|
||||||
chain input {
|
|
||||||
type filter hook input priority -10; policy accept;
|
|
||||||
tcp dport { 53, 80, 443 } ip saddr != { ${trustedSubnetsStr} } drop
|
|
||||||
udp dport { 53, 443 } ip saddr != { ${trustedSubnetsStr} } drop
|
|
||||||
}
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
networking.firewall = {
|
networking.firewall = {
|
||||||
enable = true;
|
enable = true;
|
||||||
allowPing = true;
|
allowPing = true;
|
||||||
|
|||||||
@@ -106,16 +106,18 @@ with lib;
|
|||||||
onFailure = [ "service-failure-notify@%n.service" ];
|
onFailure = [ "service-failure-notify@%n.service" ];
|
||||||
startLimitBurst = 5;
|
startLimitBurst = 5;
|
||||||
startLimitIntervalSec = 600;
|
startLimitIntervalSec = 600;
|
||||||
path = [ pkgs.podman pkgs.podman-compose pkgs.coreutils pkgs.sudo ];
|
path = [ pkgs.podman pkgs.podman-compose pkgs.newuidmap pkgs.coreutils ];
|
||||||
serviceConfig = {
|
serviceConfig = {
|
||||||
Type = "exec";
|
Type = "exec";
|
||||||
|
User = "numbus-admin";
|
||||||
|
Group = "users";
|
||||||
TimeoutStartSec = "1000";
|
TimeoutStartSec = "1000";
|
||||||
ExecStartPre = [
|
ExecStartPre = [
|
||||||
"${pkgs.bash}/bin/bash -c 'sleep $((RANDOM % ${toString startDelay}))'"
|
"${pkgs.bash}/bin/bash -c 'sleep $((RANDOM % ${toString startDelay}))'"
|
||||||
"${pkgs.sudo}/bin/sudo -u numbus-admin podman-compose -f /etc/podman/${name}/compose.yaml pull"
|
"${pkgs.podman-compose}/bin/podman-compose -f /etc/podman/${name}/compose.yaml pull"
|
||||||
];
|
];
|
||||||
ExecStart = "${pkgs.sudo}/bin/sudo -u numbus-admin podman-compose ${envFileArg} --in-pod ${toString pod} -f /etc/podman/${name}/compose.yaml up --remove-orphans";
|
ExecStart = "${pkgs.podman-compose}/bin/podman-compose ${envFileArg} --in-pod ${toString pod} -f /etc/podman/${name}/compose.yaml up --remove-orphans";
|
||||||
ExecStop = "${pkgs.sudo}/bin/sudo -u numbus-admin podman-compose ${envFileArg} --in-pod ${toString pod} -f /etc/podman/${name}/compose.yaml down";
|
ExecStop = "${pkgs.podman-compose}/bin/podman-compose ${envFileArg} --in-pod ${toString pod} -f /etc/podman/${name}/compose.yaml down";
|
||||||
Restart = "on-failure";
|
Restart = "on-failure";
|
||||||
RestartSec = "3m";
|
RestartSec = "3m";
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user