summaryrefslogtreecommitdiff
path: root/manifests/router/hairpining.pp
diff options
context:
space:
mode:
authorSilvio Rhatto <rhatto@riseup.net>2015-09-11 21:43:49 -0300
committerSilvio Rhatto <rhatto@riseup.net>2015-09-11 21:43:49 -0300
commit279c52185ec96cd1f8b0c25a1a14b0e537c1c11a (patch)
tree58a7c463029738804df3650e33ada7ed814b728d /manifests/router/hairpining.pp
parent303e2cfcb14fb9dcec2fcda13608389f84bfb307 (diff)
downloadpuppet-firewall-279c52185ec96cd1f8b0c25a1a14b0e537c1c11a.tar.gz
puppet-firewall-279c52185ec96cd1f8b0c25a1a14b0e537c1c11a.tar.bz2
Split and rename
Diffstat (limited to 'manifests/router/hairpining.pp')
-rw-r--r--manifests/router/hairpining.pp29
1 files changed, 29 insertions, 0 deletions
diff --git a/manifests/router/hairpining.pp b/manifests/router/hairpining.pp
new file mode 100644
index 0000000..21a8d9d
--- /dev/null
+++ b/manifests/router/hairpining.pp
@@ -0,0 +1,29 @@
+# See http://www.shorewall.net/FAQ.htm#faq2
+define firewall::router::hairpinning($order = '5000', $proto = 'tcp', $port = 'www',
+ $external_ip = '$ETH0_IP', $interface = 'eth1',
+ $destination = '192.168.1.100', $source = 'eth1',
+ $source_zone = 'loc', $dest_zone = 'loc',
+ $port_dest = '') {
+ shorewall::masq { "routeback-$name":
+ interface => "$interface:$destination",
+ source => $source,
+ address => $external_ip,
+ proto => $proto,
+ port => $port,
+ order => $order,
+ }
+
+ shorewall::rule { "routeback-$name":
+ action => 'DNAT',
+ source => $source_zone,
+ destination => $port_dest ? {
+ '' => "$dest_zone:$destination",
+ default => "$dest_zone:$destination:$port_dest",
+ },
+ proto => $proto,
+ destinationport => $port,
+ ratelimit => '-',
+ order => $order,
+ originaldest => $external_ip,
+ }
+}