S6-TLSC-IO(8)
π¦ s6-tlsc-io β S6-TLSC-IO(8) π¦
okay bestie, welcome to the S6-TLSC-IO(8) page from the System Manager's Manual. This is the TLS-client-meets-pipes era of the group chat, and itβs lowkey iconic once you know what every flag is doing. π
π NAME π
s6-tlsc-io β establish a TLS or SSL client connection over an existing TCP connection, then communicate with an existing local program over already established pipes.
πΈ SYNOPSIS πΈ
s6-tlsc-io [-S | -s] [-J | -j] [-Y | -y] [-v verbosity] [-K kimeout]
[-k servername] [-d notif] [--] fdr fdw
β¨ DESCRIPTION β¨
s6-tlsc-io is literally the only client-side program in s6-networking that performs cryptography. Main character energy, no cap. π
And no, s6-networking does not include cryptographic software by itself. All the crypto used in s6-tlsc-io comes from the chosen SSL backend: BearSSL[1] or LibreSSL[2], depending on the options given when configuring s6-networking. Pick your fighter at build time, bestie. π§
s6-tlsc-io expects to read cleartext data from stdin, and write cleartext data to stdout. It also expects descriptors fdr and fdw to already be open β typically connected to the network β so it can respectively read ciphertext from fdr and write ciphertext to fdw. Clear text in, clear text out; ciphertext over there. Slay. π«
It initiates a TLS handshake over the network connection, expecting a TLS server on the other side.
Then it acts as a full duplex tunnel: encrypting and transmitting data from stdin to fdw, and decrypting and transmitting data from fdr to stdout. Full-duplex realness. π¦
When it cannot transmit any more data from/to the local application because connections have closed, s6-tlsc-io exits.
π§Έ Protocol version and parameters π§Έ
During the TLS handshake, s6-tlsc-io tries every version of the protocol that is supported by the backend, with all supported algorithms and cipher suites. The backend normally ensures that the most secure combination is tried first, with slow degradation until the client and the server agree. Very diplomatic of them. ποΈ
For BearSSL, this means use of the br_ssl_client_init_full() function[3]. The supported protocol versions are described in [4].
For LibreSSL, this means use of the tls_config_set_protocols(TLS_PROTOCOLS_ALL) call[5].
As a client, it is better for s6-tlsc-io to adapt to as many servers as possible, which is why it adopts a liberal approach to protocol versions. Flexible queen. π
π Server name determination for SNI π
The -k servername option is important to s6-tlsc-io: it tells it to send servername as the name to require a certificate for. Not setting this option allows s6-tlsc-io to proceed without SNI, which may be a security risk. π
π SSL close handling π
If the local application initiates the end of the session by sending EOF to fdr, there are two ways for the TLS layer to handle it.
- It can send a
close_notifyalert, and wait for an acknowledgement from the peer, at which point the connection is closed. The advantage of this setup is that it is secure even when the application protocol is not auto-terminated, i.e. when it does not know when its data stops. Old protocols such asHTTP-0.9are in this case. The drawback of this setup is that it breaks full-duplex: once a peer has sent theclose_notify, it must discard all the incoming records that are not aclose_notifyfrom the other peer. So if a client sends EOF while it is still receiving data from the server, the connection closes immediately and the data can be truncated. π - It can simply transmit the EOF, shutting down half the TCP connection, and wait for the EOF back. The advantage of this setup is that it maintains full-duplex: a client can send EOF after its initial request, and still receive a complete answer from the server. The drawback is that it is insecure when the application protocol is not auto-terminated. π
Nowadays (2020), most protocols are auto-terminated, so it is not dangerous anymore to use EOF transmission, and that is the default for s6-tlsc-io. Nevertheless, by using the -S option, you can force it to use the close_notify method if your application requires it to be secure. Periodt. π
π OPTIONS π
-v verbosityβ Be more or less verbose. Default forverbosityis1.0is quiet,2is verbose, more than2is debug output. This option currently has no effect. (Iconic placeholder energy. π)-Sβ Send aclose_notifyalert and break the connection when receiving a local EOF.-sβ Transmit EOF by half-closing the TCP connection without usingclose_notify. This is the default.-Jβ Treat EOF from the peer without a priorclose_notifyas an error: print a fatal error message and exit98.-jβ Treat EOF from the peer without a priorclose_notifyas a normal exit condition. This is the default.-Yβ Do not send a client certificate. This is the default.-yβ Send a client certificate.-k servernameβ Use Server Name Indication, and sendservername. The default is not to use SNI, which may be a security risk.-K kimeoutβ If the handshake takes more thankimeoutmilliseconds to complete, close the connection. The default is0, which means infinite timeout (never kill the connection).-d notifβ Handshake notification.notifmust be a file descriptor open for writing. When the TLS handshake has completed, some data (terminated by two null characters) will be sent to file descriptornotif. The data contains information about the TLS parameters of the connection; its exact contents are left unspecified, but thereβs at least anSSL_PROTOCOL=protocolstring and anSSL_CIPHER=cipherstring, both null-terminated. Sending this data serves a dual purpose: telling thenotifreader that the handshake has completed, and providing it with some basic information about the connection. If this option is not given, no such notification is performed.
π ENVIRONMENT π
s6-tlsc-io expects to have one of the CADIR or CAFILE environment variables set. It will refuse to run if both are unset. If both are set, CADIR has priority. π
The value of that variable is:
- for
CADIR: a directory where trust anchors (i.e. root or intermediate CA certificates) can be found, one per file, DER- or PEM-encoded. - for
CAFILE: a file containing the whole set of trust anchors, PEM-encoded.
If you are using client certificates, s6-tlsc-io also reads two more environment variables: KEYFILE contains the path to a file containing the private key, DER- or PEM-encoded; and CERTFILE contains the path to a file containing the client certificate, DER- or PEM-encoded.
If s6-tlsc-io is run as root, it can also read two other environment variables, TLS_UID and TLS_GID, which contain a numeric uid and a numeric gid; s6-tlsc-io then drops its root privileges to this uid/gid after spawning prog.... This ensures that the TLS/engine and the application run with different privileges. Note that prog... should drop its own root privileges by its own means: the s6-applyuidgid(8) program is a chainloading way of doing it.
π₯ EXIT STATUS π₯
0β The connection terminated normally.96β Error while configuring the TLS context β for instance, invalid trust anchor set.97β Error while setting up the TLS client engine.98β TLS error while running the engine.100β Wrong usage.111β System call failed.
π¦ SEE ALSO π¦
s6-tls(7),s6-applyuidgid(8),s6-tlsc(8),s6-tlsclient(8),s6-tlsd(8),s6-tlsd-io(8),s6-tlsserver(8),s6-ucspitlsc(8),s6-ucspitlsd(8)- [1] https://bearssl.org/
- [2] https://www.libressl.org/
- [3] https://bearssl.org/apidoc/bearssl__ssl_8h.html#aa386dd0b03a0123760bf63df5a41c1e0
- [4] https://bearssl.org/support.html#supported-versions
- [5] https://man.openbsd.org/OpenBSD-current/man3/tls_config_set_protocols.3
This man page is ported from the authoritative documentation at: https://skarnet.org/software/s6-networking/s6-tlsc-io.html
π AUTHORS π
- Laurent Bercot
Alexis <flexibeast@gmail.com> (man page port)
mwah π this baby is from Debian, dated November 20, 2023, and itβs the S6-TLSC-IO(8) page β stay encrypted and hydrated, bestie π«Άβ¨
π¦ where this page comes from
- nixpkgs unstable: s6-networking 2.8.0.1
- nixpkgs unstable: s6-networking-man-pages 2.7.2.1.4
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms