source: web/old/remctl-2.14/docs/api/remctl.pod @ f6f3e91

web
Last change on this file since f6f3e91 was f6f3e91, checked in by Jessica B. Hamrick <jhamrick@…>, 15 years ago

Preserve directory hierarchy (not sure what happened to it)

  • Property mode set to 100644
File size: 5.6 KB
Line 
1=for stopwords
2remctl const API hostname IP NUL-terminated GSS-API DNS KRB5CCNAME NULs
3ENOMEM CNAME lookups canonicalization libdefaults canonicalize Allbery
4DNS-based
5
6=head1 NAME
7
8remctl, remctl_result_free - Simple remctl call to a remote server
9
10=head1 SYNOPSIS
11
12#include <remctl.h>
13
14struct remctl_result *
15 B<remctl>(const char *I<host>, unsigned short I<port>,
16        const char *I<principal>, const char **I<command>);
17
18void B<remctl_result_free>(struct remctl_result *I<result>);
19
20=head1 DESCRIPTION
21
22remctl() provides a simplified client API for the remctl protocol.  Given
23the host, port, service principal for authentication, and command to run,
24it opens a connection to the remote system, sends the command via the
25remctl protocol, reads the results, closes the connection, and returns the
26result as a remctl_result struct.
27
28I<host> is a hostname or IP address and must be non-NULL.  I<port> is the
29port to connect to; if 0, the library first attempts to connect to the
30registered port of 4373 and then tries the legacy port of 4444 if that
31fails.  Future versions of the library will drop this fallback to 4444.
32I<principal> is the service principal to use for authentication; if NULL,
33C<host/I<host>> is used, with the realm determined by domain-realm
34mapping.  I<command> is the command to run as a NULL-terminated array of
35NUL-terminated strings.
36
37If no principal is specified and the default is used, the underlying
38GSS-API library may canonicalize I<host> via DNS before determining the
39service principal, depending on your library configuration.  Specifying a
40principal disables this behavior.
41
42The remctl protocol uses Kerberos v5 via GSS-API for authentication.  The
43underlying GSS-API library will use the default ticket cache for
44authentication, so to successfully use remctl(), the caller should already
45have Kerberos tickets for an appropriate realm stored in its default
46ticket cache.  The environment variable KRB5CCNAME can be used to control
47which ticket cache is used.
48
49remctl() returns a newly allocated remctl_result struct, which has the
50following members:
51
52    struct remctl_result {
53        char *error;                /* remctl error if non-NULL. */
54        char *stdout_buf;           /* Standard output. */
55        size_t stdout_len;          /* Length of standard output. */
56        char *stderr_buf;           /* Standard error. */
57        size_t stderr_len;          /* Length of standard error. */
58        int status;                 /* Exit status of remote command. */
59    };
60
61If error is non-NULL, a protocol error occurred and the command was not
62successfully completed.  Otherwise, standard output from the command will
63be stored in stdout_buf with the length in stdout_len, standard error from
64the command will be stored in stderr_buf with the length in stderr_len,
65and status will hold the exit status of the command.  Following the
66standard Unix convention, a 0 status should normally be considered success
67and any non-zero status should normally be considered failure, although a
68given command may have its own exit status conventions.
69
70remctl_result_free() frees the remctl_result struct when the calling
71program is through with it.
72
73If you want more control over the steps of the protocol, if you want to
74issue multiple commands on the same connection, or if you need to send
75data as part of the command that contains NULs, use the full API described
76in remctl_new(3), remctl_open(3), remctl_commandv(3), and
77remctl_output(3).
78
79=head1 RETURN VALUE
80
81remctl() returns NULL on failure to allocate a new remctl_result struct or
82on failure to allocate space to store an error message.  Otherwise, it
83returns a newly allocated remctl_result struct with either an error
84message in the error field or the results of the command filled out as
85described above.  If remctl() returns NULL, errno will be set to an
86appropriate error code (generally ENOMEM).
87
88=head1 CAVEATS
89
90If the I<principal> argument to remctl() is NULL, most GSS-API libraries
91will canonicalize the I<host> using DNS before deriving the principal name
92from it.  This means that when connecting to a remctl server via a CNAME,
93remctl() will normally authenticate using a principal based on the
94canonical name of the host instead of the specified I<host> parameter.
95This behavior may cause problems if two consecutive DNS lookups of I<host>
96may return two different results, such as with some DNS-based
97load-balancing systems.
98
99The canonicalization behavior is controlled by the GSS-API library; with
100the MIT Kerberos GSS-API library, canonicalization can be disabled by
101setting C<rdns> to false in the [libdefaults] section of F<krb5.conf>.  It
102can also be disabled by passing an explicit Kerberos principal name via
103the I<principal> argument, which will then be used without changes.  If
104canonicalization is desired, the caller may wish to canonicalize I<host>
105before calling remctl() to avoid problems with multiple DNS calls
106returning different results.
107
108The default behavior, when a port of 0 is given, of trying 4373 and
109falling back to 4444 will be removed in a future version of this library
110in favor of using the C<remctl> service in F</etc/services> if set and
111then falling back on only 4373.  4444 was the poorly-chosen original
112remctl port and should be phased out.
113
114=head1 NOTES
115
116The remctl port number, 4373, was derived by tracing the diagonals of a
117QWERTY keyboard up from the letters C<remc> to the number row.
118
119=head1 SEE ALSO
120
121remctl_new(3), remctl_open(3), remctl_command(3), remctl_commandv(3),
122remctl_output(3), remctl_close(3)
123
124The current version of the remctl library and complete details of the
125remctl protocol are available from its web page at
126L<http://www.eyrie.org/~eagle/software/remctl/>.
127
128=head1 AUTHOR
129
130Russ Allbery <rra@stanford.edu>
131
132=cut
Note: See TracBrowser for help on using the repository browser.