From c9dbae56a34775b6e4e49b24535a8e6bacb0e7ce Mon Sep 17 00:00:00 2001 From: FĂ©lix Sipma Date: Mon, 7 Mar 2016 14:41:19 +0100 Subject: Firewall: add NatDestination to Rules (cherry picked from commit df40046fd65bc07eced41adb73c7e227d2b54cd1) --- src/Propellor/Property/Firewall.hs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/Propellor/Property/Firewall.hs b/src/Propellor/Property/Firewall.hs index ec814c37..fa1f95d4 100644 --- a/src/Propellor/Property/Firewall.hs +++ b/src/Propellor/Property/Firewall.hs @@ -87,6 +87,10 @@ toIpTableArg (Destination ipwm) = [ "-d" , intercalate "," (map fromIPWithMask ipwm) ] +toIpTableArg (NatDestination ip mport) = + [ "--to-destination" + , fromIPAddr ip ++ maybe "" (\p -> ":" ++ fromPort p) mport + ] toIpTableArg (r :- r') = toIpTableArg r <> toIpTableArg r' data IPWithMask = IPWithNoMask IPAddr | IPWithIPMask IPAddr IPAddr | IPWithNumMask IPAddr Int @@ -177,6 +181,7 @@ data Rules | TCPSyn | Source [ IPWithMask ] | Destination [ IPWithMask ] + | NatDestination IPAddr (Maybe Port) | Rules :- Rules -- ^Combine two rules deriving (Eq, Show) -- cgit v1.2.3