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

Request for API Support for NAT Port Forwarding Management #8401

Open
2 tasks done
TingXuanChen opened this issue Mar 5, 2025 · 0 comments
Open
2 tasks done

Request for API Support for NAT Port Forwarding Management #8401

TingXuanChen opened this issue Mar 5, 2025 · 0 comments

Comments

@TingXuanChen
Copy link

Important notices

Before you add a new report, we ask you kindly to acknowledge the following:

Is your feature request related to a problem? Please describe.

For the purpose of automating and managing NAT port forwarding through an API, I am missing a solution that will allow me to programmatically configure port forwarding rules, add or remove specific ports, and manage related NAT entries without needing to use the OPNsense GUI. This would significantly improve the flexibility and efficiency of managing network settings in an automated environment.

Describe the solution you like

I would like to request a new API endpoint under the Firewall/NAT section that will allow users to:

  • Create new port forwarding rules with the required fields like source port, destination IP, and destination port.
  • Modify existing port forwarding rules to update parameters such as destination IP or port.
  • Delete port forwarding rules by specifying a rule identifier.
  • List current NAT port forwarding rules.

For example, an endpoint like:

  • POST /api/firewall/nat/portforward to add a new rule
  • GET /api/firewall/nat/portforward to list all current port forwarding rules
  • DELETE /api/firewall/nat/portforward/{id} to remove a rule

Additionally, the API should include proper authentication (e.g., API key-based) and support for error handling in case of invalid inputs or missing parameters.

Describe alternatives you considered

Currently, OPNsense only allows configuring port forwarding rules via the web interface, which limits automation capabilities. An alternative approach is to modify configuration files directly through SSH, but this is not user-friendly and requires manual intervention. Having a built-in API for NAT port forwarding management would provide a more seamless and efficient solution.

Additional context

Adding this feature will help integrate OPNsense with automation tools, improving both scalability and ease of management, especially for environments where port forwarding rules change frequently or need to be dynamically adjusted based on certain triggers.

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

No branches or pull requests

1 participant