S6-TLSD(8)
π s6-tlsd(8) β ok bestie, let's talk TLS
So like, the manual name is s6-tlsd and it lives in the System Manager's Manual section, and honestly? It's giving "quiet little bodyguard for your cleartext apps." Let's get into it. π«Ά
β¨ NAME β¨
s6-tlsd β do the server side of a TLS or SSL connection over a TCP connection you already have, then exec into your app. That's it, that's the whole vibe. π
πΈ SYNOPSIS πΈ
s6-tlsd [-S | -s] [-J | -j] [-Y | -y] [-Z | -z] [-v verbosity]
[-K kimeout] [-k snilevel] [--] prog...
π¦ DESCRIPTION π¦
So s6-tlsd exists to make network comms secure even for apps that, like... don't natively support TLS/SSL. No cap. It just wraps them up all cozy. π
Important thing first: s6-networking does not include cryptographic software. All the crypto happening in s6-tlsd is provided by whichever SSL backend you picked β that's BearSSL or LibreSSL, depending on the options you gave when configuring s6-networking. iykyk.
s6-tlsd expects to already have an open TCP connection it can talk to on its stdin (for reading) and its stdout (for writing). Like, the connection's already there, she's just here to secure it.
It spawns an s6-tlsd-io(8) child process β that's the actual server-side of the TLS connection, the one doing the handshake (expecting a TLS client on the other end of the network) and keeping the TLS tunnel alive and maintained. π₯
When s6-tlsd-io(8) tells it "bestie, the handshake is done," s6-tlsd exec(3)s into prog.... And then it's just... your program. Living its life. Through a tunnel. β¨
The whole goal of the s6-tlsd interface β and its client-side partner in crime s6-tlsc(8) β is this: if you've got a client run by the command line client... that speaks a cleartext protocol to a server run by the command line server..., then as long as the server has the proper private key and certificate, and the client has the proper list of trust anchors, you can just change the client command line to s6-tlsc client... and the server command line to s6-tlsd server... β without touching the client or the server themselves β and boom π₯, the communication between them is secure.
Not me being obsessed with a drop-in wrapper. But like. It is iconic.
π OPTIONS π
-vverbosity β Be more or less verbose. Default verbosity is1.0is quiet,2is verbose, more than2is debug output. And yeah β this option currently has no effect. π Cute though.-Zβ Do not clean the environment of the variables used bys6-tlsd-io(8)beforeexec(3)'ingprog.... Keep the snackies around.-zβ Clean the environment of the variables used bys6-tlsd-io(8)beforeexec(3)'ingprog.... This is the default. π§Ό-Sβ Send aclose_notifyalert and break the connection whenprogsends EOF. Polite goodbye energy.-sβ Transmit EOF by half-closing the TCP connection without usingclose_notify. This is the default. Lowkey rude but valid.-Jβ Makes6-tlsd-io(8)exit with a nonzero code if the peer sends EOF without aclose_notifyfirst. Like, no goodbye? Rude. Flagged. π©-jβ Treat EOF from the peer as a normal exit condition. Chill vibes, no drama. π-Yβ Request an optional client certificate.-yβ Request a mandatory client certificate. And heads up: the default, when you give neither-Ynor-y, is to not request a client certificate at all. π-Kkimeout β If the handshake takes more than kimeout milliseconds to complete, close the connection. The default is0, which means infinite timeout β as in, never kill the connection. She'll wait forever. π°οΈ-ksnilevel β Support alternative certificate chains for SNI. Okay this one's a mouthful, so listen up:- If snilevel is nonzero, private key file names are read from every environment variable of the form
KEYFILE:x, where x is a server name the client may require, and a corresponding certificate chain for the name x should exist in the file named after the contents of theCERTFILE:xenvironment variable. - If snilevel is
2or more, only those files are read, and the genericKEYFILEandCERTFILEvariables are ignored. - If snilevel is
0, or if the option isn't given at all (which is the default),KEYFILEandCERTFILEare the only private key / certificate chain pair that gets loaded β no other environment variable is read for keypairs. periodt.
- If snilevel is nonzero, private key file names are read from every environment variable of the form
π ENVIRONMENT π
π Read
s6-tlsd doesn't expect to have any particular environment variables itself, but it spawns an s6-tlsd-io(8) program that absolutely does. So it should pay attention to these bad boys:
KEYFILEandCERTFILE. Also (or alternatively), if the-koption is given: a whole series ofKEYFILE:xandCERTFILE:xvariables, for every x in the set of server names.- (If the
-yor-Yoption has been given)CADIRorCAFILE. TLS_UIDandTLS_GID.
π§ Written
By default, prog... is run with all these variables unset: CADIR, CAFILE, KEYFILE, CERTFILE, KEYFILE:x and CERTFILE:x for every x, TLS_UID and TLS_GID. They're passed to the s6-tlsd-io(8) child but not to prog.... The -Z option keeps them accessible in prog... too, if that's your thing.
But wait, there's more β prog... is run with these additional environment variables:
SSL_PROTOCOLβ Contains the protocol version:TLSv1,TLSv1.1,TLSv1.2... π«SSL_CIPHERβ Contains the name of the cipher used.SSL_TLS_SNI_SERVERNAMEβ Contains the required SNI server name, if any. It gets removed from the environment if no SNI has been sent by the client. βοΈSSL_PEER_CERT_HASHβ Contains the hash of the peer's End Entity certificate, prefixed by the name of the hash and a colon (typicallySHA256:).SSL_PEER_CERT_SUBJECTβ Contains the decoded subjectDN of the peer's End Entity certificate, i.e. identifying information. The thing traditionally called the "name" of the certificate is the CN field in that data. π
More similar environment variables containing information about the connection may be added in the future. So like, stay tuned. π
π EXIT STATUS π
100β Wrong usage. (You held it wrong. π)111β System call failed.
And if everything goes smoothly? s6-tlsd doesn't exit at all β it exec(3)s into prog... instead. Main character behavior, honestly. π
β SEE ALSO β
s6-tls(7), s6-tlsc(8), s6-tlsc-io(8), s6-tlsclient(8), s6-tlsd-io(8), s6-tlsserver(8), s6-ucspitlsc(8), s6-ucspitlsd(8)
This man page is ported from the authoritative documentation at: https://skarnet.org/software/s6-networking/s6-tlsd.html β go read the source bestie, it's giving references. π
π AUTHORS π
Laurent Bercot Alexis <flexibeast@gmail.com> (man page port)
<div align="center">πΈ</div>
okay that's the whole page!! written by Laurent Bercot with the man page port by Alexis <flexibeast@gmail.com>, shipped under the Debian banner, dated November 20, 2023 β and that's the tea, no cap. πβ¨π
π¦ 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