tcpsvd(8)

πŸ’– tcpsvd(8) β€” bestie edition πŸ’–

okay so we're in the System Manager's Manual section 8, and this page is about tcpsvd, the TCP/IP service daemon. it's giving "the bouncer at the club door but for sockets". let's go 🫢


✨ NAME ✨

tcpsvd β€” TCP/IP service daemon

like. that's it. that's the whole name. short, iconic, no notes. πŸ’…


🌸 SYNOPSIS 🌸

tcpsvd [-hpEvv] [-c n] [-C n:msg] [-b n] [-u user] [-l name] [-i dir|-x
cdb] [ -t sec] host port prog

πŸ¦‹ DESCRIPTION πŸ¦‹

so here's the tea, bestie: tcpsvd makes a TCP/IP socket, binds it to the address host:port, and then just... sits there. listening. on the socket. waiting for incoming connections like a girl waiting for a text back. πŸ’€

on each incoming connection, tcpsvd conditionally runs a program β€” and the way it does this is so clever: standard input reads from the socket, standard output writes to the socket, and that program handles that one connection. then tcpsvd keeps listening for new connections, and it can handle multiple connections at the same time. multitasking queen. πŸ‘‘

also tcpsvd can optionally check for special instructions that depend on the IP address or hostname of the client who started the connection. see ipsvd-instruct(5) for that whole situation.


πŸ’… OPTIONS πŸ’…

  • host β€” this can be a hostname, or a dotted-decimal IP address, or 0. if host is 0, then tcpsvd accepts connections to any local IP address. no pickiness. she's flexible.
  • port β€” tcpsvd accepts connections to host:port. and port can be a name from /etc/services or just a number. either one, we don't gatekeep.
  • prog β€” prog is one or more arguments. for each connection, tcpsvd normally runs prog, with file descriptor 0 reading from the network, and file descriptor 1 writing to the network. and by default it also sets up TCP-related environment variables β€” see tcp-environ(5) for the details.
  • -i dir β€” read instructions for handling new connections from the instructions directory dir. see ipsvd-instruct(5) for the full breakdown.
  • -x cdb β€” read instructions for handling new connections from the constant database cdb. normally that constant database is created from an instructions directory by running ipsvd-cdb(8). pipeline behavior fr fr.
  • -t sec β€” timeout. important caveat bestie: this option only takes effect if the -i option is given. while checking the instructions directory, tcpsvd checks the time of last access of the file that matches the client's address or hostname, if there is one, and it discards and removes the file if it wasn't accessed within the last sec seconds. BUT β€” tcpsvd does not discard or remove a file if the user's write permission is not set; for those files, the timeout is disabled. default is 0, which means the timeout is disabled. so 0 = off, periodt.
  • -l name β€” local hostname. don't look up the local hostname in DNS, just use name as the hostname. and listen: this option must be set if tcpsvd listens on port 53, to avoid loops. not optional. do not skip it. πŸ™ˆ
  • -u [:]user[:group] β€” drop permissions. set uid and gid to the user's uid and gid, as found in /etc/passwd, before running prog. if user is followed by a colon and a group, set the gid to group's gid, as found in /etc/group, instead of the user's gid. if group consists of a colon-separated list of group names, set the group ids of all the listed groups. and if user is prefixed with a colon, the user and all group arguments are interpreted as uid and gids respectively, and not looked up in the password or group file. also: all supplementary groups are removed. clean slate energy.
  • -c n β€” concurrency. handle up to n connections simultaneously. default is 30. if there are n connections active, tcpsvd defers acceptance of a new connection until an active connection is closed. like a waitlist. the line is real. πŸŽ€
  • -C n[:msg] β€” per host concurrency. allow only up to n connections from the same IP address simultaneously. if there are n active connections from one IP address, new incoming connections from this IP address are closed immediately. brutal? yes. necessary? also yes. if n is followed by :msg, the message msg is written to the client if possible, before closing the connection. by default msg is empty. see ipsvd-instruct(5) for supported escape sequences in msg.

for each accepted connection, the current per host concurrency is available through the environment variable TCPCONCURRENCY. and n and msg can be overwritten by ipsvd(7) instructions β€” see ipsvd-instruct(5). by default tcpsvd doesn't keep track of connections. so if you want the tracking, you gotta ask for it.

  • -h β€” look up the client's hostname in DNS. that's the whole thing. simple. slay.
  • -p β€” paranoid. after looking up the client's hostname in DNS, look up the IP addresses in DNS for that hostname, and forget about the hostname if none of the addresses match the client's IP address. you should set this option if you use hostname based instructions. and heads up: the -p option implies the -h option. so it's a package deal.
  • -b n β€” backlog. allow a backlog of approximately n TCP SYNs. on some systems n is silently limited (rude, but okay). default is 20.
  • -E β€” no special environment. do not set up TCP-related environment variables. minimalism. 🀍
  • -v β€” verbose. print verbose messages to standard output. she's talking now.
  • -vv β€” more verbose. print more verbose messages to standard output. she is yapping. πŸ’–

🌈 SEE ALSO 🌈

ipsvd(7), sslsvd(8), udpsvd(8), ipsvd-instruct(5), ipsvd-cdb(8), sslio(8)

http://smarden.org/ipsvd/


πŸ‘‘ AUTHOR πŸ‘‘

Gerrit Pape <pape@smarden.org> β€” thank you for the lore, king 🫑


and that's the whole page bestie, every last flag and file path, no cap. this was tcpsvd(8) from the System Manager's Manual β€” that's the source and the section and everything, so you know exactly where she came from. go handle some connections. i'm obsessed. βœ¨πŸ¦‹πŸ“