summaryrefslogtreecommitdiffstats
path: root/upstream/fedora-rawhide/man8/systemd-socket-proxyd.8
blob: ef77126ac97ac7203a3cbd39f3ff543e26ed50e2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
'\" t
.TH "SYSTEMD\-SOCKET\-PROXYD" "8" "" "systemd 255" "systemd-socket-proxyd"
.\" -----------------------------------------------------------------
.\" * Define some portability stuff
.\" -----------------------------------------------------------------
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.\" http://bugs.debian.org/507673
.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.ie \n(.g .ds Aq \(aq
.el       .ds Aq '
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
.\" disable hyphenation
.nh
.\" disable justification (adjust text to left margin only)
.ad l
.\" -----------------------------------------------------------------
.\" * MAIN CONTENT STARTS HERE *
.\" -----------------------------------------------------------------
.SH "NAME"
systemd-socket-proxyd \- Bidirectionally proxy local sockets to another (possibly remote) socket
.SH "SYNOPSIS"
.HP \w'\fBsystemd\-socket\-proxyd\fR\ 'u
\fBsystemd\-socket\-proxyd\fR [\fIOPTIONS\fR...] \fIHOST\fR:\fIPORT\fR
.HP \w'\fBsystemd\-socket\-proxyd\fR\ 'u
\fBsystemd\-socket\-proxyd\fR [\fIOPTIONS\fR...] \fIUNIX\-DOMAIN\-SOCKET\-PATH\fR
.SH "DESCRIPTION"
.PP
\fBsystemd\-socket\-proxyd\fR
is a generic socket\-activated network socket forwarder proxy daemon for IPv4, IPv6 and UNIX stream sockets\&. It may be used to bi\-directionally forward traffic from a local listening socket to a local or remote destination socket\&.
.PP
One use of this tool is to provide socket activation support for services that do not natively support socket activation\&. On behalf of the service to activate, the proxy inherits the socket from systemd, accepts each client connection, opens a connection to a configured server for each client, and then bidirectionally forwards data between the two\&.
.PP
This utility\*(Aqs behavior is similar to
\fBsocat\fR(1)\&. The main differences for
\fBsystemd\-socket\-proxyd\fR
are support for socket activation with
"Accept=no"
and an event\-driven design that scales better with the number of connections\&.
.SH "OPTIONS"
.PP
The following options are understood:
.PP
\fB\-h\fR, \fB\-\-help\fR
.RS 4
Print a short help text and exit\&.
.RE
.PP
\fB\-\-version\fR
.RS 4
Print a short version string and exit\&.
.RE
.PP
\fB\-\-connections\-max=\fR, \fB\-c\fR
.RS 4
Sets the maximum number of simultaneous connections, defaults to 256\&. If the limit of concurrent connections is reached further connections will be refused\&.
.sp
Added in version 233\&.
.RE
.PP
\fB\-\-exit\-idle\-time=\fR
.RS 4
Sets the time before exiting when there are no connections, defaults to
\fBinfinity\fR\&. Takes a unit\-less value in seconds, or a time span value such as
"5min 20s"\&.
.sp
Added in version 246\&.
.RE
.SH "EXIT STATUS"
.PP
On success, 0 is returned, a non\-zero failure code otherwise\&.
.SH "EXAMPLES"
.SS "Simple Example"
.PP
Use two services with a dependency and no namespace isolation\&.
.PP
\fBExample\ \&1.\ \&proxy\-to\-nginx\&.socket\fR
.sp
.if n \{\
.RS 4
.\}
.nf
[Socket]
ListenStream=80

[Install]
WantedBy=sockets\&.target
.fi
.if n \{\
.RE
.\}
.PP
\fBExample\ \&2.\ \&proxy\-to\-nginx\&.service\fR
.sp
.if n \{\
.RS 4
.\}
.nf
[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
.fi
.if n \{\
.RE
.\}
.PP
\fBExample\ \&3.\ \&nginx\&.conf\fR
.sp
.if n \{\
.RS 4
.\}
.nf
[\&...]
server {
    listen       unix:/run/nginx/socket;
    [\&...]
.fi
.if n \{\
.RE
.\}
.PP
\fBExample\ \&4.\ \&Enabling the proxy\fR
.sp
.if n \{\
.RS 4
.\}
.nf
# systemctl enable \-\-now proxy\-to\-nginx\&.socket
$ curl http://localhost:80/
.fi
.if n \{\
.RE
.\}
.PP
If
nginx\&.service
has
\fIStopWhenUnneeded=\fR
set, then passing
\fB\-\-exit\-idle\-time=\fR
to
\fBsystemd\-socket\-proxyd\fR
allows both services to stop during idle periods\&.
.SS "Namespace Example"
.PP
Similar as above, but runs the socket proxy and the main service in the same private namespace, assuming that
nginx\&.service
has
\fIPrivateTmp=\fR
and
\fIPrivateNetwork=\fR
set, too\&.
.PP
\fBExample\ \&5.\ \&proxy\-to\-nginx\&.socket\fR
.sp
.if n \{\
.RS 4
.\}
.nf
[Socket]
ListenStream=80

[Install]
WantedBy=sockets\&.target
.fi
.if n \{\
.RE
.\}
.PP
\fBExample\ \&6.\ \&proxy\-to\-nginx\&.service\fR
.sp
.if n \{\
.RS 4
.\}
.nf
[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
.fi
.if n \{\
.RE
.\}
.PP
\fBExample\ \&7.\ \&nginx\&.conf\fR
.sp
.if n \{\
.RS 4
.\}
.nf
[\&...]
server {
    listen       8080;
    [\&...]
.fi
.if n \{\
.RE
.\}
.PP
\fBExample\ \&8.\ \&Enabling the proxy\fR
.sp
.if n \{\
.RS 4
.\}
.nf
# systemctl enable \-\-now proxy\-to\-nginx\&.socket
$ curl http://localhost:80/
.fi
.if n \{\
.RE
.\}
.SH "SEE ALSO"
.PP
\fBsystemd\fR(1),
\fBsystemd.socket\fR(5),
\fBsystemd.service\fR(5),
\fBsystemctl\fR(1),
\fBsocat\fR(1),
\fBnginx\fR(1),
\fBcurl\fR(1)