feat: added better options to teh firewall
This commit is contained in:
parent
7428a53325
commit
c2e4fde98d
2 changed files with 45 additions and 24 deletions
|
@ -17,20 +17,34 @@
|
|||
'';
|
||||
};
|
||||
|
||||
own_ip = lib.mkOption {
|
||||
default = "127.0.0.1";
|
||||
type = lib.types.str;
|
||||
description = ''
|
||||
IP of the firewall
|
||||
'';
|
||||
};
|
||||
own = {
|
||||
ip = lib.mkOption {
|
||||
default = "127.0.0.1";
|
||||
type = lib.types.str;
|
||||
description = ''
|
||||
IP of the firewall
|
||||
'';
|
||||
};
|
||||
|
||||
ports = {
|
||||
tcp = lib.mkOption {
|
||||
default = [ ];
|
||||
type = lib.types.listOf lib.types.int;
|
||||
description = ''
|
||||
A list of TCP ports for the machiene running the firewall
|
||||
'';
|
||||
};
|
||||
|
||||
udp = lib.mkOption {
|
||||
default = [ ];
|
||||
type = lib.types.listOf lib.types.int;
|
||||
description = ''
|
||||
A list of UDP ports for the machiene running the firewall
|
||||
'';
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
own_ports = lib.mkOption {
|
||||
default = [ ];
|
||||
type = lib.types.listOf lib.types.int;
|
||||
description = ''
|
||||
A list of ports for the machiene running the firewall
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
|
@ -73,8 +87,13 @@
|
|||
table ip filter {
|
||||
chain input {
|
||||
type filter hook input priority filter; policy accept;
|
||||
|
||||
# for the host machiene
|
||||
${lib.strings.concatMapStrings (x: x + "\n") (map (port: "tcp dport ${toString port} counter packets 0 bytes 0 accept") config.skynet_firewall.own_ports)}
|
||||
# TCP
|
||||
${lib.strings.concatMapStrings (x: x + "\n") (map (port: "tcp dport ${toString port} counter packets 0 bytes 0 accept") config.skynet_firewall.own.ports.tcp)}
|
||||
|
||||
# UDP
|
||||
${lib.strings.concatMapStrings (x: x + "\n") (map (port: "udp dport ${toString port} counter packets 0 bytes 0 accept") config.skynet_firewall.own.ports.udp)}
|
||||
}
|
||||
|
||||
chain forward {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue