SYSTEMD-SOCKET-PROXYD(8)
๐ systemd-socket-proxyd(8) ๐
okay bestie, so this is the manual page for systemd-socket-proxyd, from the systemd fam (version 262.1, for the record). it's a lil daemon with main character energy and it does exactly one thing but does it SO well. sit down, grab a strawberry ๐, let's go.
โจ NAME โจ
systemd-socket-proxyd โ bidirectionally proxy local sockets to another (possibly remote) socket ๐ฆ
๐ SYNOPSIS ๐
systemd-socket-proxyd [OPTIONS...] HOST:PORT
systemd-socket-proxyd [OPTIONS...] UNIX-DOMAIN-SOCKET-PATH
๐ธ DESCRIPTION ๐ธ
systemd-socket-proxyd is a generic socket-activated network socket forwarder proxy daemon, and it handles IPv4, IPv6 and UNIX stream sockets. literally all three. it's that versatile ๐
what it does is take traffic coming into a local listening socket and bi-directionally forward it to a local or remote destination socket. both ways. like a group chat relay but for sockets.
so here's the iconic use case: some services are, sadly, not born with socket activation support (tragic, i know ๐ญ). this tool fixes that. on behalf of the service you wanna activate, the proxy inherits the socket from systemd, accepts every single client connection, opens a connection to a configured server for each one of those clients, and then bidirectionally forwards data between the two. slay.
ngl the behavior is similar to socat(1). but here's the glow-up: systemd-socket-proxyd supports socket activation with Accept=no, and it has an event-driven design that scales way better as the number of connections grows. so when things get busy it doesn't crumble. periodt.
โ ๏ธ important bestie:systemd-socket-proxydwill not forward socket side channel information. that means noSCM_RIGHTS, noSCM_CREDENTIALS, noSCM_SECURITY, noSO_PEERCRED, noSO_PEERPIDFD, noSO_PEERSEC, noSO_PEERGROUPS, and nothing similar. it's just not doing it. don't ask ๐
โจ OPTIONS โจ
here's what it understands, bestie:
-h,--helpโ prints a short help text and dips. ๐ซถ--versionโ prints a short version string and dips. ๐--connections-max=,-cโ sets the max number of simultaneous connections. defaults to256. if you hit the limit of concurrent connections, any further connections get refused. sorry babe, capacity is capacity ๐
Added in version 233.
--exit-idle-time=โ sets how long it waits before exiting when there are zero connections. defaults to infinity (so... never, lowkey immortal). takes a unit-less value in seconds, or a time span value like"5min 20s". ๐
Added in version 246.
--proxy-protocol=โ uses the PROXY protocol[1] to talk to the server. this lets an appropriately configured server know the real client IP address. takes the version of the PROXY protocol[1] used, and only supports"v1"for now. default is to not use a PROXY protocol at all.
Added in version 261.
๐ฅ EXIT STATUS ๐ฅ
on success, 0 is returned. a non-zero failure code otherwise. that's it, that's the whole vibe check. โ
๐ EXAMPLES ๐
๐ง Simple Example
use two services with a dependency and no namespace isolation.
Example 1. proxy-to-nginx.socket
[Socket]
ListenStream=80
[Install]
WantedBy=sockets.target
Example 2. proxy-to-nginx.service
[Unit]
Requires=nginx.service
After=nginx.service
Requires=proxy-to-nginx.socket
After=proxy-to-nginx.socket
[Service]
Type=notify
ExecStart=/usr/lib/systemd/systemd-socket-proxyd /run/nginx/socket
PrivateTmp=yes
PrivateNetwork=yes
Example 3. nginx.conf
[...]
server {
listen unix:/run/nginx/socket;
[...]
Example 4. Enabling the proxy
# systemctl enable --now proxy-to-nginx.socket
$ curl http://localhost:80/
if nginx.service has StopWhenUnneeded= set, then passing --exit-idle-time= to systemd-socket-proxyd lets both services stop during idle periods. cute, efficient, no wasted resources. obsessed. ๐
๐ฆ Namespace Example
similar as above, but it runs the socket proxy and the main service in the same private namespace โ assuming that nginx.service has PrivateTmp= and PrivateNetwork= set, too. everyone's in the same lil room together ๐ซถ
Example 5. proxy-to-nginx.socket
[Socket]
ListenStream=80
[Install]
WantedBy=sockets.target
Example 6. proxy-to-nginx.service
[Unit]
Requires=nginx.service
After=nginx.service
Requires=proxy-to-nginx.socket
After=proxy-to-nginx.socket
JoinsNamespaceOf=nginx.service
[Service]
Type=notify
ExecStart=/usr/lib/systemd/systemd-socket-proxyd 127.0.0.1:8080
PrivateTmp=yes
PrivateNetwork=yes
Example 7. nginx.conf
[...]
server {
listen 8080;
[...]
Example 8. Enabling the proxy
# systemctl enable --now proxy-to-nginx.socket
$ curl http://localhost:80/
๐ PROXY protocol example with nginx
systemd-socket-proxyd and nginx, using the PROXY protocol. the crossover episode nobody knew they needed โจ
Example 9. proxy-to-nginx.socket
[Socket]
ListenStream=80
[Install]
WantedBy=sockets.target
Example 10. proxy-to-nginx.service
[Unit]
Requires=nginx.service
After=nginx.service
Requires=proxy-to-nginx.socket
After=proxy-to-nginx.socket
[Service]
Type=notify
ExecStart=/usr/lib/systemd/systemd-socket-proxyd --proxy-protocol=v1 /run/nginx/socket
PrivateTmp=yes
PrivateNetwork=yes
Example 11. nginx.conf
[...]
server {
listen unix:/run/nginx/socket proxy_protocol;
real_ip_header proxy_protocol;
[...]
Example 12. Enabling the proxy
# systemctl enable --now proxy-to-nginx.socket
$ curl http://localhost:80/
โญ SEE ALSO โญ
systemd(1), systemd.socket(5), systemd.service(5), systemctl(1), socat(1), nginx(1), curl(1), PROXY protocol specification[1], nginx: Accepting the PROXY Protocol[2]
๐ NOTES ๐
- PROXY protocol https://www.haproxy.org/download/1.8/doc/proxy-protocol.txt
- nginx: Accepting the PROXY Protocol https://docs.nginx.com/nginx/admin-guide/load-balancer/using-proxy-protocol/
and that's the whole page, bestie!! ๐ this was systemd 262.1, SYSTEMD-SOCKET-PROXYD(8), and honestly? iconic of it. go forth and proxy bidirectionally, you absolute legend ๐โจ๐ฆ
๐ฆ where this page comes from
- arch rolling: systemd 262.1-1 ยท LGPL-2.1-or-later AND CC0-1.0 AND GPL-2.0-or-later AND MIT-0
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms