Skip to contentSkip to conversation

How to get access to NAT info from userland

DISCUSSION Brian G 2 participants 5 messages Apr 2, 2011 – Apr 14, 2011 1 message not in the archive netfilter

lore
Share & tools
lore

Brian G

author
#0 lore raw

I have a socket, IPv4. It is being transparent proxied to userland via a REDIRECT NAT target.

Is there any getsocketopt() or any syscall so I can get the REAL destination address off this socket from userland?

If not, I still need to know the TRUE DESTINATION when using a transparent proxy so I know where to send to request. What needs to added to the kernel (e.g. like an iptables TARGET) to get this info.

- Brian G

A message that is not in the archive (sent off-list or not yet received): [email protected]

author
#2 lore raw
Quoted 5 lines · Sam Roberts
Quoted 3 lines · Brian G

If not, I still need to know the TRUE DESTINATION when using a transparent proxy so I know where to send to request. What needs to added to the kernel (e.g. like an iptables TARGET) to get this info.

Does the conntrack -L output have the info you'd like?

Probably. Too bad my distro (CentOS) doesn't seem to provide this binary.

Quoted 1 line

Sam

Brian

#3 lore raw
Quoted 7 lines · Brian G
Quoted 5 lines · Sam Roberts
Quoted 3 lines · Brian G

If not, I still need to know the TRUE DESTINATION when using a transparent proxy so I know where to send to request. What needs to added to the kernel (e.g. like an iptables TARGET) to get this info.

Does the conntrack -L output have the info you'd like?

Probably. Too bad my distro (CentOS) doesn't seem to provide this binary.

Ye, enterprise distributions have a bad track record for shipping the complete NF suite. Avoid :/

author
#4 lore raw
Quoted 7 lines · Jan Engelhardt
Quoted 4 lines · Brian G
Quoted 2 lines · Sam Roberts

On Sat, Apr 2, 2011 at 1:23 AM, Brian G<[email protected]> wrote:
Does the conntrack -L output have the info you'd like?

Probably. Too bad my distro (CentOS) doesn't seem to provide this binary.

Ye, enterprise distributions have a bad track record for shipping the complete NF suite. Avoid :/

TPROXY will work, it should become commonplace by the time IPv6 gets going strong. Someone on stackoverflow answered my question, although he called tproxy a 'hack'. It will work fine so long as it doesn't hinder performance.

Brian G.

#5 lore raw
Quoted 5 lines · Brian G
Quoted 4 lines · Jan Engelhardt
Quoted 3 lines · Brian G
Quoted 2 lines · Sam Roberts

On Sat, Apr 2, 2011 at 1:23 AM, Brian G<[email protected]> wrote:
Does the conntrack -L output have the info you'd like?

Quoted 7 lines
Quoted 3 lines
Quoted 1 line

Probably. Too bad my distro (CentOS) doesn't seem to provide this binary.

Ye, enterprise distributions have a bad track record for shipping the complete NF suite. Avoid :/

TPROXY will work, it should become commonplace by the time IPv6 gets going strong. Someone on stackoverflow answered my question, although he called tproxy a 'hack'. It will work fine so long as it doesn't hinder performance.

Hey, if TPROXY is a hack, so is the entire NAT business in itself! :)