2015-12-26 04:55:13 +00:00
|
|
|
{ config, lib, pkgs, ... }:
|
2015-12-12 17:05:19 +00:00
|
|
|
|
2016-12-26 12:29:06 +00:00
|
|
|
{
|
|
|
|
users.users.mainUser.extraGroups = [ "libvirtd" ];
|
2015-12-12 17:05:19 +00:00
|
|
|
virtualisation.libvirtd.enable = true;
|
|
|
|
|
2016-12-26 12:29:39 +00:00
|
|
|
krebs.iptables.tables.filter.INPUT.rules = [
|
|
|
|
{ v6 = false; predicate = "-i virbr0 -p udp -m udp --dport 53"; target = "ACCEPT"; }
|
|
|
|
{ v6 = false; predicate = "-i virbr0 -p tcp -m tcp --dport 53"; target = "ACCEPT"; }
|
|
|
|
{ v6 = false; predicate = "-i virbr0 -p udp -m udp --dport 67"; target = "ACCEPT"; }
|
|
|
|
{ v6 = false; predicate = "-i virbr0 -p tcp -m tcp --dport 67"; target = "ACCEPT"; }
|
|
|
|
];
|
|
|
|
krebs.iptables.tables.filter.FORWARD.rules = [
|
|
|
|
{ v6 = false; predicate = "-d 192.168.122.0/24 -o virbr0 -m conntrack --ctstate RELATED,ESTABLISHED"; target = "ACCEPT"; }
|
|
|
|
{ v6 = false; predicate = "-s 192.168.122.0/24 -i virbr0"; target = "ACCEPT"; }
|
|
|
|
{ v6 = false; predicate = "-i virbr0 -o virbr0"; target = "ACCEPT"; }
|
|
|
|
{ v6 = false; predicate = "-o virbr0"; target = "REJECT --reject-with icmp-port-unreachable"; }
|
|
|
|
{ v6 = false; predicate = "-i virbr0"; target = "REJECT --reject-with icmp-port-unreachable"; }
|
|
|
|
];
|
|
|
|
krebs.iptables.tables.filter.OUTPUT.rules = [
|
|
|
|
{ v6 = false; predicate = "-o virbr0 -p udp -m udp --dport 68"; target = "ACCEPT"; }
|
|
|
|
];
|
2018-05-16 18:19:57 +00:00
|
|
|
krebs.iptables.tables.nat.PREROUTING.rules = [
|
|
|
|
{ v6 = false; predicate = "-s 192.168.122.0/24"; target = "ACCEPT"; precedence = 1000; }
|
|
|
|
];
|
2016-12-26 12:29:39 +00:00
|
|
|
krebs.iptables.tables.nat.POSTROUTING.rules = [
|
|
|
|
{ v6 = false; predicate = "-s 192.168.122.0/24 -d 224.0.0.0/24"; target = "RETURN"; }
|
|
|
|
{ v6 = false; predicate = "-s 192.168.122.0/24 -d 255.255.255.255"; target = "RETURN"; }
|
|
|
|
{ v6 = false; predicate = "-s 192.168.122.0/24 ! -d 192.168.122.0/24"; target = "MASQUERADE"; }
|
|
|
|
{ v6 = false; predicate = "-s 192.168.122.0/24 ! -d 192.168.122.0/24 -p tcp"; target = "MASQUERADE --to-ports 1024-65535"; }
|
|
|
|
{ v6 = false; predicate = "-s 192.168.122.0/24 ! -d 192.168.122.0/24 -p udp"; target = "MASQUERADE --to-ports 1024-65535"; }
|
|
|
|
];
|
2015-12-12 17:05:19 +00:00
|
|
|
}
|