chef-cookbooks / iptables

Development repository for Chef Cookbook iptables
https://supermarket.chef.io/cookbooks/iptables
Apache License 2.0
102 stars 141 forks source link

Specifying a table with 'lines' #75

Closed marcantonio closed 7 years ago

marcantonio commented 7 years ago

Cookbook version

4.0.1

Chef-client version

12.16.42

Platform Details

Ubuntu 16.04 in AWS

Scenario:

Is there a way to specify a table when using lines rather than a template?

If not something like the following would be great:

iptables_rule 'foo' do
  lines '-I PREROUTING -p tcp -m tcp --syn --dport 80 -j CT --notrack'
  table :raw
end
marcantonio commented 7 years ago

Looks like you can achieve this with:

lines "*nat\n-A PREROUTING -i eth0 -p tcp --dport 80 -j REDIRECT --to-port 8080"

Seems a little hacky though. I included https://github.com/chef-cookbooks/iptables/issues/76 to provide the table property for use with lines. I'll provide tests if you're interested in this approach.

marcantonio commented 7 years ago

This is resolved with https://github.com/chef-cookbooks/iptables/pull/76. Thanks!