Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot use parameter -i for OUTPUT #203

Open
chaim1221 opened this issue Dec 20, 2018 · 2 comments
Open

Cannot use parameter -i for OUTPUT #203

chaim1221 opened this issue Dec 20, 2018 · 2 comments

Comments

@chaim1221
Copy link
Contributor

Cookbook version: 2.7.0

Chef-client version: 14.7.17

Platform Details: Mac OS X (dom0); CentOS 7 (guest)

Scenario: Allow outbound loopback.

Steps to Reproduce:

firewall_rule 'local loopback' do
   interface 'lo'
   protocol :none
   command :allow
   direction :out
end

Expected Result:

-A OUTPUT -o lo -j ACCEPT

Actual Result:

Cannot use parameter -i with OUTPUT

What should happen is that for an outbound rule, with iptables, the interface is specified with -o.

@chaim1221
Copy link
Contributor Author

Workaround:

firewall_rule 'local loopback' do
  raw '-A OUTPUT -o lo -j ACCEPT'
  position 51
#   interface 'lo'
#   protocol :none
#   command :allow
#   direction :out
end

@martinb3
Copy link
Contributor

Hi there -- here's what the cookbook is doing:

firewall_rule << "-i #{rule_resource.interface} " if rule_resource.interface
firewall_rule << "-o #{rule_resource.dest_interface} " if rule_resource.dest_interface

If you change interface 'lo' to dest_interface 'lo', it should work. We put those in different resource attributes, since they use different arguments.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants