From e0fc82203d677a6f1e808e9a1a46176c109d89be Mon Sep 17 00:00:00 2001 From: Laurent Bercot Date: Mon, 15 Dec 2014 23:08:59 +0000 Subject: Initial commit --- doc/index.html | 182 ++++++++++++++++++++ doc/libs6net/accessrules.html | 331 ++++++++++++++++++++++++++++++++++++ doc/libs6net/ident.html | 124 ++++++++++++++ doc/libs6net/index.html | 63 +++++++ doc/localservice.html | 151 ++++++++++++++++ doc/minidentd.html | 83 +++++++++ doc/s6-accessrules-cdb-from-fs.html | 141 +++++++++++++++ doc/s6-accessrules-fs-from-cdb.html | 60 +++++++ doc/s6-clockadd.html | 61 +++++++ doc/s6-clockview.html | 41 +++++ doc/s6-connlimit.html | 96 +++++++++++ doc/s6-getservbyname.html | 48 ++++++ doc/s6-ident-client.html | 52 ++++++ doc/s6-ioconnect.html | 84 +++++++++ doc/s6-ipcclient.html | 65 +++++++ doc/s6-ipcserver-access.html | 172 +++++++++++++++++++ doc/s6-ipcserver.html | 148 ++++++++++++++++ doc/s6-sntpclock.html | 166 ++++++++++++++++++ doc/s6-sudo.html | 59 +++++++ doc/s6-sudoc.html | 80 +++++++++ doc/s6-sudod.html | 162 ++++++++++++++++++ doc/s6-taiclock.html | 114 +++++++++++++ doc/s6-taiclockd.html | 51 ++++++ doc/s6-tcpclient.html | 133 +++++++++++++++ doc/s6-tcpserver-access.html | 239 ++++++++++++++++++++++++++ doc/s6-tcpserver.html | 72 ++++++++ doc/s6-tcpserver4.html | 123 ++++++++++++++ doc/s6-tcpserver6.html | 122 +++++++++++++ doc/seekablepipe.html | 36 ++++ doc/upgrade.html | 34 ++++ 30 files changed, 3293 insertions(+) create mode 100644 doc/index.html create mode 100644 doc/libs6net/accessrules.html create mode 100644 doc/libs6net/ident.html create mode 100644 doc/libs6net/index.html create mode 100644 doc/localservice.html create mode 100644 doc/minidentd.html create mode 100644 doc/s6-accessrules-cdb-from-fs.html create mode 100644 doc/s6-accessrules-fs-from-cdb.html create mode 100644 doc/s6-clockadd.html create mode 100644 doc/s6-clockview.html create mode 100644 doc/s6-connlimit.html create mode 100644 doc/s6-getservbyname.html create mode 100644 doc/s6-ident-client.html create mode 100644 doc/s6-ioconnect.html create mode 100644 doc/s6-ipcclient.html create mode 100644 doc/s6-ipcserver-access.html create mode 100644 doc/s6-ipcserver.html create mode 100644 doc/s6-sntpclock.html create mode 100644 doc/s6-sudo.html create mode 100644 doc/s6-sudoc.html create mode 100644 doc/s6-sudod.html create mode 100644 doc/s6-taiclock.html create mode 100644 doc/s6-taiclockd.html create mode 100644 doc/s6-tcpclient.html create mode 100644 doc/s6-tcpserver-access.html create mode 100644 doc/s6-tcpserver.html create mode 100644 doc/s6-tcpserver4.html create mode 100644 doc/s6-tcpserver6.html create mode 100644 doc/seekablepipe.html create mode 100644 doc/upgrade.html (limited to 'doc') diff --git a/doc/index.html b/doc/index.html new file mode 100644 index 0000000..93d68ce --- /dev/null +++ b/doc/index.html @@ -0,0 +1,182 @@ + + + + + s6-networking - small networking utilities + + + + + + +

+Software
+www.skarnet.org +

+ +

s6-networking

+ +

What is it ?

+ +

+ s6-networking is a suite of small networking utilities for Unix systems. +It includes command-line client and server management, TCP access +control, privilege escalation across UNIX domain sockets, IDENT +protocol management and clock synchronization. +

+ +

+ If the underlying +skalibs has been +compiled with IPv6 support, s6-networking is IPv6-ready. +

+ +
+ +

Installation

+ +

Requirements

+ + + +

Licensing

+ +

+ s6-networking is free software. It is available under the +ISC license. +

+ +

Download

+ + + +

Compilation

+ + + +

Upgrade notes

+ + + +

Reference

+ +

Commands

+ +

+ All these commands exit 111 if they encounter a temporary error or +hardware error, and +100 if they encounter a permanent error - such as a misuse. Short-lived +commands exit 0 on success. Other exit codes are documented in the +relevant page. +

+ +

System clock synchronization

+ + + +

UCSPI implementation

+ + + +

TCP and Unix access control

+ + + +

suidless privilege gain

+ + + +

IDENT protocol implementation

+ + + +

Miscellaneous utilities

+ + + +

Libraries

+ + + +
+ + +

Related resources

+
+ +

s6-networking discussion

+ + + +

Similar work

+ + + + + diff --git a/doc/libs6net/accessrules.html b/doc/libs6net/accessrules.html new file mode 100644 index 0000000..ea996b7 --- /dev/null +++ b/doc/libs6net/accessrules.html @@ -0,0 +1,331 @@ + + + + + s6-networking: the accessrules library interface + + + + + + +

+libs6net
+s6-networking
+Software
+skarnet.org +

+ +

The accessrules library interface

+ +

+ The following functions and structures are declared in the s6-networking/accessrules.h header, +and implemented in the libs6net.a or libs6net.so library. +

+ +

General information

+ +

+ s6net_accessrules is an access control library. It looks up +a key in a user-specified database, then returns a code depending on +whether the database allows access (in which case additional information +can also be returned), denies access, or does not contain the key. +

+ +

+ accessrules has been designed to be easily extensible to any +database format and any key format. +

+ +

+ Check the s6-networking/accessrules.h header for the exact definitions. +

+ +

Data structures

+ + + +

Function types

+ +

Backend lookups

+ +

+ A s6net_accessrules_backend_func_t is the type of a function +that takes a single key, looks it up in a database, and returns the result. +Namely: +

+ +

+s6net_accessrules_result_t f (char const *key, unsigned int keylen, void *handle, s6net_accessrules_params_t *params) +

+ +

+ f looks up key key of length keylen in the database +represented by handle in an implementation-defined way. It returns a +number that says the key has been allowed, denied or not found, or an error +occurred. If the key has been allowed, f stores additional information +from the database into *params. +

+ +

+ Two s6net_accessrules_backend_func_t functions are natively implemented: +

+ + + +

Frontend key checking

+ +

+ A s6net_accessrules_keycheck_func_t is the type of a function that +takes a user-level key, makes a list of corresponding backend-level keys and +calls a s6net_accessrules_backend_func_t function until it finds +a match. Namely: +

+ +

+s6net_accessrules_result_t f (void const *key, void *handle, s6net_accessrules_params_t *params, s6net_accessrules_backend_func_t *backend) +

+ +

+ f derives a list of low-level keys to check from key. +Then, for each key k of length klen in this list, it calls +(*backend)(k, klen, handle, params), returning *backend's result if it +is not S6NET_ACCESSRULES_NOTFOUND. If no match can be found in the whole list, +f finally returns S6NET_ACCESSRULES_NOTFOUND. +

+ +

+ Five s6net_accessrules_keycheck_func_t functions are natively implemented: +

+ + + +

Ready-to-use functions

+ + Those functions are mostly macros; they're built by associating a frontend +function with a backend function. + +

+ s6net_accessrules_result_t s6net_accessrules_uidgid_cdb +(unsigned int u, unsigned int g, struct cdb *c, +s6net_accessrules_params_t *params)
+Checks the *c CDB database for an authorization for uid u +and gid g. If the result is S6NET_ACCESSRULES_ALLOW, additional +information may be stored into params. +

+ +

+ s6net_accessrules_result_t s6net_accessrules_uidgid_fs +(unsigned int u, unsigned int g, char const *dir, +s6net_accessrules_params_t *params)
+Checks the dir base directory for an authorization for uid u +and gid g. If the result is S6NET_ACCESSRULES_ALLOW, additional +information may be stored into params. +

+ +

+ s6net_accessrules_result_t s6net_accessrules_reversedns_cdb +(char const *name, struct cdb *c, +s6net_accessrules_params_t *params)
+Checks the *c CDB database for an authorization for the +name FQDN. If the result is S6NET_ACCESSRULES_ALLOW, additional +information may be stored into params. +

+ +

+ s6net_accessrules_result_t s6net_accessrules_reversedns_fs +(char const *name, char const *dir, +s6net_accessrules_params_t *params)
+Checks the dir base directory for an authorization for the +name FQDN. If the result is S6NET_ACCESSRULES_ALLOW, additional +information may be stored into params. +

+ +

+ s6net_accessrules_result_t s6net_accessrules_ip4_cdb +(char const *ip4, struct cdb *c, +s6net_accessrules_params_t *params)
+Checks the *c CDB database for an authorization for the +ip4 IPv4 address (4 network byte order characters). +If the result is S6NET_ACCESSRULES_ALLOW, additional +information may be stored into params. +

+ +

+ s6net_accessrules_result_t s6net_accessrules_ip4_fs +(char const *ip4, char const *dir, +s6net_accessrules_params_t *params)
+Checks the dir base directory for an authorization for the +ip4 IPv4 address (4 network byte order characters). +If the result is S6NET_ACCESSRULES_ALLOW, additional +information may be stored into params. +

+ +

+ s6net_accessrules_result_t s6net_accessrules_ip6_cdb +(char const *ip6, struct cdb *c, +s6net_accessrules_params_t *params)
+Checks the *c CDB database for an authorization for the +ip6 IPv6 address (16 network byte order characters). +If the result is S6NET_ACCESSRULES_ALLOW, additional +information may be stored into params. +

+ +

+ s6net_accessrules_result_t s6net_accessrules_ip6_fs +(char const *ip6, char const *dir, +s6net_accessrules_params_t *params)
+Checks the dir base directory for an authorization for the +ip6 IPv6 address (16 network byte order characters). +If the result is S6NET_ACCESSRULES_ALLOW, additional +information may be stored into params. +

+ +

+ s6net_accessrules_result_t s6net_accessrules_ip46_cdb +(ip46_t *ip, struct cdb *c, +s6net_accessrules_params_t *params)
+Checks the *c CDB database for an authorization for the +ip IP address. +If the result is S6NET_ACCESSRULES_ALLOW, additional +information may be stored into params. +

+ +

+ s6net_accessrules_result_t s6net_accessrules_ip46_fs +(ip46_t const *ip, char const *dir, +s6net_accessrules_params_t *params)
+Checks the dir base directory for an authorization for the +ip IP address. +If the result is S6NET_ACCESSRULES_ALLOW, additional +information may be stored into params. +

+ + + diff --git a/doc/libs6net/ident.html b/doc/libs6net/ident.html new file mode 100644 index 0000000..74a9217 --- /dev/null +++ b/doc/libs6net/ident.html @@ -0,0 +1,124 @@ + + + + + s6-networking: the ident library interface + + + + + + +

+libs6net
+s6-networking
+Software
+skarnet.org +

+ +

The ident library interface

+ +

+ The following functions and structures are declared in the s6-networking/ident.h header, +and implemented in the libs6net.a or libs6net.so library. +

+ +

General information

+ +

+ ident provides a C IDENT client, following RFC 1413. +

+ +

+ Please note that this protocol is of historical interest exclusively; +this client, as well as the minidentd +server, is only provided for convenience and interoperability with +legacy systems. The IDENT protocol absolutely cannot be relied on for +any kind of authentication or secure operation. +

+ +

Functions

+ +

+ Check the s6-networking/ident.h header for the exact function prototypes. +

+ +

Main interface

+ +

+ int s6net_ident_client (char *s, unsigned int max, ip46_t const *remoteip, uint16 remoteport, ip46_t const *localip, uint16 localport, +struct taia const *deadline, struct taia *stamp) +

+ +

+Makes an IDENT request to a server listening on IP remoteip port 113 +about the connection from IP remoteip port remoteport to +IP localip port localport. Writes the answer into +preallocated string s of max length max, and returns the +number of bytes in the answer. +

+ + + +

+ char const *s6net_ident_error_str (int e) +

+ +

+ Maps an error code representing a negative answer (i.e. errno when +s6net_ident_client returned 0) to a suitable string. +

+ +

Low-level functions

+ +

+ int s6net_ident_reply_get (char *s, ip46_t const *ra, uint16 rp, ip46_t const *la, uint16 lp, +struct taia const *deadline, struct taia *stamp) +

+ +

+The network part of s6net_ident_client. Connects to *ra:113 +and asks the server about (*ra:rp, *la:lp), +aborting if *deadline goes by. Writes the server answer into s; +at least S6NET_IDENT_REPLY_SIZE bytes must be preallocated in s. +Returns -1 if an error occurs, or the number of bytes written into s. +

+ +

+ int s6net_ident_reply_parse (char const *s, uint16 rp, uint16 lp) +

+ +

+The local part of s6net_ident_client. Parses the server answer in +s for the connection from port rp to port lp. +Returns -1 EPROTO if the answer does not make sense, 0 if the answer is +negative, or a positive number if the answer is positive. This number is +an index where the ID can be found in s. +

+ + + diff --git a/doc/libs6net/index.html b/doc/libs6net/index.html new file mode 100644 index 0000000..7a6a75b --- /dev/null +++ b/doc/libs6net/index.html @@ -0,0 +1,63 @@ + + + + + s6-networking: the s6net library interface + + + + + + +

+s6-networking
+Software
+skarnet.org +

+ +

The s6net library interface

+ +

General information

+ +

+ libs6net is a collection of networking-related utility +C interfaces, used in the s6-networking executables. +

+ +

Compiling

+ + + +

Linking

+ + + +

Programming

+ +

+ The s6-networking/s6net.h header is actually a +concatenation of other headers: +the libs6net is separated into several modules, each of them with its +own header. +

+ + + + + diff --git a/doc/localservice.html b/doc/localservice.html new file mode 100644 index 0000000..af7aafb --- /dev/null +++ b/doc/localservice.html @@ -0,0 +1,151 @@ + + + + + s6-networking: what is a local service + + + + + + +

+s6-networking
+Software
+skarnet.org +

+ +

Local services

+ +

+ A local service is a daemon that listens to incoming connections +on a Unix domain socket. Clients of the service are programs connecting to +this socket: the daemon performs operations on their behalf. +

+ +

+ The service is called local because it is not accessible to +clients from the network. +

+ +

+ A widely known example of a local service is the syslogd daemon. +On most implementations, it listens to the /dev/log socket. +Its clients connect to it and send their logs via the socket. The +openlog() function is just a wrapper arround the connect() +system call, the syslog() function a wrapper around write(), +and so on. +

+ +

Benefits

+ +

Privileges

+ +

+ The most important benefit of a local service is that it permits +controlled privilege gains without using setuid programs. +The daemon is run as user S; a client running as user C and connecting to +the daemon asks it to perform operations: those will be done as user S. +

+ +

+ Standard Unix permissions on the listening socket can be used to implement +some basic access control: to restrict access to clients belonging to group +G, change the socket to user S and group G, and give it 0420 permissions. +This is functionally equivalent to the basic access control for setuid +programs: a program having user S, group G and permissions 4750 will be +executable by group G and run with S rights. +

+ +

+ But modern systems implement the +getpeereid() +system call or library function. This function allows the server to know the +client's credentials: so fine-grained access control is possible. On those +systems, local services can do as much authentication as setuid programs, +in a much more controlled environment. +

+ +

fd-passing

+ +

+ The most obvious difference between a local service and a network service +is that a local service does not serve network clients. But local services +have another nice perk: while network services usually only provide you +with a single channel (a TCP or UDP socket) of communication between the +client and the server, forcing you to multiplex your data into that +channel, local services allow you to have as many +communication channels as you want. +

+ +

+(The SCTP transport layer provides a way for network services to use +several communication channels. Unfortunately, it is not widely deployed +yet, and a lot of network services still depend on TCP.) +

+ +

+ The fd-passing mechanism is Unix domain socket black magic +that allows one peer of the socket to send open file descriptors to +the other peer. So, if the server opens a pipe and sends one end of +this pipe to a client via this mechanism, there is effectively a +socket and a pipe between the client and the server. +

+ +

UCSPI

+ +

+ The UCSPI protocol +is an easy way of abstracting clients and servers from the network. +A server written as a UCSPI server, just as it can be run +under inetd or s6-tcpserver, can be run under +s6-ipcserver: choose a socket +location and you have a local service. +

+ +

+ Fine-grained access control can be added by inserting +s6-ipcserver-access in +your server command line after s6-ipcserver. +

+ +

+ A client written as an UCSPI client, i.e. assuming it has descriptor +6 (resp. 7) open and reading from (resp. writing to) the server socket, +can be run under s6-ipcclient. +

+ +

Use in skarnet.org software

+ +

+ skarnet.org libraries often use a separate process to handle +asynchronicity and background work in a way that's invisible to +the user. Among them are: +

+ + + +

+ Those processes are usually spawned from a client, via the corresponding +*_startf*() library call. But they can also be spawned from a +s6-ipcserver program in a local service configuration. In both cases, they +need an additional control channel to be passed from the server to +the client: the main socket is used for synchronous commands from the client +to the server and their answers, whereas the additional channel, which is +now implemented as a socket as well (but created by the server on-demand +and not bound to a local path), is used for asynchronous +notifications from the server to the client. The fd-passing mechanism +is used to transfer the additional channel from the server to the client. +

+ + + diff --git a/doc/minidentd.html b/doc/minidentd.html new file mode 100644 index 0000000..e23fa86 --- /dev/null +++ b/doc/minidentd.html @@ -0,0 +1,83 @@ + + + + + s6-networking: the minidentd program + + + + + + +

+s6-networking
+Software
+skarnet.org +

+ +

The minidentd program

+ +

+minidentd is a small +UCSPI server application +that answers IDENT requests. +

+ +

Interface

+ +
+     minidentd [ -v ] [ -n | -i | -r ] [ -y file ] [ -t timeout ]
+
+ +

+minidentd reads a series of IDENT requests on stdin and answers +them on stdout. It logs what it's doing on stderr. The environment +variables xLOCALIP and xREMOTEIP, where x is +the value of the PROTO environment variable, must contain the IDENT +server address and the IDENT client address, respectively. +

+ +

+ minidentd exits 0 on success, 100 on a usage error and 111 on a system +call failure. +

+ +

+ minidentd does not contact the network directly. It's meant to +run under a superserver like +s6-tcpserver. minidentd will +work with IPv4 as well as IPv6. +

+ +

Options

+ + + +

Notes

+ + + + + diff --git a/doc/s6-accessrules-cdb-from-fs.html b/doc/s6-accessrules-cdb-from-fs.html new file mode 100644 index 0000000..26105b1 --- /dev/null +++ b/doc/s6-accessrules-cdb-from-fs.html @@ -0,0 +1,141 @@ + + + + + s6-networking: the s6-accessrules-cdb-from-fs program + + + + + + +

+s6-networking
+Software
+skarnet.org +

+ +

The s6-accessrules-cdb-from-fs program

+ +

+s6-accessrules-cdb-from-fs compiles a directory +containing a ruleset suitable for +s6-ipcserver-access or +s6-tcpserver-access into a +CDB file. +

+ +

Interface

+ +
+     s6-accessrules-cdb-from-fs cdbfile dir
+
+ + + +

Ruleset directory format

+ +

+ To be understood by s6-accessrules-cdb-from-fs, +s6-ipcserver-access, or +s6-tcpserver-access, +dir must have a specific format. +

+ +

+ dir contains a series of directories: +

+ + + +

+Depending on the application, other directories can appear in dir +and be compiled into cdbfile, but +s6-tcpserver-access only +uses the first three, and +s6-ipcserver-access only +uses the last two. +

+ +

+ Each of those directories contains a set of rules. A rule is +a subdirectory named after the set of keys it matches, and containing +actions that will be executed if the rule is the first matching rule +for the tested key. +

+ +

+ The syntax for the rule name is dependent on the nature of keys, and +fully documented on the +accessrules +library page. For instance, a subdirectory named 192.168.0.0_27 +in the ip4 directory will match every IPv4 address in the +192.168.0.0/27 network that does not match a more precise rule. +

+ +

+ The syntax for the actions, however, is the same for every type of key. +A rule subdirectory can contain the following elements: +

+ + + +

Notes

+ + + + + diff --git a/doc/s6-accessrules-fs-from-cdb.html b/doc/s6-accessrules-fs-from-cdb.html new file mode 100644 index 0000000..91ec98e --- /dev/null +++ b/doc/s6-accessrules-fs-from-cdb.html @@ -0,0 +1,60 @@ + + + + + s6-networking: the s6-accessrules-fs-from-cdb program + + + + + + +

+s6-networking
+Software
+skarnet.org +

+ +

The s6-accessrules-fs-from-cdb program

+ +

+s6-accessrules-fs-from-cdb decompiles a CDB database +containing a ruleset suitable for +s6-ipcserver-access or +s6-tcpserver-access and +that has been compiled with +s6-accessrules-cdb-from-fs. +

+ +

Interface

+ +
+     s6-accessrules-fs-from-cdb dir cdbfile
+
+ +
+ +

Notes

+ + + + + diff --git a/doc/s6-clockadd.html b/doc/s6-clockadd.html new file mode 100644 index 0000000..a998cd1 --- /dev/null +++ b/doc/s6-clockadd.html @@ -0,0 +1,61 @@ + + + + + s6-networking: the s6-clockadd program + + + + + + +

+s6-networking
+Software
+skarnet.org +

+ +

The s6-clockadd program

+ +

+s6-clockadd adjusts the system clock depending on the input +provided by a time client. +

+ +

Interface

+ +
+     s6-taiclock server | s6-clockadd [ -f ] [ -e errmax ]
+
+ + + +

Options

+ + + +

Notes

+ + + + + diff --git a/doc/s6-clockview.html b/doc/s6-clockview.html new file mode 100644 index 0000000..58d8ac9 --- /dev/null +++ b/doc/s6-clockview.html @@ -0,0 +1,41 @@ + + + + + s6-networking: the s6-clockview program + + + + + + +

+s6-networking
+Software
+skarnet.org +

+ +

The s6-clockview program

+ +

+s6-clockview prints the time discrepancy between the local +system clock and the time provided by a time server. +

+ +

Interface

+ +
+     s6-taiclock server | s6-clockview
+
+ + + + + diff --git a/doc/s6-connlimit.html b/doc/s6-connlimit.html new file mode 100644 index 0000000..f0422e6 --- /dev/null +++ b/doc/s6-connlimit.html @@ -0,0 +1,96 @@ + + + + + s6-networking: the s6-connlimit program + + + + + + +

+s6-networking
+Software
+skarnet.org +

+ +

The s6-connlimit program

+ +

+s6-connlimit is a small utility to perform IP-based +control on the number of client connections to a TCP socket, and +uid-based control on the number of client connections to a Unix +domain socket. +

+ +

Interface

+ +
+     s6-connlimit prog...
+
+ + + +

