1REMCTL_OPEN(3)             remctl Library Reference             REMCTL_OPEN(3)
2
3
4

NAME

6       remctl_open - Connect to a remote remctl server
7

SYNOPSIS

9       #include <remctl.h>
10
11       int remctl_open(struct remctl *r, const char *host,
12                          unsigned short port,
13                          const char *principal);
14
15       int remctl_open_addrinfo(struct remctl *r, const char *host,
16                                   const struct addrinfo *ai,
17                                   const char *principal);
18
19       int remctl_open_sockaddr(struct remctl *r, const char *host,
20                                   const struct sockaddr *addr, int addrlen,
21                                   const char *principal);
22
23       int remctl_open_fd(struct remctl *r, const char *host,
24                             int fd, const char *principal);
25

DESCRIPTION

27       remctl_open() opens a TCP connection to the given host on the given
28       port and then authenticates using the remctl protocol and the service
29       principal principal.  r is a remctl struct created via remctl_new().
30       host must not be NULL.  If port is 0, the library first attempts to
31       connect to the registered port of 4373 and then tries the legacy port
32       of 4444 if that fails.  Future versions of the library will drop this
33       fallback to 4444.  If principal is NULL, a service principal of
34       "host/host" is used, with the realm determined by domain-realm mapping.
35
36       remctl_open_addrinfo() operates in the same manner as remctl_open(),
37       but connects to the first usable address in ai, which must be a list of
38       results as returned by getaddrinfo(3).  The host is used only to form
39       the default service principal, and may be NULL if principal is not
40       NULL.
41
42       remctl_open_sockaddr() is equivalent to remctl_open_addrinfo() with a
43       single addrinfo structure specifying the use of TCP with socket address
44       addr and length addrlen.
45
46       remctl_open_fd() operates in the same manner as remctl_open_addrinfo(),
47       but uses an already-established TCP connection identified by the file
48       descriptor fd.  On Windows, fd is of type "SOCKET" and must be a valid
49       socket descriptor.
50
51       If no principal is specified and the default is used, the underlying
52       GSS-API library may canonicalize host via DNS before determining the
53       service principal, depending on your library configuration.  Specifying
54       a principal disables this behavior.
55
56       The remctl protocol uses Kerberos via GSS-API for authentication.  The
57       underlying GSS-API library will use the default ticket cache for
58       authentication, so to successfully use remctl_open(), the caller should
59       already have Kerberos tickets for an appropriate realm stored in its
60       default ticket cache.  The environment variable KRB5CCNAME or the
61       remctl_set_ccache(3) function can be used to control which ticket cache
62       is used.
63
64       To control the timeout for the connect and for subsequent calls, see
65       the remctl_set_timeout(3) function.  To control the source IP used by
66       remctl_open(), remctl_open_addrinfo(), and remctl_open_sockaddr(), see
67       the remctl_set_source_ip(3) function.
68

RETURN VALUE

70       remctl_open() returns true on success and false on failure.  On
71       failure, the caller should call remctl_error() to retrieve the error
72       message.
73

COMPATIBILITY

75       The remctl_open() interface has been provided by the remctl client
76       library since its initial release in version 2.0.
77       remctl_open_addrinfo(), remctl_open_sockaddr(), and remctl_open_fd()
78       were added in version 3.4.
79
80       The default port was changed to the IANA-registered port of 4373 in
81       version 2.11.
82
83       Support for IPv6 was added in version 2.4.
84

CAVEATS

86       If the principal argument to remctl_open() is NULL, most GSS-API
87       libraries will canonicalize the host using DNS before deriving the
88       principal name from it.  This means that when connecting to a remctl
89       server via a CNAME, remctl_open() will normally authenticate using a
90       principal based on the canonical name of the host instead of the
91       specified host parameter.  This behavior may cause problems if two
92       consecutive DNS lookups of host may return two different results, such
93       as with some DNS-based load-balancing systems.
94
95       The canonicalization behavior is controlled by the GSS-API library;
96       with the MIT Kerberos GSS-API library, canonicalization can be disabled
97       by setting "rdns" to false in the [libdefaults] section of krb5.conf.
98       It can also be disabled by passing an explicit Kerberos principal name
99       via the principal argument, which will then be used without changes.
100       If canonicalization is desired, the caller may wish to canonicalize
101       host before calling remctl_open() to avoid problems with multiple DNS
102       calls returning different results.
103
104       The default behavior, when a port of 0 is given, of trying 4373 and
105       falling back to 4444 will be removed in a future version of this
106       library in favor of using the "remctl" service in /etc/services if set
107       and then falling back on only 4373.  4444 was the poorly-chosen
108       original remctl port and should be phased out.
109
110       Connections established using the alternate-open interfaces
111       remctl_open_fd(), remctl_open_addrinfo(), and remctl_open_sockaddr() do
112       not support the automatic connection-reopening which is used to give
113       the illusion of a single long-lived connection when sending multiple
114       commands to a server which supports only version 1 of the remctl
115       protocol.  Therefore, when using these interfaces to open a connection
116       to such a server, it will only be possible to send a single command,
117       after which the connection must be closed and reopened before another
118       command can be sent.
119

NOTES

121       The remctl port number, 4373, was derived by tracing the diagonals of a
122       QWERTY keyboard up from the letters "remc" to the number row.
123

AUTHOR

125       Russ Allbery <eagle@eyrie.org>
126
128       Copyright 2007-2009, 2014 The Board of Trustees of the Leland Stanford
129       Junior University
130
131       Copying and distribution of this file, with or without modification,
132       are permitted in any medium without royalty provided the copyright
133       notice and this notice are preserved.  This file is offered as-is,
134       without any warranty.
135
136       SPDX-License-Identifier: FSFAP
137

SEE ALSO

139       remctl_new(3), remctl_error(3), remctl_set_ccache(3),
140       remctl_set_source_ip(3), remctl_set_timeout(3)
141
142       The current version of the remctl library and complete details of the
143       remctl protocol are available from its web page at
144       <https://www.eyrie.org/~eagle/software/remctl/>.
145
146
147
1483.15                              2018-05-05                    REMCTL_OPEN(3)
Impressum