summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJoey Hess2017-07-27 00:19:42 -0400
committerJoey Hess2017-07-27 00:19:42 -0400
commitf88a1a8e6c25dd8029ada0400cfe6f05ca3343d7 (patch)
tree6f27ee354e88f0079b030ed0e1307f7a5728030d /src
parent973a18d822c002c1e8c0d64017a37821d760ed48 (diff)
propellor spin
Diffstat (limited to 'src')
-rw-r--r--src/Propellor/Property/SiteSpecific/JoeySites.hs16
1 files changed, 12 insertions, 4 deletions
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)