Usage

+ +

+ The s6-tcpserver4 and +s6-tcpserver6 define the PROTO environment +variable to "TCP", and spawn every child server with the TCPCONNNUM environment +variable set to the number of connections from the same IP address. + The s6-tcpserver-access program +can set environment variables depending on the client's IP address. If the +s6-tcpserver-access database is configured to set the TCPCONNMAX environment +variable for a given set of IP addresses, and s6-tcpserver-access execs into +s6-connlimit, then s6-connlimit will drop connections if there already are +${TCPCONNMAX} connections from the same client IP address. +

+ +

+ The s6-ipcserver and +s6-ipcserver-access programs can +be used the same way, with "IPC" instead of "TCP", to limit the number +of client connections by UID. +

+ +

Example

+ +

+ The following command line: +

+ +
+     s6-tcpserver4 -v2 -c1000 -C40 1.2.3.4 80 \
+     s6-tcpserver-access -v2 -RHl0 -i dir \
+     s6-connlimit \
+     prog...
+
+ +

+ will run a server listening to IPv4 address 1.2.3.4, on port 80, +serving up to 1000 concurrent connections, and up to 40 concurrent +connections from the same IP address, no matter what the IP address. +For every client connection, it will look up the database set up +in dir; if the connection is accepted, it will run prog.... +

+ +

+ If the dir/ip4/5.6.7.8_32/env/TCPCONNMAX file +exists and contains the string 30, then at most 30 concurrent +connections from 5.6.7.8 will execute prog..., instead of the +default of 40. +

+ + + diff --git a/doc/s6-getservbyname.html b/doc/s6-getservbyname.html new file mode 100644 index 0000000..29a8235 --- /dev/null +++ b/doc/s6-getservbyname.html @@ -0,0 +1,48 @@ + + + + + s6-networking: the s6-getservbyname program + + + + + + +

+s6-networking
+Software
+skarnet.org +

+ +

The s6-getservbyname program

+ +

+s6-getservbyname is a simple command-line interface to the +getservbyname() +function, converting a service name and protocole into a port number. +

+ +

Interface

+ +
+     s6-getservbyname name proto
+
+ + + +

Example

+ +

+ On a standard machine with a correct /etc/services file and +a non-garbled NSS configuration: + s6-getservbyname smtp tcp prints 25. +

+ + + diff --git a/doc/s6-ident-client.html b/doc/s6-ident-client.html new file mode 100644 index 0000000..fb7b0bf --- /dev/null +++ b/doc/s6-ident-client.html @@ -0,0 +1,52 @@ + + + + + s6-networking: the s6-ident-client program + + + + + + +

+s6-networking
+Software
+skarnet.org +

+ +

The s6-ident-client program

+ +

+s6-ident-client is a command-line client application that +performs IDENT (RFC 1413) queries. +

+ +

Interface

+ +
+     s6-ident-client [ -t millisecs ] remoteaddr remoteport localaddr localport
+
+ + + +

Options

+ + + + + diff --git a/doc/s6-ioconnect.html b/doc/s6-ioconnect.html new file mode 100644 index 0000000..5e2b6c6 --- /dev/null +++ b/doc/s6-ioconnect.html @@ -0,0 +1,84 @@ + + + + + s6-networking: the s6-ioconnect program + + + + + + +

+s6-networking
+Software
+skarnet.org +

+ +

The s6-ioconnect program

+ +

+s6-ioconnect performs full-duplex data transmission +between two sets of open file descriptors. +

+ +

Interface

+ +
+     s6-ioconnect [ -t millisecs ] [ -r fdr ] [ -w fdw ] [ -0 ] [ -1 ] [ -6 ] [ -7 ]
+
+ + + +

Options

+ + + +

Notes

+ + + + + diff --git a/doc/s6-ipcclient.html b/doc/s6-ipcclient.html new file mode 100644 index 0000000..2bb66aa --- /dev/null +++ b/doc/s6-ipcclient.html @@ -0,0 +1,65 @@ + + + + + s6-networking: the s6-ipcclient program + + + + + + +

+s6-networking
+Software
+skarnet.org +

+ +

The s6-ipcclient program

+ +

+s6-ipcclient is an +UCSPI client tool for +Unix domain sockets. It connects to a socket, then executes into +a program. +

+ +

Interface

+ +
+     s6-ipcclient [ -q | -Q | -v ] [ -p bindpath ] [ -l localname ] path prog...
+
+ + + +

Environment variables

+ +

+ prog... is run with +the following variables set: +

+ + + +

Options

+ + + + + diff --git a/doc/s6-ipcserver-access.html b/doc/s6-ipcserver-access.html new file mode 100644 index 0000000..817425b --- /dev/null +++ b/doc/s6-ipcserver-access.html @@ -0,0 +1,172 @@ + + + + + s6-networking: the s6-ipcserver-access program + + + + + + +

+s6-networking
+Software
+skarnet.org +

+ +

The s6-ipcserver-access program

+ +

+s6-ipcserver-access is a command-line access +control tool for Unix domain sockets on systems where the +getpeereid() system call can be implemented. +It is meant to be run after +s6-ipcserver and before +the application program on the s6-ipcserver command line. +

+ +

Interface

+ +
+     s6-ipcserver-access [ -v verbosity ] [ -E | -e ] [ -l localname ] [ -i rulesdir | -x rulesfile ] prog...
+
+ + + +

Environment variables

+ +

+s6-ipcserver-access expects to inherit some environment variables from +its parent: +

+ + + +

+ Additionally, it exports the following variables before executing into +prog...: +

+ + + +

+ Also, the access rules database can instruct s6-ipcserver-access to set +up, or unset, more environment variables, depending on the client address. +

+ +

Options

+ + + +

Access rule checking

+ +

+ s6-ipcserver-access checks its client connection against +a ruleset. This ruleset can be implemented: +

+ + + +

+ The exact format of the ruleset is described on the +s6-accessrules-cdb-from-fs page. +

