Skip to content

pfsense_nat_port_forward: accept interface-address targets (<if>ip, e.g. opt4ip) #266

Description

@wpfleger96

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

The pfSense UI allows a port forward's Redirect target IP to be an interface address (dropdown "Type: address"), stored as <target>opt4ip</target> (or lanip, wanip, ...). The module rejects these:

# plugins/module_utils/nat_port_forward.py, _parse_target_address()
if self.pfsense.find_alias(address, 'host') is not None or self.pfsense.is_ipv4_address(address):
    obj['target'] = address
else:
    self.module.fail_json(msg='"%s" is not a valid redirect target IP address or host alias.' % (param))

So an existing rule like "redirect DNS on the IoT VLAN to the firewall's own IoT address" (target: opt4ip) cannot be adopted — the only way to express it is to hard-code the interface's IP, which drifts if the interface address changes and does not match the live config key.

Describe the solution you'd like

Accept the interface-address form alongside IPs and host aliases, resolving interface names the way other modules do, e.g. target: IoT:53opt4ip, or the raw opt4ip as pfSense stores it. #103 added NET:INTERFACE handling to pfsense_nat_outbound; the same helper could back this.

Playbook

- pfsensible.core.pfsense_nat_port_forward:
    descr: Redirect IoT DNS to firewall
    interface: IoT
    protocol: tcp/udp
    source: any
    destination: "!IoT:53"
    target: "IoT:53"          # currently fails
    associated_rule: pass

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions