diff options
author | makefu <github@syntax-fehler.de> | 2016-12-28 03:40:28 +0100 |
---|---|---|
committer | makefu <github@syntax-fehler.de> | 2016-12-28 03:40:28 +0100 |
commit | c422632d0370f15d4f0b0a5ce35e79a90e49740c (patch) | |
tree | ba271e34c75085970889d62dfc76e12b4c5a1374 /lass/2configs/libvirt.nix | |
parent | 096d83fe893f5134be957bf6dfe3da99e038e8a5 (diff) | |
parent | 0d61093e18929e48ebfd984c1e0f2b6b1f0c6c58 (diff) |
Merge remote-tracking branch 'lass/master'
Diffstat (limited to 'lass/2configs/libvirt.nix')
-rw-r--r-- | lass/2configs/libvirt.nix | 43 |
1 files changed, 25 insertions, 18 deletions
diff --git a/lass/2configs/libvirt.nix b/lass/2configs/libvirt.nix index e739d2f79..a71638323 100644 --- a/lass/2configs/libvirt.nix +++ b/lass/2configs/libvirt.nix @@ -1,23 +1,30 @@ { config, lib, pkgs, ... }: -let - mainUser = config.users.extraUsers.mainUser; - inherit (import <stockholm/lib>) genid; - -in { +{ + users.users.mainUser.extraGroups = [ "libvirtd" ]; virtualisation.libvirtd.enable = true; - users.extraUsers = { - libvirt = { - uid = genid "libvirt"; - description = "user for running libvirt stuff"; - home = "/home/libvirt"; - useDefaultShell = true; - extraGroups = [ "libvirtd" "audio" ]; - createHome = true; - }; - }; - security.sudo.extraConfig = '' - ${mainUser.name} ALL=(libvirt) NOPASSWD: ALL - ''; + 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"; } + ]; + 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"; } + ]; } |