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

RHEL8/Centos8/OEL8 nftables.conf filepath #253

Open
danielpkrueger opened this issue May 12, 2022 · 5 comments
Open

RHEL8/Centos8/OEL8 nftables.conf filepath #253

danielpkrueger opened this issue May 12, 2022 · 5 comments

Comments

@danielpkrueger
Copy link
Contributor

I've been testing out firewall cookbook version 5.0.0 with OEL8. My goal is to use nftables, but I had to modify where the resource lands the created nftables.conf file. It appears that OEL8's nftables uses a different default filepath(shared with RHEL8 and CentOS8).

file '/etc/nftables.conf' do

RHEL8/Centos8/OEL8 = /etc/sysconfig/nftables.conf
Debian = /etc/nftables.conf

I understand that Debian was the only OS tested with nftables, but I'd like to expand it to OEL8. I'm curious to see what approach might be best to add this into the nftables resource.

  1. Duplicate the resource and make it OS specific?
  2. Add a OS/version check to that action?
  3. Something else entirely?
@bmhughes
Copy link

The way to go with it would be to move the file path to a resource property, then set the default value of the property to the OS specific default (via a helper method).

This should fix the bug but also allow others to override the path should they need to in the future.

@Stromweld
Copy link
Contributor

Agree with @bmhughes, this helper will help set the default value based on OS https://docs.chef.io/infra_language/checking_platforms/#value_for_platform.

@bmhughes
Copy link

I wouldn't use value_for_platform here as it doesn't fit nicely into a resource property definition (useful for recipe/attribute though). Just a normal library helper and a case will do the job cleanly example.

@danielpkrueger
Copy link
Contributor Author

Thanks for the info! I'll see what I can whip up based off the examples.

@danielpkrueger
Copy link
Contributor Author

Finally got around adding a resource property for the nftables.conf file. Created PR: #255

Stromweld pushed a commit that referenced this issue Sep 15, 2022
* Add nftables.conf location based on OS to nftables resource
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

3 participants