File: remctl_open.pod

package info (click to toggle)
remctl 3.18-5
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 5,612 kB
  • sloc: ansic: 19,504; sh: 5,386; perl: 1,778; java: 740; makefile: 715; xml: 502; python: 430
file content (154 lines) | stat: -rw-r--r-- 6,564 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
=for stopwords
remctl const TCP GSS-API DNS DNS-based KRB5CCNAME lookups canonicalization
libdefaults Allbery CNAME ai addr addrinfo addrlen fd IANA-registered
SPDX-License-Identifier FSFAP

=head1 NAME

remctl_open - Connect to a remote remctl server

=head1 SYNOPSIS

#include <remctl.h>

int B<remctl_open>(struct remctl *I<r>, const char *I<host>,
                   unsigned short I<port>,
                   const char *I<principal>);

int B<remctl_open_addrinfo>(struct remctl *I<r>, const char *I<host>,
                            const struct addrinfo *I<ai>,
                            const char *I<principal>);

int B<remctl_open_sockaddr>(struct remctl *I<r>, const char *I<host>,
                            const struct sockaddr *I<addr>, int I<addrlen>,
                            const char *I<principal>);

int B<remctl_open_fd>(struct remctl *I<r>, const char *I<host>,
                      int I<fd>, const char *I<principal>);

=head1 DESCRIPTION

remctl_open() opens a TCP connection to the given I<host> on the given
I<port> and then authenticates using the remctl protocol and the service
principal I<principal>.  I<r> is a remctl struct created via remctl_new().
I<host> must not be NULL.  If I<port> is 0, the library first attempts to
connect to the registered port of 4373 and then tries the legacy port of
4444 if that fails.  Future versions of the library will drop this
fallback to 4444.  If I<principal> is NULL, a service principal of
C<host/I<host>> is used, with the realm determined by domain-realm
mapping.

remctl_open_addrinfo() operates in the same manner as remctl_open(), but
connects to the first usable address in I<ai>, which must be a list of
results as returned by getaddrinfo(3).  The I<host> is used only to form
the default service principal, and may be NULL if I<principal> is not NULL.

remctl_open_sockaddr() is equivalent to remctl_open_addrinfo() with a
single addrinfo structure specifying the use of TCP with socket address
I<addr> and length I<addrlen>.

remctl_open_fd() operates in the same manner as remctl_open_addrinfo(),
but uses an already-established TCP connection identified by the file
descriptor I<fd>.  On Windows, I<fd> is of type C<SOCKET> and must be
a valid socket descriptor.

If no principal is specified and the default is used, the underlying
GSS-API library may canonicalize I<host> via DNS before determining the
service principal, depending on your library configuration.  Specifying a
principal disables this behavior.

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.  The environment variable KRB5CCNAME or the
L<remctl_set_ccache(3)> function can be used to control which ticket cache
is used.

To control the timeout for the connect and for subsequent calls, see the
L<remctl_set_timeout(3)> function.  To control the source IP used by
remctl_open(), remctl_open_addrinfo(), and remctl_open_sockaddr(), see the
L<remctl_set_source_ip(3)> function.

=head1 RETURN VALUE

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

=head1 COMPATIBILITY

The remctl_open() interface has been provided by the remctl client library
since its initial release in version 2.0.  remctl_open_addrinfo(),
remctl_open_sockaddr(), and remctl_open_fd() were added in version 3.4.

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.

=head1 CAVEATS

If the I<principal> argument to remctl_open() is NULL, most GSS-API
libraries will canonicalize the I<host> using DNS before deriving the
principal name from it.  This means that 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
I<host> parameter.  This behavior may cause problems if two consecutive
DNS lookups of I<host> may return two different results, such as with some
DNS-based load-balancing systems.

The canonicalization behavior is controlled by the GSS-API library; with
the MIT Kerberos GSS-API library, canonicalization can be disabled by
setting C<rdns> to false in the [libdefaults] section of F<krb5.conf>.  It
can also be disabled by passing an explicit Kerberos principal name via
the I<principal> argument, which will then be used without changes.  If
canonicalization is desired, the caller may wish to canonicalize I<host>
before calling remctl_open() to avoid problems with multiple DNS calls
returning different results.

The default behavior, when a port of 0 is given, of trying 4373 and
falling back to 4444 will be removed in a future version of this library
in favor of using the C<remctl> service in F</etc/services> if set and
then falling back on only 4373.  4444 was the poorly-chosen original
remctl port and should be phased out.

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.

=head1 NOTES

The remctl port number, 4373, was derived by tracing the diagonals of a
QWERTY keyboard up from the letters C<remc> to the number row.

=head1 AUTHOR

Russ Allbery <eagle@eyrie.org>

=head1 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
  
=head1 SEE ALSO

remctl_new(3), remctl_error(3), remctl_set_ccache(3),
remctl_set_source_ip(3), remctl_set_timeout(3)

The current version of the remctl library and complete details of the
remctl protocol are available from its web page at
L<https://www.eyrie.org/~eagle/software/remctl/>.

=cut