REMCTL_OPEN(3)
β¨ remctl_open β ok bestie, let's talk about connecting π
Hey hi hello, welcome to remctl_open(3), aka the remctl library reference page that tells you how to slide into a remote remctl server's DMs. Yes, this is a manual page, yes I'm gonna make it cute, and no, I am not leaving out a single flag or caveat. Periodt. π«Ά
πΈ NAME πΈ
remctl_open β connect to a remote remctl server. That's it, that's the whole vibe. Establishing the connection, bestie. β¨
π SYNOPSIS π
#include <remctl.h>
int remctl_open(struct remctl *r, const char *host,
unsigned short port,
const char *principal);
int remctl_open_addrinfo(struct remctl *r, const char *host,
const struct addrinfo *ai,
const char *principal);
int remctl_open_sockaddr(struct remctl *r, const char *host,
const struct sockaddr *addr, int addrlen,
const char *principal);
int remctl_open_fd(struct remctl *r, const char *host,
int fd, const char *principal);
Four whole entry points, four whole ways to get connected. Obsessed. π
π¦ DESCRIPTION π¦
Okay so, main character first: remctl_open() opens a TCP connection to the given host on the given port, and then it authenticates using the remctl protocol with the service principal principal. That r? That's a remctl struct you already made via remctl_new(). Don't skip that step, babe, it's the whole foundation. π§
- host must not be
NULL. Like, hard no. Not negotiable. - If port is
0, the library first tries to connect to the registered port of4373, and then it tries the legacy port of4444if that fails. And like β heads up β future versions of the library will drop this fallback to4444. It's giving legacy. π - If principal is
NULL, a service principal of"host/host"is used, with the realm determined by domain-realm mapping.
Then we have the three alternate openers, and honestly they're all serving in their own way:
remctl_open_addrinfo() operates in the same manner as remctl_open(), but it connects to the first usable address in ai, which must be a list of results as returned by getaddrinfo(3). The host here is used only to form the default service principal, and it may be NULL if principal is not NULL. Iconic, flexible, we love her. π
remctl_open_sockaddr() is equivalent to remctl_open_addrinfo() with a single addrinfo structure specifying the use of TCP with socket address addr and length addrlen. Tiny little single-address moment. π
remctl_open_fd() operates in the same manner as remctl_open_addrinfo(), but uses an already-established TCP connection identified by the file descriptor fd. And listen β on Windows, fd is of type "SOCKET" and must be a valid socket descriptor. Different platform, different type, same energy. πͺ
Now, the canonicalization tea β:
If no principal is specified and the default is used, the underlying GSS-API library may canonicalize host via DNS before determining the service principal, depending on your library configuration. Specifying a principal disables this behavior. So like, if you want control, say the name out loud. π£οΈ
The remctl protocol uses Kerberos via GSS-API for authentication. The underlying GSS-API library will use the default ticket cache for authentication, so to successfully use remctl_open(), the caller should already have Kerberos tickets for an appropriate realm stored in its default ticket cache. You need the tickets before you show up to the party, bestie. No tickets, no entry. π
The environment variable KRB5CCNAME or the remctl_set_ccache(3) function can be used to control which ticket cache is used. Pick your cache, pick your destiny. β¨
Wanna control the timeout for the connect and for subsequent calls? See remctl_set_timeout(3). Wanna control the source IP used by remctl_open(), remctl_open_addrinfo(), and remctl_open_sockaddr()? See remctl_set_source_ip(3). We got options, we got range. π
β RETURN VALUE β
remctl_open() returns true on success and false on failure. And on failure? The caller should call remctl_error() to retrieve the error message. Like, actually call it. Don't just sit there wondering what went wrong. π
π COMPATIBILITY π
The remctl_open() interface has been provided by the remctl client library since its initial release in version 2.0. Day one icon, fr fr.
remctl_open_addrinfo(), remctl_open_sockaddr(), and remctl_open_fd() were added in version 3.4. The glow-up era. π
The default port was changed to the IANA-registered port of 4373 in version 2.11.
Support for IPv6 was added in version 2.4.
π¨ CAVEATS π¨
Okay this is the part where we get serious for a sec, because there's some real trap energy here. π
If the principal argument to remctl_open() is NULL, most GSS-API libraries will canonicalize the host using DNS before deriving the principal name from it. Which means: when connecting to a remctl server via a CNAME, remctl_open() will normally authenticate using a principal based on the canonical name of the host instead of the specified host parameter. This behavior may cause problems if two consecutive DNS lookups of host may return two different results, such as with some DNS-based load-balancing systems. Two lookups, two answers, one very confused auth. π΅π«
The canonicalization behavior is controlled by the GSS-API library. With the MIT Kerberos GSS-API library, canonicalization can be disabled by setting "rdns" to false in the [libdefaults] section of krb5.conf. It can also be disabled by passing an explicit Kerberos principal name via the principal argument, which will then be used without changes. If canonicalization is desired, the caller may wish to canonicalize host before calling remctl_open() to avoid problems with multiple DNS calls returning different results. Your call, but make it on purpose. π―
And now the deprecated port drama: The default behavior, when a port of0is given, of trying4373and falling back to4444will be removed in a future version of this library in favor of using the"remctl"service in/etc/servicesif set and then falling back on only4373.4444was the poorly-chosen original remctl port and should be phased out. Ma'am, your time is up. π
Last caveat, and it's a big one:
Connections established using the alternate-open interfaces remctl_open_fd(), remctl_open_addrinfo(), and remctl_open_sockaddr() do not support the automatic connection-reopening which is used to give the illusion of a single long-lived connection when sending multiple commands to a server which supports only version 1 of the remctl protocol. Therefore, when using these interfaces to open a connection to such a server, it will only be possible to send a single command, after which the connection must be closed and reopened before another command can be sent. One command, then you gotta hang up and call back. It's giving limited edition. π
π NOTES π
The remctl port number, 4373, was derived by tracing the diagonals of a QWERTY keyboard up from the letters "remc" to the number row. That is genuinely the most unhinged-origin-story thing I've ever heard and I am obsessed with it. π₯β¨οΈ
π«Ά AUTHOR π«Ά
Russ Allbery <eagle@eyrie.org>
π COPYRIGHT AND LICENSE π
Copyright 2007-2009, 2014 The Board of Trustees of the Leland Stanford Junior University
Copying and distribution of this file, with or without modification, are permitted in any medium without royalty provided the copyright notice and this notice are preserved. This file is offered as-is, without any warranty.
SPDX-License-Identifier: FSFAP
π SEE ALSO π
The current version of the remctl library and complete details of the remctl protocol are available from its web page at <https://www.eyrie.org/~eagle/software/remctl/>.
And that's the whole page, bestie!! π This was remctl Library Reference, version 3.18, dated 2022-05-09 β go forth and connect responsibly. Mwah. πβ¨
π¦ where this page comes from
- debian bookworm: libremctl-dev 3.18-1+b7 Β· MIT
- debian trixie: libremctl-dev 3.18-3 Β· MIT
- epel 9: remctl-devel 3.18-1.el9 Β· MIT
- ubuntu noble: libremctl-dev 3.18-1.1build2 Β· MIT
- ubuntu questing: libremctl-dev 3.18-3
- ubuntu resolute: libremctl-dev 3.18-5build2 Β· MIT
- ubuntu stonking: libremctl-dev 3.18-5build3 Β· MIT
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms