summaryrefslogtreecommitdiff
path: root/doc/skabus-dyntee.html
blob: 57b34f39463bb4196cfd38f7a65a062361dff0da (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
<html>
  <head>
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <meta http-equiv="Content-Language" content="en" />
    <title>skabus: the skabus-dyntee program</title>
    <meta name="Description" content="skabus: the skabus-dyntee program" />
    <meta name="Keywords" content="skabus dynamic tee dyntee skabus-dyntee unix linux socket pubsub server daemon" />
    <!-- <link rel="stylesheet" type="text/css" href="//skarnet.org/default.css" /> -->
  </head>
<body>

<p>
<a href="index.html">skabus</a><br />
<a href="//skarnet.org/software/">Software</a><br />
<a href="//skarnet.org/">skarnet.org</a>
</p>

<h1> The <tt>skabus-dyntee</tt> program </h1>

<p>
<tt>skabus-dyntee</tt> is a <em>dynamic tee</em>, which is the
simplest publisher daemon possible.
It listens on a Unix domain socket, accepts client connections, and
publishes to its clients everything it reads on its standard
input, as a byte stream. It only writes to clients and never reads
from them.
</p>

<h2> Interface </h2>

<pre>
     skabus-dyntee [ -1 ] [ -D | -d ] [ -c <em>maxconn</em> ] [ -b <em>backlog</em> ] [ -G <em>gidlist</em> ] [ -g <em>gid</em> ] [ -u <em>uid</em> ] [ -U ] [ -t <em>clienttimeout</em> ] [ -T <em>lameducktimeout</em> ] [ -i <em>rulesdir</em> | -x <em>rulesfile</em> ] <em>path</em>
</pre>

<ul>
 <li> skabus-dyntee binds to the Unix domain socket at <em>path</em>. </li>
 <li> If applicable, it drops root privileges. </li>
 <li> It listens to its socket and accepts client connections. </li>
 <li> Whenever it has data available on its standard input, it reads
that data and writes it to every client it has. It duplicates its
stdin stream to all its clients, hence the name <em>dynamic tee</em>. </li>
 <li> When it reads EOF on its stdin, or when it receives a SIGTERM,
it waits for its clients to read their pending data, then exits 0. </li>
</ul>

<p>
 skabus-dyntee is just a wrapper that binds to its socket and
drops privileges before executing into
<a href="skabus-dynteed.html">skabus-dynteed</a>. For details of
the daemon's operation, see the
<a href="skabus-dynteed.html">skabus-dynteed</a> documentation.
</p>

<h2> Options </h2>

<ul>
 <li> <tt>-1</tt>&nbsp;: write a newline to stdout, before
closing it, right after binding and listening to the Unix socket.
If stdout is suitably redirected, this can be used by monitoring
programs to check when the server is ready to accept connections. </li>
 <li> <tt>-d</tt>&nbsp;: allow instant rebinding to the same path
even if it has been used not long ago - this is the SO_REUSEADDR flag to
<a href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/setsockopt.html">setsockopt()</a>
and is generally used with server programs. This is the default. Note that
<em>path</em> will be deleted if it already exists at program start time. </li>
 <li> <tt>-D</tt>&nbsp;: disallow instant rebinding to the same path. </li>
 <li> <tt>-c&nbsp;<em>maxconn</em></tt>&nbsp;: accept at most
<em>maxconn</em> concurrent client connections. Default is 40. It is
impossible to set it higher than the value of the SKABUS_DYNTEE_MAX macro,
which is 1000.
 <li> <tt>-b&nbsp;<em>backlog</em></tt>&nbsp;: set a maximum of
<em>backlog</em> backlog connections on the socket. Extra
connection attempts will rejected by the kernel. </li>
 <li> <tt>-G&nbsp;<em>gidlist</em></tt>&nbsp;: change skabus-dyntee's
supplementary group list to <em>gidlist</em> after binding the socket.
This is only valid when run as root. <em>gidlist</em> must be a
comma-separated list of numerical group IDs. </li>
 <li> <tt>-g&nbsp;<em>gid</em></tt>&nbsp;: change skabus-dyntee's groupid
to <em>gid</em> after binding the socket. This is only valid when run
as root. </li>
 <li> <tt>-u&nbsp;<em>uid</em></tt>&nbsp;: change skabus-dyntee's userid
to <em>uid</em> after binding the socket. This is only valid when run
as root. </li>
 <li> <tt>-U</tt>&nbsp;: change skabus-dyntee's user id, group id and
supplementary group list
according to the values of the UID, GID and GIDLIST environment variables
after binding the socket. This is only valid when run as root.
This can be used with the
<a href="s6-envuidgid.html">s6-envuidgid</a>
program to easily script a service that binds to a privileged socket
then drops its privileges to those of a named non-root account. </li>
 <li> <tt>-t&nbsp;<em>clienttimeout</em></tt>&nbsp;: disconnect a client
that has not read its data after <em>clienttimeout</em> milliseconds.
By default, <em>clienttimeout</em> is 0, which means infinite. </li>
 <li> <tt>-T&nbsp;<em>lameducktimeout</em></tt>&nbsp;: after
skabus-dyntee has been told to exit, clients will have
<em>lameducktimeout</em> milliseconds to read their pending data,
after which skabus-dyntee will exit anyway.
By default, <em>lameducktimeout</em> is 0, which means infinite. </li>
 <li> <tt>-x&nbsp;<em>rulesfile</em></tt>&nbsp;: read access rights
configuration from CDB file <em>rulesfile</em>. </li>
 <li> <tt>-i&nbsp;<em>rulesdir</em></tt>&nbsp;: read access rights
configuration from the filesystem in directory <em>rulesdir</em>. </li>
</ul>

<h2> Notes </h2>

<ul>
 <li> skabus-dyntee does not interpret its options itself. It just
dispatches them to the appropriate program on the command line that
it builds. </li>
 <li> From the user's point of view, skabus-dyntee behaves like a
long-lived process, even if the long-lived process itself is called
<a href="skabus-dynteed.html">skabus-dynteed</a>. Every operational detail
of skabus-dynteed applies to skabus-dyntee as well; in particular,
make sure to properly
<a href="skabus-dynteed.html#configuration">configure the clients'
access rights</a>. </li>
</ul>

</body>
</html>