remctl(3)


NAME

   remctl, remctl_result_free - Simple remctl call to a remote server

SYNOPSIS

   #include <remctl.h>

   struct remctl_result *
    remctl(const char *host, unsigned short port,
           const char *principal, const char **command);

   void remctl_result_free(struct remctl_result *result);

DESCRIPTION

   remctl() provides a simplified client API for the remctl protocol.
   Given the host, port, service principal for authentication, and command
   to run, it opens a connection to the remote system, sends the command
   via the remctl protocol, reads the results, closes the connection, and
   returns the result as a remctl_result struct.

   host is a hostname or IP address and must be non-NULL.  port is the
   port to connect to; if 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.
   principal is the service principal to use for authentication; if NULL,
   "host/host" is used, with the realm determined by domain-realm mapping.
   command is the command to run as a NULL-terminated array of NUL-
   terminated strings.

   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.

   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(), the caller should
   already have Kerberos tickets for an appropriate realm stored in its
   default ticket cache.  The environment variable KRB5CCNAME can be used
   to control which ticket cache is used.  If the client needs to control
   which ticket cache is used without changing the environment, use the
   full client API along with remctl_set_ccache(3).

   remctl() returns a newly allocated remctl_result struct, which has the
   following members:

       struct remctl_result {
           char *error;                /* remctl error if non-NULL. */
           char *stdout_buf;           /* Standard output. */
           size_t stdout_len;          /* Length of standard output. */
           char *stderr_buf;           /* Standard error. */
           size_t stderr_len;          /* Length of standard error. */
           int status;                 /* Exit status of remote command. */
       };

   If error is non-NULL, a protocol error occurred and the command was not
   successfully completed.  Otherwise, standard output from the command
   will be stored in stdout_buf with the length in stdout_len, standard
   error from the command will be stored in stderr_buf with the length in
   stderr_len, and status will hold the exit status of the command.
   Following the standard Unix convention, a 0 status should normally be
   considered success and any non-zero status should normally be
   considered failure, although a given command may have its own exit
   status conventions.

   remctl_result_free() frees the remctl_result struct when the calling
   program is through with it.

   If you want more control over the steps of the protocol, issue multiple
   commands on the same connection, control the ticket cache or source IP,
   set a timeout on replies, or send data as part of the command that
   contains NULs, use the full API described in remctl_new(3),
   remctl_open(3), remctl_commandv(3), and remctl_output(3).

RETURN VALUE

   remctl() returns NULL on failure to allocate a new remctl_result struct
   or on failure to allocate space to store an error message.  Otherwise,
   it returns a newly allocated remctl_result struct with either an error
   message in the error field or the results of the command filled out as
   described above.  If remctl() returns NULL, errno will be set to an
   appropriate error code (generally ENOMEM).

COMPATIBILITY

   This interface has been provided by the remctl client library since its
   initial release in version 2.0.

   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

   If the principal argument to remctl() is NULL, most GSS-API libraries
   will canonicalize the host using DNS before deriving the principal name
   from it.  This means that when connecting to a remctl server via a
   CNAME, remctl() 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.

   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() 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 "remctl" service in /etc/services if set
   and then falling back on only 4373.  4444 was the poorly-chosen
   original remctl port and should be phased out.

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.

AUTHOR

   Russ Allbery <eagle@eyrie.org>

COPYRIGHT AND LICENSE

   Copyright 2007, 2008, 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.

SEE ALSO

   remctl_new(3), remctl_open(3), remctl_command(3), remctl_commandv(3),
   remctl_output(3), remctl_close(3)

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





Opportunity


Personal Opportunity - Free software gives you access to billions of dollars of software at no cost. Use this software for your business, personal use or to develop a profitable skill. Access to source code provides access to a level of capabilities/information that companies protect though copyrights. Open source is a core component of the Internet and it is available to you. Leverage the billions of dollars in resources and capabilities to build a career, establish a business or change the world. The potential is endless for those who understand the opportunity.

Business Opportunity - Goldman Sachs, IBM and countless large corporations are leveraging open source to reduce costs, develop products and increase their bottom lines. Learn what these companies know about open source and how open source can give you the advantage.





Free Software


Free Software provides computer programs and capabilities at no cost but more importantly, it provides the freedom to run, edit, contribute to, and share the software. The importance of free software is a matter of access, not price. Software at no cost is a benefit but ownership rights to the software and source code is far more significant.


Free Office Software - The Libre Office suite provides top desktop productivity tools for free. This includes, a word processor, spreadsheet, presentation engine, drawing and flowcharting, database and math applications. Libre Office is available for Linux or Windows.





Free Books


The Free Books Library is a collection of thousands of the most popular public domain books in an online readable format. The collection includes great classical literature and more recent works where the U.S. copyright has expired. These books are yours to read and use without restrictions.


Source Code - Want to change a program or know how it works? Open Source provides the source code for its programs so that anyone can use, modify or learn how to write those programs themselves. Visit the GNU source code repositories to download the source.





Education


Study at Harvard, Stanford or MIT - Open edX provides free online courses from Harvard, MIT, Columbia, UC Berkeley and other top Universities. Hundreds of courses for almost all major subjects and course levels. Open edx also offers some paid courses and selected certifications.


Linux Manual Pages - A man or manual page is a form of software documentation found on Linux/Unix operating systems. Topics covered include computer programs (including library and system calls), formal standards and conventions, and even abstract concepts.