Other Filter packets by user then redirect

Hello,
I'm very new to FreeBSD, also I don't need to do anything fancy except filtering packets from a specific user from the loopback interface then redirecting those packets to a proxy server.
I have something like this:
Code:
redir_ports = "{http, https}"
tproxy = "127.0.0.1 port 8090"
rdr pass proto tcp from any to any port $redir_ports -> $tproxy
pass out route-to (lo0 127.0.0.1) proto tcp from any to any port $redir_ports user user2

I know there is "tag" property that I can use, however, I don't know what the right syntax is for this specific case. What I want is tagging any outgoing traffics by that particular user, then redirecting those tagged traffics to the proxy. By doing that I can add other rules for other users.
Can someone please help me with this?
Thank you in advance
 
The information of the 'user' isn't stored in a TCP/IP packet. So you can't filter on information that isn't there. Having said that, PF does have a 'user' filter, but this only works for packets that originate on the PF host itself.

Code:
     user ⟨user⟩
           This rule only applies to packets of sockets owned by the specified
           user.  For outgoing connections initiated from the firewall, this
           is the user that opened the connection.  For incoming connections
           to the firewall itself, this is the user that listens on the
           destination port.  For forwarded connections, where the firewall is
           not a connection endpoint, the user and group are unknown.
 
Back
Top