feat: improved config a tad

This commit is contained in:
silver 2023-01-15 19:18:24 +00:00
parent 8f373ada01
commit 6ef12f03de
2 changed files with 27 additions and 2 deletions

View file

@ -16,6 +16,22 @@
A list of routes to forward A list of routes to forward
''; '';
}; };
own_ip = lib.mkOption {
default = "127.0.0.1";
type = lib.types.str;
description = ''
IP of 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
'';
};
}; };
}; };
@ -57,8 +73,8 @@
table ip filter { table ip filter {
chain input { chain input {
type filter hook input priority filter; policy accept; type filter hook input priority filter; policy accept;
tcp dport 22 counter packets 0 bytes 0 jump fail2ban-ssh # for the host machiene
tcp dport 22 counter packets 0 bytes 0 accept ${lib.strings.concatMapStrings (x: x + "\n") (map (port: "tcp dport ${toString port} counter packets 0 bytes 0 accept") config.skynet_firewall.own_ports)}
} }
chain forward { chain forward {

View file

@ -12,6 +12,15 @@
# this server is teh firewall # this server is teh firewall
skynet_firewall = { skynet_firewall = {
# always good to know oneself
own_ip = "192.168.1.157";
# 443 is an ssh port now (heh)
own_ports = [
22
443
];
enable = true; enable = true;
# gonna have to get all the # gonna have to get all the