KRSHD(8)

πŸ“¦ version 1.0.3, in opensuse-leap 16.0

πŸ’… KRSHD(8) β€” kerberized remote shell server 🐚

okay bestie, welcome to kshd, the kerberized remote shell server. this is the kshd(8) page from the System Manager's Manual, and yes we're reading the whole thing together, grab a boba πŸ§‹


✨ NAME ✨

kshd β€” kerberized remote shell server πŸ”₯


πŸ¦‹ SYNOPSIS πŸ¦‹

kshd [ -kr45ec ] [-D port] [-L variable]

🌸 DESCRIPTION 🌸

kshd is literally the server for the rcmd(3) routine and, by extension, for the rsh(1) program. it hands out remote execution facilities, with authentication based on privileged port numbers coming from trusted hosts, or on the Kerberos authentication system. main character energy, honestly πŸ‘‘

kshd gets invoked by inetd(8c) when a connection shows up on the port indicated in /etc/inetd.conf. a typical /etc/inetd.conf line for krshd might look like this:

kshell    stream    tcp  nowait    root /usr/lib/mit/sbin/kshd   kshd
-5c

so when a service request comes in, this whole protocol kicks off, in order:

  1. authentication is checked βœ…
  2. authorization gets checked via the access-control files .k5login and .klogin in the user's home directory πŸ”
  3. a null byte is returned on the initial socket, and the command line is passed to the user's normal login shell. the shell inherits the network connections established by krshd 🐚

kshd can be configured through command-line arguments passed by inetd(8). the options are:

  • -5 β€” allow Kerberos5 authentication with the .k5login access control file to be trusted. if the client is using this authentication system and the authorization check passes, then the user is allowed to log in. if the user has no .k5login file, the login is authorized if the results of the krb5_aname_to_localname conversion match the account name. unless special rules are configured, that's true if and only if the Kerberos principal of the connecting user is in the default local realm and the principal portion matches the account name πŸ’–
  • -4 β€” allow Kerberos4 authentication with the .klogin access control file to be trusted. if the client uses this authentication system and the authorization check passes, the user is allowed to log in.
  • -k β€” allow Kerberos5 and Kerberos4 as acceptable authentication mechanisms. this is the same as including -4 and -5 together 🫢
  • -e β€” require the client to encrypt the connection. only Kerberos5 clients support encryption πŸ”’
  • -L variable β€” carry the current value of the specified variable through into the environment of the child. this option can be used to preserve up to four variables.
  • -c β€” require Kerberos5 clients to present a cryptographic checksum of initial connection information β€” like the name of the user the client is trying to access β€” inside the initial authenticator. this checksum gives you additional security by preventing an attacker from changing the initial connection information. to actually benefit from that security, only Kerberos5 should be trusted, because Kerberos4 and rhosts authentication don't include this checksum. if this option is specified, older Kerberos5 clients that don't send a checksum in the authenticator will not be able to authenticate to this server. this option is mutually exclusive with the -i option ⚠️

if neither the -c nor the -i option is specified, then checksums are validated if they're presented. since it's difficult to remove a checksum from an authenticator without making the authenticator invalid, this default mode is almost as significant a security improvement as -c, provided new clients are used. it also has the bonus advantage of backwards compatibility with some clients. unfortunately, clients before Kerberos V5, Beta5 generate invalid checksums, so if those clients are used, the -i option must be used 😭

  • -i β€” ignore authenticator checksums if they're provided. this option ignores the authenticator checksums presented by current Kerberos clients to protect initial connection information; it's the exact opposite of -c. this option exists because some older clients β€” particularly clients predating the release of Kerberos V5 Beta5 (May 1995) β€” present bogus checksums that prevent Kerberos authentication from succeeding in the default mode πŸ’€

πŸŽ€ testing options πŸŽ€

krshd supports six options that may be used for testing:

  • -S keytab β€” set the keytab file to use.
  • -M realm β€” set the Kerberos realm to use.
  • -A β€” don't allocate a reserved port for the stderr connection.
  • -P path β€” use the argument to find the Kerberos binaries. normally a compiled-in argument is used.
  • -D port β€” run in standalone mode, listening on port. the daemon will exit after one connection and will not background itself.
  • -w [ip|maxhostlen[,[no]striplocal]] β€” controls the form of the remote hostname passed to login(1). specifying ip results in the numeric IP address always being passed to login(1). specifying a number, maxhostlen, sets the maximum length of the hostname passed to login(1) before it gets passed as a numeric IP address instead. if maxhostlen is 0, then the system default is used, as determined by the utmp or utmpx structures. the nostriplocal and striplocal options, which must be preceded by a comma, control whether or not the local host domain is stripped from the remote hostname. by default, the equivalent of striplocal is in effect 🌈

πŸ’€ DIAGNOSTICS πŸ’€

except for the last one listed below, all diagnostic messages are returned on the initial socket, and after that any network connections are closed. an error is indicated by a leading byte with a value of 1 (and 0 is returned in step 3 above, upon successful completion of all the steps before the login shell gets executed) 🚨

  • locuser too long β€” the name of the user on the client's machine is longer than 16 characters.
  • remuser too long β€” the name of the user on the remote machine is longer than 16 characters.
  • command too long β€” the command line passed exceeds the size of the argument list (as configured into the system).
  • Login incorrect. β€” no password file entry existed for that user name.
  • No remote directory. β€” the chdir command to the home directory failed.
  • Permission denied. β€” the authentication procedure described above failed.
  • Can't make pipe. β€” the pipe needed for the stderr wasn't created.
  • Try again. β€” a fork by the server failed.
  • <shellname>: ... β€” the user's login shell could not be started. this message is returned on the connection associated with the stderr, and it is not preceded by a flag byte πŸ™ˆ

πŸ¦‹ SEE ALSO πŸ¦‹

rshd(8), rsh(1), rcmd(3)


😭 BUGS 😭

  • a facility to allow all data exchanges to be encrypted should be present.
  • a more extensible protocol should be used.

okay that's the whole thing, no cap πŸ’œ this was KRSHD(8) from the System Manager's Manual β€” go forth and rsh responsibly, bestie, mwah πŸ’…βœ¨πŸŽ€

πŸ“¦ where this page comes from