Hello Paul,
We have actually been planning to introduce the possibility to specify the
port number in DNAT rules embedded to filters. We agreed on a syntax like
this to make it clear that "to-port" is related to DNAT:
"dnat": { "to-addr": "<IP address>", "to-port": <port> }
Unfortunately, a valid implementation is a bit more complex than your
patch. Please check out the class named TranslatingRule to see how the
IPv4 addresses are overridden by the DNAT target address, in order to make
the iptables filter rules match. A similar translation is needed for the
port number in the IPv4 (but not IPv6) rules. Preferably, the
implementation would also verify that the affected services are not using
any other protocol than TCP and UDP when port translation is applied.
In case you still want to try to implement the feature, here are a couple
of hints: You might need to add some hooks to the base class, i.e.
awall.model.Rule. In addition, it might make sense to move the
functionality of Rule:servoptfrags to a new class (Service) to make it
available via the awall.model.ConfigObject:create mechanism.
BR,
Kaarle
---
Unsubscribe: alpine-devel+unsubscribe@lists.alpinelinux.org
Help: alpine-devel+help@lists.alpinelinux.org
---