Skip to content

Instantly share code, notes, and snippets.

@dhollinger
Forked from pmoranga/puppet-firewall-docker.pp
Created August 18, 2017 19:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dhollinger/7c92cf3b361ba078712ff6f95d62027b to your computer and use it in GitHub Desktop.
Save dhollinger/7c92cf3b361ba078712ff6f95d62027b to your computer and use it in GitHub Desktop.
Make puppetlabs-firewall works with docker smoothly
class my_fw::pre {
# Disable due to selective purges of firewallchain
# resources { "firewall":
# purge => true
# }
# Avoid removing Docker rules:
firewallchain { 'FORWARD:filter:IPv4':
purge => true,
ignore => [ 'docker' ],
}
firewallchain { 'DOCKER:filter:IPv4':
purge => false,
}
firewallchain { 'DOCKER:nat:IPv4':
purge => false,
}
firewallchain { 'POSTROUTING:nat:IPv4':
purge => true,
ignore => [ 'docker', '172.17' ],
}
firewallchain { 'PREROUTING:nat:IPv4':
purge => true,
ignore => [ 'DOCKER' ],
}
#ensure input rules are cleaned out
firewallchain { 'INPUT:filter:IPv4':
ensure => present,
purge => true,
}
# Block what ever.....
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment