From f88a1a8e6c25dd8029ada0400cfe6f05ca3343d7 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Thu, 27 Jul 2017 00:19:42 -0400 Subject: propellor spin --- src/Propellor/Property/SiteSpecific/JoeySites.hs | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/Propellor/Property/SiteSpecific/JoeySites.hs b/src/Propellor/Property/SiteSpecific/JoeySites.hs index a9bceafa..5c8b14a4 100644 --- a/src/Propellor/Property/SiteSpecific/JoeySites.hs +++ b/src/Propellor/Property/SiteSpecific/JoeySites.hs @@ -983,9 +983,10 @@ homeRouter = combineProperties "home router" $ props ] `before` File.hasPrivContent "/etc/ppp/pap-secrets" (Context "joeyh@arczip.com") --- | Enable IP masqerading, on whatever other interfaces come up. +-- | Enable IP masqerading, on whatever other interfaces come up than the +-- provided intif. ipmasq :: String -> Property DebianLike -ipmasq intif = script `File.hasContent` +ipmasq intif = File.hasContent ifupscript [ "#!/bin/sh" , "INTIF=" ++ intif , "if [ \"$IFACE\" = $INTIF ] || [ \"$IFACE\" = lo ]; then" @@ -997,7 +998,14 @@ ipmasq intif = script `File.hasContent` , "iptables -t nat -A POSTROUTING -o $IFACE -j MASQUERADE" , "echo 1 > /proc/sys/net/ipv4/ip_forward" ] + `before` scriptmode ifupscript + `before` File.hasContent pppupscript + [ "#!/bin/sh" + , "IFACE=$PPP_IFACE " ++ ifupscript + ] + `before` scriptmode pppupscript `requires` Apt.installed ["iptables"] - `before` (script `File.mode` combineModes (readModes ++ executeModes)) where - script = "/etc/network/if-up.d/ipmasq" + ifupscript = "/etc/network/if-up.d/ipmasq" + pppupscript = "/etc/ppp/ip-up.d/ipmasq" + scriptmode f = f `File.mode` combineModes (readModes ++ executeModes) -- cgit v1.2.3