!VhzbGHamdfMiGxpXyg:robins.wtf

NixOS LXC

33 Members
lxc, lxd, incus discussions related to NixOS14 Servers

Load older messages


SenderMessageTime
18 Mar 2024
@mkg20001:mkg20001.iomkg20001if i have, say, a vpn or something else on that server13:58:21
@adam:robins.wtfadamcstephensyeah13:58:36
@adam:robins.wtfadamcstephensthis is the problem with defaulting firewall rules :)13:58:44
@mkg20001:mkg20001.iomkg20001what do you think of the named set? should i go implement that?13:59:08
@adam:robins.wtfadamcstephensso what does that look like? a table that allows a named set of interfaces for trusting, and what updates that set/13:59:47
@adam:robins.wtfadamcstephens * so what does that look like? a table that allows a named set of interfaces for trusting, and what updates that set?13:59:49
@adam:robins.wtfadamcstephenshow would you hook into incus/lxd?14:01:06
@mkg20001:mkg20001.iomkg20001 nft add element inet nixos-fw trustedintfs { incusbr0 } is the command to add to the set 14:02:23
@mkg20001:mkg20001.iomkg20001 incus could support an INTERFACE_UP_HOOK / INTERFACE_DOWN_HOOK where the host os could supply the command to open the firewall for the interface, there we could use something like nft add element inet nixos-fw trustedintfs { $INTERFACE } 14:03:15
@adam:robins.wtfadamcstephensi wonder if this should really be handled by incus directly. they're spinning up dnsmasq on interfaces, why aren't they creating rules to allow access to it?14:03:51
@mkg20001:mkg20001.iomkg20001the problem is that in nftables an accept in one table doesn't mean the package is accepted, only that it will go to the next chain with lower priority, i think14:04:43
@mkg20001:mkg20001.iomkg20001that's why all the incus rules have policy accept set14:05:21
@adam:robins.wtfadamcstephensyeah i think that's right14:05:26
@adam:robins.wtfadamcstephens
In reply to @mkg20001:mkg20001.io
incus could support an INTERFACE_UP_HOOK / INTERFACE_DOWN_HOOK where the host os could supply the command to open the firewall for the interface, there we could use something like nft add element inet nixos-fw trustedintfs { $INTERFACE }
does this hook already exist?
14:06:36
@mkg20001:mkg20001.iomkg20001no. it would need to be added to incus.14:06:54
@adam:robins.wtfadamcstephensmaybe that's the first step then. without a hook there's not a great dynamic way for us to handle networks coming and going14:08:16
@adam:robins.wtfadamcstephensalso it should be flexible enough to know when dhcp is enabled on a network, because if not then we likely don't need this firewall rule14:11:43
@mkg20001:mkg20001.iomkg20001we still need to allow forward traffic and in such a way that only incus interfaces are allowed. which trustedInterface also handles.14:17:46
@mkg20001:mkg20001.iomkg20001so we'll need it always14:17:52
@adam:robins.wtfadamcstephenstrusted interface isn't setting a forwarding rule on my laptop 14:22:50
@adam:robins.wtfadamcstephens

it's only creating an input rule


        chain input {
                type filter hook input priority filter; policy drop;
                iifname { "lo", "incusbr0" } accept comment "trusted interfaces"
14:23:23
@adam:robins.wtfadamcstephensforwarding is handled separately, in the other table i included aboe14:23:57
@mkg20001:mkg20001.iomkg20001you need networking.firewall.filterForward = true;14:27:21
@adam:robins.wtfadamcstephenshttps://github.com/NixOS/nixpkgs/blob/3551c607f454ee855e54db5686464c8dcf83ceae/nixos/modules/services/networking/firewall-nftables.nix#L9214:27:50
@mkg20001:mkg20001.iomkg20001ah wait, yes, i had it added manually. thought filterForward would do that.14:28:55
@mkg20001:mkg20001.iomkg20001we could add something that packets with iifname or oifname contained in trustedInterfaces be allowed14:29:27
@mkg20001:mkg20001.iomkg20001 * we could add something that packets with iifname and/or oifname contained in trustedInterfaces be allowed14:29:33
@adam:robins.wtfadamcstephensi've not used filterForward myself14:29:36
@adam:robins.wtfadamcstephensi'd honestly rather not get too tricky with this. i think the goals should be a working out of box experience for those who are taking a simple/default setup, without making assumptions that will affect those who have more complex/advanced needs.14:32:30
@adam:robins.wtfadamcstephensor we just solve this with documentation14:34:10

Show newer messages


Back to Room ListRoom Version: 10