A
A
Alex Pts2014-10-20 07:58:18
firewall
Alex Pts, 2014-10-20 07:58:18

How to transfer a rule from ipfw to pfctl?

1. There is a rule for ipfw, you need the same for PF.

fwd 127.0.0.1,8080 tcp from any to any dst-port 80 in

Perhaps the rule is a bit redundant. In words, you need to send all requests to the local interface 127.0.0.1:80 to 127.0.0.1:8080
2. It is possible to add a condition, if no one answered 80, then only then send it to port 8080.
This is necessary so that mac os does not allow binding ports from 1 to 1000 and the web server has to listen on port 8080 instead of 80. But I don’t want to drag port 8080 in the url in the browser. We work in a browser with port 80, and the web server receives a request on 8080.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sergey Petrikov, 2014-10-20
@RicoX

1) Somehow, I wrote from memory, did not check.
2) Most likely it is impossible, but I'm not sure, in any case, the firewall does not exactly check whether the answer was or not.
You are wrong about macos, the built-in web server works fine on port 80:

tcp46      0      0  *.80                   *.*                    LISTEN

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question