+ +

+s6-ipcserver-access first reads the client UID uid and +GID gid from the +${PROTO}REMOTEEUID and ${PROTO}REMOTEEGID environment variables, and checks +them with the +s6net_accessrules_keycheck_uidgid() +function. In other words, it tries to match: + +

+ +

+ in that order. If no S6NET_ACCESSRULES_ALLOW result can be obtained, +the connection is denied. +

+ +

Environment and executable modifications

+ +

+ s6-ipcserver-access interprets non-empty env subdirectories +and exec files +it finds in the first matching rule of the ruleset, as explained +in the s6-accessrules-cdb-from-fs +page. +

+ + + + + diff --git a/doc/s6-ipcserver.html b/doc/s6-ipcserver.html new file mode 100644 index 0000000..331b139 --- /dev/null +++ b/doc/s6-ipcserver.html @@ -0,0 +1,148 @@ + + + + + s6-networking: the s6-ipcserver program + + + + + + +

+s6-networking
+Software
+skarnet.org +

+ +

The s6-ipcserver program

+ +

+s6-ipcserver is an +UCSPI server tool for +Unix domain sockets, i.e. a super-server. +It accepts connections from clients, and forks a +program to handle each connection. +

+ +

Interface

+ +
+     s6-ipcserver [ -1 ] [ -q | -Q | -v ] [ -d | -D ] [ -P | -p ] [ -c maxconn ] [ -C localmaxconn ] [ -b backlog ] [ -G gidlist ] [ -g gid ] [ -u uid ] [ -U ] path prog...
+
+ + + +

Environment variables

+ +

+ For each connection, an instance of prog... is spawned with +the following variables set: +

+ + + +

+ If client credentials lookup has been disabled, IPCREMOTEEUID and +IPCREMOTEEUID will be set, but empty. +

+ + +

Options

+ + + +

Signals

+ + + +

Notes

+ + + + + diff --git a/doc/s6-sntpclock.html b/doc/s6-sntpclock.html new file mode 100644 index 0000000..0d4c45b --- /dev/null +++ b/doc/s6-sntpclock.html @@ -0,0 +1,166 @@ + + + + + s6-networking: the s6-sntpclock program + + + + + + +

+s6-networking
+Software
+skarnet.org +

+ +

The s6-sntpclock program

+ +

+s6-sntpclock is a small SNTP client. It connects to a +SNTP or NTP server, computes an estimated discrepancy between the +local clock time and the absolute time given by the server, and +outputs it on stdout. +

+ +

Interface

+ +
+     s6-sntpclock [ -f ] [ -v verbosity ] [ -r roundtrips ] [ -t triptimeout ] [ -h throttle ] [ -T totaltimeout ] [ -e errmax ] [ -p port ] ipaddress | s6-clockview
+
+ + + +

Options

+ + + +

Notes

+ + + + +

A word on ntpd

+ +

+ From a Unix software engineering standpoint, the well-known +ntpd program is an +eldritch abomination. The main reason for it is that, just like its +lovely cousin BIND, +ntpd performs a lot of different tasks in a unique process, instead +of separating what could, and should, be separated. This is confusing +for both the programmer and the software user. +

+ + + +

+ And of course, no matter how many layers of complexity you add onto +ntpd, it will never be able to give accurate time in the vicinity of a +leap second, since the very protocol is flawed by design - but +the ntpd authors cannot be blamed for that. Also, the ntpd +writers, not the designers, should be praised: the history of +ntpd security flaws is remarkably small, which is quite a feat for a +huge monolithic root daemon. +

+ +

+ Network synchronization is important, NTP has its perks and +valid use cases, and its existence is a good thing. However, I wish that +the main NTP implementation weren't written as a big fat clumsy process +running as root. s6-sntpclock together with +s6-clockadd aims to provide a small, simple +tool to keep system clocks, especially in embedded devices, synchronized +to a NTP server. +

+ + + diff --git a/doc/s6-sudo.html b/doc/s6-sudo.html new file mode 100644 index 0000000..603ad8a --- /dev/null +++ b/doc/s6-sudo.html @@ -0,0 +1,59 @@ + + + + + s6-networking: the s6-sudo program + + + + + + +

+s6-networking
+Software
+skarnet.org +

+ +

The s6-sudo program

+ +

+s6-sudo connects to a Unix domain socket and passes +its standard file descriptors, command-line arguments and +environment to a program running on the server side, potentially +with different privileges. +

+ +

Interface

+ +
+     s6-sudo [ -q | -Q | -v ] [ -p bindpath ] [ -l localname ] [ -e ] [ -t timeoutconn ] [ -T timeoutrun ] path [ args... ]
+
+ + + +

Options

+ + + + + diff --git a/doc/s6-sudoc.html b/doc/s6-sudoc.html new file mode 100644 index 0000000..0ca9918 --- /dev/null +++ b/doc/s6-sudoc.html @@ -0,0 +1,80 @@ + + + + + s6-networking: the s6-sudoc program + + + + + + +

+s6-networking
+Software
+skarnet.org +

+ +

The s6-sudoc program

+ +

+s6-sudoc talks to a peer s6-sudod +program over a Unix socket, passing it command-line arguments, environment +variables and standard descriptors. +

+ +

Interface

+ +
+     s6-sudoc [ -e ] [ -t timeoutconn ] [ -T timeoutrun ] [ args... ]
+
+ + + +

Options

+ + + +

Notes

+ + + + + diff --git a/doc/s6-sudod.html b/doc/s6-sudod.html new file mode 100644 index 0000000..ac93219 --- /dev/null +++ b/doc/s6-sudod.html @@ -0,0 +1,162 @@ + + + + + s6-networking: the s6-sudod program + + + + + + +

+s6-networking
+Software
+skarnet.org +

+ +

The s6-sudod program

+ +

+s6-sudod receives command-line arguments, environment variables +and standard descriptors from a peer s6-sudoc +program over a Unix socket, then forks another program. +

