I have a system service that listens for commands on a UNIX domain socket in the abstract namespace. I now need to access this from a process in another network namespace. Because the socket is in the abstract namespace, it is network-namespace-specific.
I can sort of get this to work with socat:
socat ABSTRACT-CONNECT:@proxy-socket EXEC:'"ip netns exec my-netns socat STDIO ABSTRACT-LISTEN:@proxy-socket,nofork"'
This correctly listens on the socket in my namespace and proxies a connection through to the actual socket in the default namespace. But it will only do it for one connection; once that connection is closed, socat will exit.
I could do it like this:
socat ABSTRACT-LISTEN:@prooy-socket,fork EXEC:'"ip netns exec default socat STDIO ABSTRACT-CONNECT @proxy-socket,nofork"'
if ip netns exec
provided a way to exec a process in the default namespace, but it seems it doesn't.
Is there a better way of going about this?