Show HN: unsock: shim to automatically change AF_INET sockets to AF_UNIX, etc.
github.com
It even handles the painful "CONNECT" proxy dance on Firecracker AF_UNIX/AF_VSOCK multiplexing sockets for you.
github.com
It even handles the painful "CONNECT" proxy dance on Firecracker AF_UNIX/AF_VSOCK multiplexing sockets for you.
As far as I can tell the main differences are 1. ip2unix is AF_UNIX-only (but does map AF_INET6), and 2. that it maintains an internal mapping instead of using dup3.
This teaches people it's OK to use predictable names in /tmp. Don't do that.
However, I can see that running code in a Hypervisor environment may benefit from static linking, and yes, unsock may have a hard time intercepting the syscalls.
In that scenario, I think adding kernel-level support for the mapping, like what libkrun's "Transparent Socket Impersonation" patches attempt, may be a viable alternative (see README.md)
I haven't deeply looked into it, but there's also the seccomp/ptrace interception route, which could achieve something like that from userland, but I suspect it's too heavy on performance.