+ +

Interface

+ +
+     s6-sudod [ -0 ] [ -1 ] [ -2 ] [ -s ] [ -t timeout ] [ sargv... ]
+
+ + + +

Environment

+ +

+s6-sudod transmits its own environment to its child, plus the environment sent +by s6-sudoc, filtered in the following manner: +for every variable sent by s6-sudoc, if the +variable is present but empty in s6-sudod's environment, then +its value is overriden by the value given by s6-sudoc. A variable that is +already nonempty, or that doesn't exist, in s6-sudod's environment, will not +be transmitted to the child. +

+ +

Options

+ + + +

Usage example

+ +

+ The typical use of s6-sudod is in a +local service with a +s6-ipcserver process listening on a Unix +socket, a s6-ipcserver-access process +performing client authentication and access control, and possibly a +s6-envdir +process setting up the environment variables that will be accepted by +s6-sudod. The following script, meant to be a run script in a +service directory, +will set up a privileged program: +

+ +
+#!/command/execlineb -P
+fdmove -c 2 1
+s6-envuidgid serveruser
+s6-ipcserver -U -- serversocket
+s6-ipcserver-access -v2 -l0 -i rules --
+exec -c
+s6-envdir env
+s6-sudod
+sargv
+
+ + + +

+ This means that user clientuser running +s6-sudo serversocket cargv will be +able, if authorized by the configuration in rules, to run +sargv cargv as user serveruser, with stdin, +stdout, stderr and the environment variables properly listed in env +transmitted to sargv. +

+ +

Notes

+ + + + + diff --git a/doc/s6-taiclock.html b/doc/s6-taiclock.html new file mode 100644 index 0000000..bbdc680 --- /dev/null +++ b/doc/s6-taiclock.html @@ -0,0 +1,114 @@ + + + + + s6-networking: the s6-taiclock program + + + + + + +

+s6-networking
+Software
+skarnet.org +

+ +

The s6-taiclock program

+ +

+s6-taiclock is a client for the +TAICLOCK protocol. +It connects to a TAICLOCK server, computes an estimated discrepancy +between the local clock time and the absolute time given by the server, +and outputs it on stdout. +

+ +

Interface

+ +
+     s6-taiclock [ -f ] [ -v verbosity ] [ -r roundtrips ] [ -t triptimeout ] [ -h throttle ] [ -T totaltimeout ] [ -e errmax ] [ -p port ] ipaddress | s6-clockview
+
+ + + +

Options

+ + + +

Notes

+ +

On the usage of NTP vs. TAICLOCK

+ + + +

Related work

+ + + + + diff --git a/doc/s6-taiclockd.html b/doc/s6-taiclockd.html new file mode 100644 index 0000000..915c181 --- /dev/null +++ b/doc/s6-taiclockd.html @@ -0,0 +1,51 @@ + + + + + s6-networking: the s6-taiclockd program + + + + + + +

+s6-networking
+Software
+skarnet.org +

+ +

The s6-taiclockd program

+ +

+s6-taiclockd is a server for the +TAICLOCK protocol. +It's a long-lived program listening to the network and answering +to TAICLOCK clients such as s6-taiclock. +

+ +

Interface

+ +
+     s6-taiclockd [ -i ip ] [ -p port ]
+
+ + + +

Options

+ + + + + diff --git a/doc/s6-tcpclient.html b/doc/s6-tcpclient.html new file mode 100644 index 0000000..42edaa9 --- /dev/null +++ b/doc/s6-tcpclient.html @@ -0,0 +1,133 @@ + + + + + s6-networking: the s6-tcpclient program + + + + + + +

+s6-networking
+Software
+skarnet.org +

+ +

The s6-tcpclient program

+ +

+s6-tcpclient is an +UCSPI client tool for +INET domain sockets. It establishes a TCP connection to a server, +then executes into a program. +

+ +

Interface

+ +
+     s6-tcpclient [ -q | -Q | -v ] [ -4 | -6 ] [ -d | -D ] [ -r | -R ] [ -h | -H ] [ -n | -N ] [ -t timeout ] [ -l localname ] [ -T timeoutconn ] [ -i localip ] [ -p localport ] host port prog...
+
+ + + +

Host address determination

+ + + +

Environment variables

+ +

+ prog... is run with the following variables set: +

+ + + +

Options

+ + + + + diff --git a/doc/s6-tcpserver-access.html b/doc/s6-tcpserver-access.html new file mode 100644 index 0000000..7bf15a0 --- /dev/null +++ b/doc/s6-tcpserver-access.html @@ -0,0 +1,239 @@ + + + + + s6-networking: the s6-tcpserver-access program + + + + + + +

+s6-networking
+Software
+skarnet.org +

+ +

The s6-tcpserver-access program

+ +

+s6-tcpserver-access is a command-line TCP access +control tool, and additionally performs some fine-tuning on a +TCP socket. It is meant to be run after +s6-tcpserver and before +the application program on the s6-tcpserver command line, +just like tcpwrappers' tcpd program. +

+ +

Interface

+ +
+     s6-tcpserver-access [ -v verbosity ] [ -W | -w ] [ -D | -d ] [ -H | -h ] [ -R | -r ] [ -P | -p ] [ -l localname ] [ -B banner ] [ -t timeout ] [ -i rulesdir | -x rulesfile ] prog...
+
+ + + +

Environment variables

+ +

+s6-tcpserver-access expects to inherit some environment variables from +its parent: +

+ + + +

+ Additionally, it exports the following variables before executing into +prog...: +

+ + + +

+ Also, the access rules database can instruct s6-tcpserver-access to set +up, or unset, more environment variables, depending on the client address. +

+ +

Options

+ + + +

Access rule checking

+ +

+ s6-tcpserver-access checks its client connection against +a ruleset. This ruleset can be implemented: +

+ + + +

+ The exact format of the ruleset is described on the +s6-accessrules-cdb-from-fs page. +

+ +

