Skip to content

Instantly share code, notes, and snippets.

@nickjenkin
Created January 6, 2012 02:15
Show Gist options
  • Select an option

  • Save nickjenkin/1568588 to your computer and use it in GitHub Desktop.

Select an option

Save nickjenkin/1568588 to your computer and use it in GitHub Desktop.
puppet hacks ftl
define firewall::open_restricted_port($proto = 'tcp') {
$port = $name
$str = strip(generate("/etc/puppet/bin/mungeip.py"))
$iplist = split($str, ':')
$names = prefix($iplist, "100 allow restricted ${proto}-${port}/")
firewall::open_port_loop_hack {$names:
proto => $proto,
port => $port,
}
}
define firewall::open_port_loop_hack($port, $proto) {
$bits = split($name, '/')
$source = $bits[1]
firewall {$name:
proto => $proto,
dport => $port,
action => 'accept',
source => $source
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment