-
Notifications
You must be signed in to change notification settings - Fork 24
feat: add rich rules #971
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
feat: add rich rules #971
Conversation
411d5cb to
9e982bf
Compare
9e982bf to
af79217
Compare
af79217 to
b31521b
Compare
This can be usefull to: - redirect a public to an internal port (NethVoice proxy) - forward a public port to a remote host - create complex rules for the default zone
b31521b to
9c51905
Compare
9c51905 to
39f7dce
Compare
12599f1 to
040f010
Compare
040f010 to
6130de7
Compare
936a87a to
6130de7
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR adds support for managing firewall rich rules at the node level, enabling applications like NethVoice Proxy to configure advanced firewall rules programmatically. The implementation introduces two new node actions (add-rich-rules and remove-rich-rules) with corresponding Python helper functions in the agent module.
Key changes:
- New node actions with JSON schema validation for adding and removing firewall rich rules using
firewall-cmd - Agent module functions
add_rich_rules()andremove_rich_rules()for programmatic access - Permission grants for
fwadmandportsadmroles (incomplete - missingtunadmgrants)
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
core/imageroot/var/lib/nethserver/node/actions/add-rich-rules/50add |
Python script to add rich rules and reload firewall configuration |
core/imageroot/var/lib/nethserver/node/actions/add-rich-rules/validate-input.json |
JSON schema validation for add-rich-rules input |
core/imageroot/var/lib/nethserver/node/actions/remove-rich-rules/50remove |
Python script to remove rich rules and reload firewall configuration |
core/imageroot/var/lib/nethserver/node/actions/remove-rich-rules/validate-input.json |
JSON schema validation for remove-rich-rules input |
core/imageroot/usr/local/agent/pypkg/agent/__init__.py |
Added add_rich_rules() and remove_rich_rules() helper functions |
core/imageroot/var/lib/nethserver/cluster/actions/add-node/50update |
Grants permissions for new actions when adding nodes (incomplete role coverage) |
core/imageroot/var/lib/nethserver/node/install-finalize.sh |
Grants permissions for new actions during node initialization (incomplete role coverage) |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
core/imageroot/var/lib/nethserver/node/actions/remove-rich-rules/50remove
Show resolved
Hide resolved
core/imageroot/var/lib/nethserver/node/actions/add-rich-rules/50add
Outdated
Show resolved
Hide resolved
core/imageroot/var/lib/nethserver/node/actions/add-rich-rules/50add
Outdated
Show resolved
Hide resolved
core/imageroot/var/lib/nethserver/node/actions/remove-rich-rules/50remove
Outdated
Show resolved
Hide resolved
Co-authored-by: Copilot <[email protected]>
This pull request adds support for managing firewall rich rules at the node level.
This feature is required for NethVoice Proxy.
Fixes NethServer/dev#7725
Fixes NethServer/dev#7776
Firewall rich rule management:
add_rich_rulesandremove_rich_rulesfunctions toagent/__init__.pyto enable adding and removing arrays of rich rules on a node usingfirewall-cmd.add-rich-rulesandremove-rich-rules, each with a Python script to apply or remove rich rules and reload the firewall configuration. [1] [2]Permission and role updates:
add-node/50updateandnode/install-finalize.shscripts to grantadd-rich-rulesandremove-rich-rulespermissions to relevant roles (fwadm,portsadm,tunadm). [1] [2] [3] [4]Usage example
Add rules:
Remove rules:
Update an existing machine
Install a new machine