+s6-tcpserver-access first gets the remote address ip of the +client and converts it to canonical form. Then it checks it with the +s6net_accessrules_keycheck_ip46() +function. In other words, it tries to match broader and broader network +prefixes of ip, from ip4/ip_32 to +ip4/0.0.0.0_0 if ip is v4, or from +ip6/ip/128 to ip6/::_0 if ip +is v6. If the result is: +

+ +
  • S6NET_ACCESSRULES_ERROR: it immediately exits 111.
  • +
  • S6NET_ACCESSRULES_DENY: it immediately exits 1.
  • +
  • S6NET_ACCESSRULES_ALLOW: it grants access.
  • +
  • S6NET_ACCESSRULES_NOTFOUND: more information is needed.
  • + + +

    + In the last case, if DNS lookups have been deactivated (-H) then access +is denied. But if s6-tcpserver-access is authorized to perform DNS lookups, +then it gets the remote name of the client, remotehost, and +checks it with the +s6net_accessrules_keycheck_reversedns() +function. In other words, it tries to match shorter and shorter suffixes +of remotehost, from reversedns/remotehost to +reversedns/@. +This time, the connection is denied is the result is anything else than +S6NET_ACCESSRULES_ALLOW. +

    + +

    + Note that even if the access check succeeds, the connection can still be +denied if paranoid mode has been required (-p) and a forward DNS query +on remotehost does not match ip. +

    + +

    Environment and executable modifications

    + +

    + s6-tcpserver-access interprets non-empty env subdirectories +and exec files +it finds in the matching rule of the ruleset, as explained +in the s6-accessrules-cdb-from-fs +page. +

    + + + +

    Notes

    + + + + + diff --git a/doc/s6-tcpserver.html b/doc/s6-tcpserver.html new file mode 100644 index 0000000..41eb176 --- /dev/null +++ b/doc/s6-tcpserver.html @@ -0,0 +1,72 @@ + + + + + s6-networking: the s6-tcpserver program + + + + + + +

    +s6-networking
    +Software
    +skarnet.org +

    + +

    The s6-tcpserver program

    + +

    +s6-tcpserver is an +UCSPI tool for +TCP connections, i.e. a super-server. It accepts connections from +clients, and forks a program to handle each connection. +

    + +

    Interface

    + +
    +     s6-tcpserver [ -q | -Q | -v ] [ -4 | -6 ] [ -1 ] [ -c maxconn ] [ -C localmaxconn ] [ -b backlog ] [ -G gidlist ] [ -g gid ] [ -u uid ] [ -U ] ip port prog...
    +
    + + + +

    Options

    + + + +

    Notes

    + + + + + diff --git a/doc/s6-tcpserver4.html b/doc/s6-tcpserver4.html new file mode 100644 index 0000000..e0270e0 --- /dev/null +++ b/doc/s6-tcpserver4.html @@ -0,0 +1,123 @@ + + + + + s6-networking: the s6-tcpserver4 program + + + + + + +

    +s6-networking
    +Software
    +skarnet.org +

    + +

    The s6-tcpserver4 program

    + +

    +s6-tcpserver4 is a super-server for IPv4 TCP +connections. It accepts connections from clients, and forks a +program to handle each connection. +

    + +

    Interface

    + +
    +     s6-tcpserver4 [ -1 ] [ -v verbosity ] [ -c maxconn ] [ -C localmaxconn ] [ -b backlog ] [ -G gidlist ] [ -g gid ] [ -u uid ] [ -U ] ip port prog...
    +
    + + + +

    Environment variables

    + +

    + For each connection, an instance of prog... is spawned with +the following variables set: +

    + + + +

    Options

    + + + +

    Signals

    + + + +

    Notes

    + + + + + diff --git a/doc/s6-tcpserver6.html b/doc/s6-tcpserver6.html new file mode 100644 index 0000000..e571010 --- /dev/null +++ b/doc/s6-tcpserver6.html @@ -0,0 +1,122 @@ + + + + + s6-networking: the s6-tcpserver6 program + + + + + + +

    +s6-networking
    +Software
    +skarnet.org +

    + +

    The s6-tcpserver6 program

    + +

    +s6-tcpserver6 is a super-server for IPv6 TCP +connections. It accepts connections from clients, and forks a +program to handle each connection. +

    + +

    Interface

    + +
    +     s6-tcpserver6 [ -1 ] [ -v verbosity ] [ -c maxconn ] [ -C localmaxconn ] [ -b backlog ] [ -G gidlist ] [ -g gid ] [ -u uid ] [ -U ] ip port prog...
    +
    + + + +

    Environment variables

    + +

    + For each connection, an instance of prog... is spawned with +the following variables set: +

    + + + +

    Options

    + + + +

    Signals

    + + + +

    Notes

    + + + + + diff --git a/doc/seekablepipe.html b/doc/seekablepipe.html new file mode 100644 index 0000000..cd17b2e --- /dev/null +++ b/doc/seekablepipe.html @@ -0,0 +1,36 @@ + + + + + s6-networking: the seekablepipe program + + + + + + +

    +s6-networking
    +Software
    +skarnet.org +

    + +

    The seekablepipe program

    + +seekablepipe turns the reading end of a pipe into a seekable +file descriptor, using a temporary file. + +

    Interface

    + +
    +     writer | seekablepipe tmpfile reader [ args ... ]
    +
    + +

    +seekablepipe writes writer's output to tmpfile, +which is unlinked as soon as it is created. Then it execs into +reader, reading from a file descriptor on tmpfile. +

    + + + diff --git a/doc/upgrade.html b/doc/upgrade.html new file mode 100644 index 0000000..0f7e635 --- /dev/null +++ b/doc/upgrade.html @@ -0,0 +1,34 @@ + + + + + s6-networking: how to upgrade + + + + + + +

    +s6-networking
    +Software
    +skarnet.org +

    + +

    What has changed in s6-networking

    + +

    n 2.0.0.0

    + + + + + -- cgit v1.3.1