Replace firewalld with simple NixOS firewall rules
This commit is contained in:
parent
0c64358f3e
commit
f85fc7a0be
1 changed files with 1 additions and 100 deletions
|
|
@ -1,104 +1,5 @@
|
||||||
{ ... }:
|
{ ... }:
|
||||||
{
|
{
|
||||||
networking.firewall.enable = true;
|
networking.firewall.enable = true;
|
||||||
networking.firewall.backend = "firewalld";
|
networking.firewall.allowedTCPPorts = [ 22 80 443 8443 ];
|
||||||
networking.nftables.enable = true;
|
|
||||||
|
|
||||||
services.firewalld.enable = true;
|
|
||||||
services.firewalld.settings.DefaultZone = "FedoraServer";
|
|
||||||
|
|
||||||
services.firewalld.zones.FedoraServer = {
|
|
||||||
target = "%%REJECT%%";
|
|
||||||
interfaces = [ "ens3" ];
|
|
||||||
forward = true;
|
|
||||||
services = [ "http" "https" "ssh" ];
|
|
||||||
ports = [
|
|
||||||
{
|
|
||||||
port = 8443;
|
|
||||||
protocol = "tcp";
|
|
||||||
}
|
|
||||||
];
|
|
||||||
rules = [
|
|
||||||
{
|
|
||||||
rule = {
|
|
||||||
"@family" = "ipv4";
|
|
||||||
source = { "@address" = "80.94.92.177"; };
|
|
||||||
port = { "@port" = "ssh"; "@protocol" = "tcp"; };
|
|
||||||
reject = { "@type" = "icmp-port-unreachable"; };
|
|
||||||
};
|
|
||||||
}
|
|
||||||
{
|
|
||||||
rule = {
|
|
||||||
"@family" = "ipv4";
|
|
||||||
source = { "@address" = "45.148.10.240"; };
|
|
||||||
port = { "@port" = "ssh"; "@protocol" = "tcp"; };
|
|
||||||
reject = { "@type" = "icmp-port-unreachable"; };
|
|
||||||
};
|
|
||||||
}
|
|
||||||
{
|
|
||||||
rule = {
|
|
||||||
"@family" = "ipv4";
|
|
||||||
source = { "@address" = "193.242.125.233"; };
|
|
||||||
port = { "@port" = "ssh"; "@protocol" = "tcp"; };
|
|
||||||
reject = { "@type" = "icmp-port-unreachable"; };
|
|
||||||
};
|
|
||||||
}
|
|
||||||
{
|
|
||||||
rule = {
|
|
||||||
"@family" = "ipv4";
|
|
||||||
source = { "@address" = "45.78.198.204"; };
|
|
||||||
port = { "@port" = "ssh"; "@protocol" = "tcp"; };
|
|
||||||
reject = { "@type" = "icmp-port-unreachable"; };
|
|
||||||
};
|
|
||||||
}
|
|
||||||
{
|
|
||||||
rule = {
|
|
||||||
"@family" = "ipv4";
|
|
||||||
source = { "@address" = "176.120.22.47"; };
|
|
||||||
port = { "@port" = "ssh"; "@protocol" = "tcp"; };
|
|
||||||
reject = { "@type" = "icmp-port-unreachable"; };
|
|
||||||
};
|
|
||||||
}
|
|
||||||
{
|
|
||||||
rule = {
|
|
||||||
"@family" = "ipv4";
|
|
||||||
source = { "@address" = "91.202.233.33"; };
|
|
||||||
port = { "@port" = "ssh"; "@protocol" = "tcp"; };
|
|
||||||
reject = { "@type" = "icmp-port-unreachable"; };
|
|
||||||
};
|
|
||||||
}
|
|
||||||
{
|
|
||||||
rule = {
|
|
||||||
"@family" = "ipv4";
|
|
||||||
source = { "@address" = "188.166.24.102"; };
|
|
||||||
port = { "@port" = "ssh"; "@protocol" = "tcp"; };
|
|
||||||
reject = { "@type" = "icmp-port-unreachable"; };
|
|
||||||
};
|
|
||||||
}
|
|
||||||
{
|
|
||||||
rule = {
|
|
||||||
"@family" = "ipv4";
|
|
||||||
source = { "@address" = "128.1.47.28"; };
|
|
||||||
port = { "@port" = "ssh"; "@protocol" = "tcp"; };
|
|
||||||
reject = { "@type" = "icmp-port-unreachable"; };
|
|
||||||
};
|
|
||||||
}
|
|
||||||
{
|
|
||||||
rule = {
|
|
||||||
"@family" = "ipv4";
|
|
||||||
source = { "@address" = "188.166.11.218"; };
|
|
||||||
port = { "@port" = "ssh"; "@protocol" = "tcp"; };
|
|
||||||
reject = { "@type" = "icmp-port-unreachable"; };
|
|
||||||
};
|
|
||||||
}
|
|
||||||
{
|
|
||||||
rule = {
|
|
||||||
"@family" = "ipv4";
|
|
||||||
source = { "@address" = "104.248.91.222"; };
|
|
||||||
port = { "@port" = "ssh"; "@protocol" = "tcp"; };
|
|
||||||
reject = { "@type" = "icmp-port-unreachable"; };
|
|
||||||
};
|
|
||||||
}
|
|
||||||
];
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue