summaryrefslogtreecommitdiffstats
path: root/man/systemd.socket.xml
diff options
context:
space:
mode:
authorKamil Szczęk <kamil@szczek.dev>2024-06-03 17:56:42 +0200
committerLuca Boccassi <luca.boccassi@gmail.com>2024-06-12 01:11:10 +0200
commit608bfe76c18ea4ecda0a78a243363eebae032243 (patch)
tree47de1bd5cfab5b9a6a59c5aabff3575d8f2b4f43 /man/systemd.socket.xml
parentcore/manager: enclose debug info acquirement in 'if (DEBUG_LOGGING)' (diff)
downloadsystemd-608bfe76c18ea4ecda0a78a243363eebae032243.tar.xz
systemd-608bfe76c18ea4ecda0a78a243363eebae032243.zip
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.
Diffstat (limited to 'man/systemd.socket.xml')
-rw-r--r--man/systemd.socket.xml9
1 files changed, 7 insertions, 2 deletions
diff --git a/man/systemd.socket.xml b/man/systemd.socket.xml
index a944efad3b..aa0e661002 100644
--- a/man/systemd.socket.xml
+++ b/man/systemd.socket.xml
@@ -424,11 +424,16 @@
services (in case of <varname>Accept=</varname><option>yes</option>). See the Description section
above for a more detailed discussion of the naming rules of triggered services.</para>
- <para>For IPv4 and IPv6 connections, the <varname>REMOTE_ADDR</varname> environment variable will
- contain the remote IP address, and <varname>REMOTE_PORT</varname> will contain the remote port. This
+ <para>For IPv4 and IPv6 connections, the <varname>$REMOTE_ADDR</varname> environment variable will
+ contain the remote IP address, and <varname>$REMOTE_PORT</varname> will contain the remote port. This
is the same as the format used by CGI. For <constant>SOCK_RAW</constant>, the port is the IP
protocol.</para>
+ <para>For <constant>AF_UNIX</constant> socket connections, the <varname>$REMOTE_ADDR</varname>
+ environment variable will contain either the remote socket's file system path starting with a slash
+ (<literal>/</literal>) or its address in the abstract namespace starting with an at symbol
+ (<literal>@</literal>). If the socket is unnamed, <varname>$REMOTE_ADDR</varname> won't be set.</para>
+
<para>It is recommended to set <varname>CollectMode=inactive-or-failed</varname> for service
instances activated via <varname>Accept=yes</varname>, to ensure that failed connection services are
cleaned up and released from memory, and do not accumulate.</para></listitem>