0

I've been searching high and low for days and I'm 100% stuck with PF. Essentially I want to take all of my local, outbound traffic to ip/port redirect it to a different ip/port.

local application trying to connect to ip 1.2.3.4 and port 1234, i need to redirect this traffic to ip 5.6.7.8 and port 4321 (port could be same)

I've tried every rdr combo I came across and none of them seem to work.

Could someone please point me in the right direction on how to do this? What would the rules look like in my pf.conf/anchor file?

OS X is 10.15: "Catalina"

or OSX users not need such functionality?)

2 Answers 2

1
  1. https://etcinsider.com/blog/2016/02/28/openbsd-pf-for-mac-os-x-is-mostly-outdated/
  2. man pf.conf: "… Evaluation order of the translation rules is dependent on the type of the translation rules and of the direction of a packet. binat rules are always evaluated first. Then either the rdr rules are evaluated on an inbound packet or the nat rules on an outbound packet. Rules of the same type are evaluated in the same order in which they appear in the ruleset. The first matching rule decides what action is taken. …"

or OSX users not need such functionality?)

It's not users who develop MacOS, but Apple… PF firewall isn't of theirs priorities one should conclude.

0

Well, as for me - only one working solution:

sudo ifconfig en0 alias 1.2.3.4 255.255.255.0

and install local portforwarder like nginx, add under "stream" section:

server { listen 1.2.3.4:1234; proxy_pass 5.6.7.8:5678; }

you can use your favorite portforwarder software, or try to dig into pf)

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .