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

Possible parse errors in hiera data input #305

Closed
tnail opened this issue Dec 18, 2020 · 1 comment
Closed

Possible parse errors in hiera data input #305

tnail opened this issue Dec 18, 2020 · 1 comment

Comments

@tnail
Copy link

tnail commented Dec 18, 2020

Affected Puppet, Ruby, OS and module versions/distributions

  • Puppet: 5.5.12
  • Ruby: 2.5.5
  • Distribution: RHEL 8.3
  • Module version: 4.3.0

How to reproduce (e.g Puppet code you use)

Hiera data::
firewalld::ipsets:
appadmin:
type: 'hash:net'
options:
family: 'inet'
entries:

  • '(redacted)' # Access Network

firewalld::services:
http:
ensure: present
service: http
zone: public
https:
ensure: present
service: https
zone: public

What are you seeing

We are trying to add firewall rules via hiera data. Puppet seems to parse the hiera data and create a rule set for it, but the resulting JSON blob fails to get added. The firewall fails open, with no rules (as expected), and we can't manually reload or affect rule changes from the command-line or from Puppet/Hiera. Error responses are of the form:

2020-12-16 05:15:43 ERROR: COMMAND_FAILED: 'python-nftables' failed: internal:0:0-0: Error: Could not process rule: Dire ctory not empty internal:0:0-0: Error: Could not process rule: Directory not empty internal:0:0-0: Error: Could not process rule: Directory not empty internal:0:0-0: Error: Could not process rule: Directory not empty internal:0:0-0: Error: Could not process rule: Directory not empty . . . (ellipsis mine)

With JSON blobs in the logfiles like:

JSON blob: {"nftables": [{"metainfo": {"json_schema_version": 1}}, {"add": {"set": {"family": "inet", "table": "firewalld", "name": "management", "type": "ipv4_addr", "flags": ["interval"]}}}, {"add": {"set": {"family": "ip", "table": "firewalld", "na me": "management", "type": "ipv4_addr", "flags": ["interval"]}}}, {"add": {"set": {"family": "ip6", "table": "firewalld" , "name": "management", "type": "ipv4_addr", "flags": ["interval"]}}}, {"flush": {"set": {"family": "inet", "table": "fi rewalld", "name": "management"}}}, {"flush": {"set": {"family": "ip", "table": "firewalld", "name": "management"}}}, {"f lush": {"set": {"family": "ip6", "table": "firewalld", "name": "management"}}}, {"add": {"element": {"family": "inet", "table": "firewalld", "name": "management", "elem": [{"prefix": {"addr": "10.32.9.32", "len": 27}}]}}}, {"add": {"element": {"family": "ip", "table": "firewalld", "name": "management", "elem": [{"prefix": {"addr": "10.32.9.32", "len": 27}}]}}}, {"add": {"element": {"family": "ip6", "table": "firewalld", "name": "management", "elem": [{"prefix": {"addr": "10.32.9.32", "len": 27}}]}}}, {"add": {"element": {"family": "inet", "table": "firewalld", "name": "management", "elem": ["10.32.9.51"]}}}, {"add": {"element": {"family": "ip", "table": "firewalld", "name": "management", "elem": ["10.32.9.51"]}}}, {"add": {"element": {"family": "ip6", "table": "firewalld", "name": "management", "elem": ["10.32.9.51"]}}}, {"add": {"element": {"family": "inet", "table": "firewalld", "name": "management", "elem": ["10.32.9.50"]}}}, {"add": {"element": {"family": "ip", "table": "firewalld", "name": "management", "elem": ["10.32.9.50"]}}}, {"add": {"element": {"family": "ip6", "table": "firewalld", "name": "management", "elem": ["10.32.9.50"]}}}, {"add": {"element": {"family": "inet", "table": "firewalld", "name": "management", "elem": [{"prefix": {"addr": "10.50.10.32", "len": 28}}]}}}, {"add": {"element": {"family": "ip", "table": "firewalld", "name": "management", "elem": [{"prefix": {"addr": "10.50.10.32", "len": 28}}]}}}, {"add": {"element": {"family": "ip6", "table": "firewalld", "name": "management", "elem": [{"prefix": {"addr": "10.50.10.32", "len": 28}}]}}}]}

There are errors in these blobs (e.g., "f lush", and ipv4 addresses in ipv6 elements) , which might be the cause of the issues we're seeing.

What behaviour did you expect instead

Expectation was that hiera data would be parsed and put into rulesets with firewalld being restarted with the new running rules in place. Manual intervention via the command-line would also be available.

Output log

see above.

Any additional information you'd like to impart

@tnail
Copy link
Author

tnail commented Jan 5, 2021

This has been resolved: we checked debug output against the hiera data we had on file and found an overlap in one of the ipsets between a network definition (e.g., 10.32.9.32/27) and a host IP within that network (e.g., 10.32.9.51/32). Removing the individual host IPs allowed the parser to work correctly.

@tnail tnail closed this as completed Jan 5, 2021
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

1 participant