]> git.ipfire.org Git - thirdparty/systemd.git/commit
core: populate $REMOTE_ADDR for AF_UNIX sockets
authorKamil Szczęk <kamil@szczek.dev>
Mon, 3 Jun 2024 15:56:42 +0000 (17:56 +0200)
committerLuca Boccassi <luca.boccassi@gmail.com>
Tue, 11 Jun 2024 23:11:10 +0000 (00:11 +0100)
commit608bfe76c18ea4ecda0a78a243363eebae032243
tree47de1bd5cfab5b9a6a59c5aabff3575d8f2b4f43
parentbd6e5b4d93065d759bd5159d2bd9f57cb7c40d6e
core: populate $REMOTE_ADDR for AF_UNIX sockets

Set the $REMOTE_ADDR environment variable for AF_UNIX socket connections
when using per-connection socket activation (Accept=yes). $REMOTE_ADDR
will now contain the remote socket's file system path (starting with a
slash "/") or its address in the abstract namespace (starting with an
at symbol "@").

This information is essential for identifying the remote peer in AF_UNIX
socket connections, but it's not easy to obtain in a shell script for
example without pulling in a ton of additional tools. By setting
$REMOTE_ADDR, we make this information readily available to the
activated service.
man/systemd.exec.xml
man/systemd.socket.xml
src/core/service.c