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

Extend firewall plugin (for API support) with snat support [tracking ticket] #1749

Closed
AdSchellevis opened this issue Mar 23, 2020 · 5 comments
Assignees
Labels
feature Adding new functionality

Comments

@AdSchellevis
Copy link
Member

In #1720 we worked on API support for the basic firewall features, this ticket describes the extension with source (outbound) nat rules.

Scope:

This feature addition is not about: port forwards and 1:1 rules, these are destination type nat rules, which therefor lie outside the scope of this ticket.

At minimum this plugin should provide the possibility to use standard API endpoints, similar to the ones for all other new style features.

The rules settings provided should be the following:

  • Disabled (ignore rule)
  • Interface (one of the registered interfaces, such as wan)
  • TCP/IP Version (ipv4 or ipv6)
  • Protocol (Single registered protocol, such as tcp, udp, icmp)
  • Source (a single host or network [cidr] or a registered alias) + Invert option
  • Destination (same options as source) + Invert option
  • Translation target (Either an address or registered alias)
  • Description (user friendly description)
  • Log (enable logging)

Existing (manual) rules can't be changed with this plugin, since they live in another section of the configuration (separation of concerns).

The rules created by the api don't depend on mode settings of the outbound nat rules, such as "Manual outbound NAT rule generation" or "Hybrid outbound NAT rule generation".
Since automatic rules are not visible elsewhere in the gui, it's imperative that this plugin has a simple user interface to retain visibility.

@AdSchellevis AdSchellevis added the feature Adding new functionality label Mar 23, 2020
@AdSchellevis AdSchellevis self-assigned this Mar 23, 2020
AdSchellevis added a commit to opnsense/core that referenced this issue Mar 25, 2020
… different prefixes than "M" when sharing the same namespace. While here, also perform a style sweep.

Needed for opnsense/plugins#1749 (using the same namespace as the aliases in core)
AdSchellevis added a commit that referenced this issue Mar 25, 2020
It's probably better to keep (filter)rules and source nat rules combined, so we can stick to the same rollback pattern and guarantee a consistent set when performing a rollback.
AdSchellevis added a commit to opnsense/docs that referenced this issue Mar 26, 2020
AndyX90 pushed a commit to AndyX90/core that referenced this issue Mar 29, 2020
… different prefixes than "M" when sharing the same namespace. While here, also perform a style sweep.

Needed for opnsense/plugins#1749 (using the same namespace as the aliases in core)
AdSchellevis added a commit that referenced this issue Mar 30, 2020
- reuse filter template, link endpoint to selected controller (filter/snat)
- push shared code to FilterBaseController
AdSchellevis added a commit that referenced this issue Apr 7, 2020
… possible to call api/firewall/filter_base endpoints directly, for #1749
AdSchellevis added a commit to opnsense/docs that referenced this issue Apr 7, 2020
…sses, add used model when using standard templates.

needed to better explain documentation for opnsense/plugins#1749
@AdSchellevis
Copy link
Member Author

(internal reference) this point should be in 20.1.4-devel

AdSchellevis added a commit that referenced this issue Apr 8, 2020
since filter rules and source nat rules share source and destination constructions, we can easily loop over the types and detect if source nat fields exists when  validating.
fichtner pushed a commit to opnsense/core that referenced this issue Apr 20, 2020
fichtner pushed a commit to opnsense/core that referenced this issue Apr 20, 2020
… different prefixes than "M" when sharing the same namespace. While here, also perform a style sweep.

Needed for opnsense/plugins#1749 (using the same namespace as the aliases in core)

(cherry picked from commit c81b5b8)
@wrobelda
Copy link

wrobelda commented Nov 23, 2022

This feature addition is not about: port forwards and 1:1 rules, these are destination type nat rules, which therefor lie outside the scope of this ticket.

I did not find a relevant issue for this, nor a better place to ask: I am wondering if you have DNAT support in Firewall Plugin in scope for near future?

(EDIT: found this thread, which is relevant https://forum.opnsense.org/index.php?topic=25861.0)

@AdSchellevis
Copy link
Member Author

@wrobelda not really, we build this for a client back in the days, it's not extremely difficult to add portforwards in terms of complexity but for us there's no business case at the moment.

@wrobelda
Copy link

Thanks for a quick response. I need a programmatic access to a DNAT rule, but luckily the "Alias" workaround laid out in the thread I linked should be sufficient.

@AdSchellevis
Copy link
Member Author

you could also consider the relayd plugin (https://docs.opnsense.org/manual/relayd.html) when it comes to forwarding

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature Adding new functionality
Development

No branches or pull requests

2 participants