]> eyrie.org Git - kerberos/remctl.git/blob - README.md
Ignore ignored attributes for Ruby
[kerberos/remctl.git] / README.md
1 # remctl
2
3 [![Build
4 status](https://github.com/rra/remctl/workflows/build/badge.svg)](https://github.com/rra/remctl/actions)
5 [![Debian
6 package](https://img.shields.io/debian/v/remctl/unstable)](https://tracker.debian.org/pkg/remctl)
7
8 Copyright 2015-2022 Russ Allbery <eagle@eyrie.org>.  Copyright 2002-2014
9 The Board of Trustees of the Leland Stanford Junior University.  This
10 software is distributed under a BSD-style license.  Please see the section
11 [License](#license) below for more information.
12
13 ## Blurb
14
15 remctl is a client/server application that supports remote execution of
16 specific commands, using Kerberos GSS-API for authentication.
17 Authorization is controlled by a configuration file and ACL files and can
18 be set separately for each command, unlike with rsh.  remctl is like a
19 Kerberos-authenticated simple CGI server, or a combination of Kerberos ssh
20 and sudo without most of the features and complexity of either.
21
22 ## Description
23
24 remctl is a client/server application that supports remote execution of
25 specific commands, using Kerberos GSS-API for authentication and
26 confidentiality.  The commands a given user can execute are controlled by
27 a configuration file and ACL files and can easily be tightly limited,
28 unlike with rsh.  The mapping of command to backend program is done by the
29 configuration file, which allows some additional flexibility compared to
30 ssh command restrictions and works with Kerberos authentications rather
31 than being limited to public key authentications.
32
33 remctld is very similar to a CGI server that uses a different network
34 protocol than HTTP, always does strong authentication before executing the
35 desired command, and guarantees the data is encrypted on the network.
36 Alternately, you can think of it as a very simple combination of Kerberos
37 ssh and sudo, without most of the features of both but with simpler
38 authorization.
39
40 There are a lot of different client/server systems that do something
41 similar: current packages like gRPC, and a wealth of older systems like
42 rsh, CGI, CERN's arc, and more elaborate systems like MIT's Moira.  remctl
43 has the advantage over many of these schemes of using GSS-API and being
44 about as simple as it possibly can be while still being useful.  It
45 doesn't require any particular programming language, builds self-contained
46 binaries, and uses as minimal of a protocol as possible.
47
48 Both C and Java clients and servers are provided, as well as Perl, PHP,
49 Python, and Ruby bindings for the C client library.  For more information
50 about the Java client, see `java/README`.  For more information about the
51 PHP bindings, see `php/README`.  For more information about the Python
52 bindings, see `python/README`.  For more information about the Ruby
53 bindings, see `ruby/README`.
54
55 Also included in the remctl package is an alternate way of running the
56 remctl server: remctl-shell.  This program is designed to be run as either
57 a shell or a forced command under ssh, using ssh for authentication and
58 communicating the authentication information to remctl-shell via either
59 environment variables or command-line arguments via the forced command
60 configuration.  This version of the server uses simple ssh clients, rather
61 than using the remctl client program or libraries.
62
63 remctl was originally written by Anton Ushakov as a replacement for IBM's
64 sysctl, a client/server application with Kerberos v4 authentication that
65 allowed the client to run Tcl code on the server, protected by ACLs.  At
66 Stanford, we used sysctl extensively, but mostly only to run external
67 programs, so remctl was developed as a Kerberos v5 equivalent that did
68 only the portions we needed.
69
70 Complete protocol documentation is available in `docs/protocol.html`.
71 Also present, as `docs/design.html`, is the original design document (now
72 somewhat out of date).
73
74 ## Requirements
75
76 The remctld server and the standard client are written in C and require a
77 C compiler and GSS-API libraries to build.  Both will build against either
78 MIT Kerberos or Heimdal of any reasonable vintage.  remctl will also build
79 against the Kerberos GSS-API implementation shipped with AIX 5.2 (and
80 possibly later versions) and the Solaris 10 generic GSS-API library (and
81 possibly later versions).  The `remctl_set_ccache` implementation is
82 improved by building with Kerberos libraries and a GSS-API library that
83 supports `gss_krb5_import_cred`.
84
85 The remctld server requires libevent 1.4.x or later.  It was only tested
86 with libevent 1.4.13-stable and later, but should work with 1.4.4 or
87 later.  It is now only tested with libevent 2.x, so moving to a later
88 version of libevent if possible is recommended.
89
90 The remctl server will support regex ACLs if the system supports the POSIX
91 regex API.  The remctl server also optionally supports PCRE regular
92 expressions in ACLs.  To include that support, the PCRE library (either
93 PCRE2 or PCRE1) is required.
94
95 To build the remctl client for Windows, the Microsoft Windows SDK for
96 Windows Vista and the MIT Kerberos for Windows SDK are required, along
97 with a Microsoft Windows build environment (probably Visual Studio).
98 remctl has only been tested with the 3.2.1 MIT Kerberos for Windows SDK.
99 To run the resulting binary, MIT Kerberos for Windows must be installed
100 and configured.  The client was tested on Windows XP and Vista and should
101 work on Windows 2000 and up; however, the primary maintainer does not use
102 or test Windows, so it's always possible Windows support has broken.  The
103 server is not supported on Windows.
104
105 To build the Perl bindings for the C client library, you will need Perl
106 5.10 or later.
107
108 To build the PHP bindings for the C client library, you will need PHP 5.x
109 or later and phpize, plus any other programs that phpize requires.  PHP
110 5.x support has only been tested on 5.2 and 5.3, and PHP support is now
111 only tested on PHP 7.x and later.
112
113 To build the Python bindings for the C client library, you will need
114 Python 2.7, or Python 3.1 or later.  You will also need the setuptools and
115 pytest modules and, for Python 2, the typing module.  Earlier versions may
116 work back to possibly Python 2.3, but are not tested.
117
118 To build the Ruby bindings for the C client library, you will need Ruby
119 1.8 or later (primarily tested with 2.5 and later).
120
121 None of the language bindings have been tested on Windows.
122
123 A Java client and Java server are available in the java subdirectory, but
124 they are not integrated into the normal build or built by default.  There
125 is a basic Makefile in that directory that may require some tweaking.  It
126 currently requires the Sun Java JDK (1.4.2, 5, or 6) or OpenJDK 6 or
127 later.  A considerably better Java client implementation is available on
128 the `java` branch in the Git repository but has not yet been merged.
129
130 To bootstrap from a Git checkout, or if you change the Automake files and
131 need to regenerate Makefile.in, you will need Automake 1.11 or later.  For
132 bootstrap or if you change configure.ac or any of the m4 files it includes
133 and need to regenerate configure or config.h.in, you will need Autoconf
134 2.64 or later.  Perl is also required to generate manual pages from a
135 fresh Git checkout.  You will also need pkg-config installed to regenerate
136 configure and xml2rfc to build the formatted protocol documentation.
137
138 ## Building and Installation
139
140 You can build and install remctl with the standard commands:
141
142 ```
143     ./configure
144     make
145     make install
146 ```
147
148 If you are building from a Git clone, first run `./bootstrap` in the
149 source directory to generate the build files.  `make install` will
150 probably have to be done as root.  Building outside of the source
151 directory is also supported, if you wish, by creating an empty directory
152 and then running configure with the correct relative path.
153
154 Solaris users should look at `examples/remctld.xml`, an SMF manifest for
155 running the `remctld` daemon.
156
157 To also build the Perl bindings for the libremctl client library, pass the
158 `--enable-perl` option to `configure`.  The Perl module build is handled
159 by the normal Perl extension build system, and therefore will be built
160 with compiler flags defined by your Perl installation and installed into
161 your local Perl module directory regardless of the `--prefix` argument to
162 `configure`.  To change this, you will need to run `perl Makefile.PL` in
163 the `perl` subdirectory of the build tree with appropriate options and
164 rebuild the module after running `make` and before running `make install`.
165
166 To also build the remctl PECL extension for PHP, pass the `--enable-php`
167 option to `configure`.  The PHP PECL module build is handled by the normal
168 PHP extension build system and therefore will be installed into your local
169 PHP module directory.  The configure script will look for `phpize` on your
170 `PATH` by default; if it's in some other directory, set the `PHPIZE`
171 environment variable to the full path or set it on the configure command
172 line.  The configure script for the PECL extension will be run during the
173 build instead of during configure.  This is unfortunately apparently
174 unavoidable given how the PECL build system works.
175
176 To also build the Python bindings for the libremctl client library, pass
177 the `--enable-python` option to configure.  The Python module build is
178 handled by the normal Python extension build system, and therefore will be
179 installed into your local Python module directory regardless of the
180 `--prefix` argument to `configure`.  To change this, you will need to run
181 `python setup.py install` by hand in the `python` directory with whatever
182 options you want to use.
183
184 To also build the Ruby bindings for the libremctl client library, pass the
185 `--enable-ruby` option to configure.  The Ruby module build is handled by
186 the normal Ruby module build system, and therefore will be installed into
187 your local Ruby module directory regardless of the `--prefix` argument to
188 `configure`.  To change this, override the `sitedir` variable on the `make
189 install` command line, as in:
190
191 ```
192     make install sitedir=/opt/ruby
193 ```
194
195 The remctl build system also supports a few other environment variables
196 that can be set to control aspects of the Perl, Python, and Ruby binding
197 build systems.  These are primarily only of use when packaging the
198 software.  For more information, a list of the variables, and their
199 effects, see the comment at the start of `Makefile.am`.
200
201 The Java client and server aren't integrated with the regular build
202 system.  For information on building and installing them, see
203 `java/README`.
204
205 remctl will use pkg-config if it's available to find the build flags for
206 libevent.  You can control which pkg-config binary and paths are used with
207 the normal pkg-config environment variables of `PKG_CONFIG`,
208 `PKG_CONFIG_PATH`, and `PKG_CONFIG_LIBDIR`, and you can override the
209 pkg-config results with `LIBEVENT_CFLAGS` and `LIBEVENT_LIBS`.
210 Alternately, you can bypass pkg-config by passing one or more of
211 `--with-libevent`, `--with-libevent-include`, and `--with-libevent-lib` to
212 indicate the install prefix, include directory, or library directory.
213
214 remctl will automatically build with PCRE support if PCRE2 or PCRE1 are
215 found.  As with libevent, remctl will use pkg-config if it's available to
216 find the build flags for PCRE2.  Use the same variables as documented by
217 libevent to control which pkg-config is used, and override its results
218 with `PCRE2_CFLAGS` and `PCRE2_LIBS`.  For PCRE1, the `pcre-config` script
219 will be used.  You can set `PCRE_CONFIG` to point to a different
220 pcre-config script, or do similar things as with `PATH_KRB5_CONFIG`
221 described below.  Alternately, you can bypass pkg-config by passing one or
222 more of `--with-pcre2`, `--with-pcre2-include`, `--with-pcre2-lib`,
223 `--with-pcre`, `--with-pcre-include`, or `--with-pcre-lib` to indicate the
224 install prefix, include directory, or library directory.
225
226 remctl will automatically build with GPUT support if the GPUT header and
227 library are found.  You can pass `--with-gput` to configure to specify the
228 root directory where GPUT is installed, or set the include and library
229 directories separately with `--with-gput-include` and `--with-gput-lib`.
230
231 Normally, configure will use `krb5-config` to determine the flags to use
232 to compile with your Kerberos libraries.  To specify a particular
233 `krb5-config` script to use, either set the `PATH_KRB5_CONFIG` environment
234 variable or pass it to configure like:
235
236 ```
237     ./configure PATH_KRB5_CONFIG=/path/to/krb5-config
238 ```
239
240 If `krb5-config` isn't found, configure will look for the standard
241 Kerberos libraries in locations already searched by your compiler.  If the
242 the `krb5-config` script first in your path is not the one corresponding
243 to the Kerberos libraries you want to use, or if your Kerberos libraries
244 and includes aren't in a location searched by default by your compiler,
245 you need to specify a different Kerberos installation root via
246 `--with-krb5=PATH`.  For example:
247
248 ```
249     ./configure --with-krb5=/usr/pubsw
250 ```
251
252 You can also individually set the paths to the include directory and the
253 library directory with `--with-krb5-include` and `--with-krb5-lib`.  You
254 may need to do this if Autoconf can't figure out whether to use `lib`,
255 `lib32`, or `lib64` on your platform.
256
257 To not use `krb5-config` and force library probing even if there is a
258 `krb5-config` script on your path, set `PATH_KRB5_CONFIG` to a nonexistent
259 path:
260
261 ```
262     ./configure PATH_KRB5_CONFIG=/nonexistent
263 ```
264
265 `krb5-config` is not used and library probing is always done if either
266 `--with-krb5-include` or `--with-krb5-lib` are given.
267
268 GSS-API libraries are found the same way: with `krb5-config` by default if
269 it is found, and a `--with-gssapi=PATH` flag to specify the installation
270 root.  `PATH_KRB5_CONFIG` is similarly used to find `krb5-config` for the
271 GSS-API libraries, and `--with-gssapi-include` and `--with-gssapi-lib` can
272 be used to specify the exact paths, overriding any `krb5-config` results.
273
274 Pass `--enable-silent-rules` to configure for a quieter build (similar to
275 the Linux kernel).  Use `make warnings` instead of `make` to build with
276 full GCC compiler warnings (requires either GCC or Clang and may require a
277 relatively current version of the compiler).
278
279 You can pass the `--enable-reduced-depends` flag to configure to try to
280 minimize the shared library dependencies encoded in the binaries.  This
281 omits from the link line all the libraries included solely because other
282 libraries depend on them and instead links the programs only against
283 libraries whose APIs are called directly.  This will only work with shared
284 libraries and will only work on platforms where shared libraries properly
285 encode their own dependencies (this includes most modern platforms such as
286 all Linux).  It is intended primarily for building packages for Linux
287 distributions to avoid encoding unnecessary shared library dependencies
288 that make shared library migrations more difficult.  If none of the above
289 made any sense to you, don't bother with this flag.
290
291 ## Testing
292
293 remctl comes with a comprehensive test suite, but it requires some
294 configuration in order to test anything other than low-level utility
295 functions.  For the full test suite, you will need to have a keytab that
296 can authenticate to a running KDC.  Using a test KDC environment, if you
297 have one, is recommended.
298
299 Follow the instructions in `tests/config/README` to configure the test
300 suite.
301
302 Now, you can run the test suite with:
303
304 ```
305     make check
306 ```
307
308 If a test fails, you can run a single test with verbose output via:
309
310 ```
311     tests/runtests -o <name-of-test>
312 ```
313
314 Do this instead of running the test program directly since it will ensure
315 that necessary environment variables are set up.
316
317 On particularly slow or loaded systems, you may see intermittant failures
318 from the `server/streaming` test because it's timing-sensitive.
319
320 The test suite will also need to be able to bind to 127.0.0.1 on port
321 11119 and 14373 to run test network server programs.
322
323 To test anonymous authentication, the KDC configured in the test suite
324 needs to support service tickets for the anonymous identity (not a
325 standard configuration).  This test will be skipped if the KDC does not
326 support this.
327
328 To test user handling in remctld, you will need the `fakeroot` command
329 (available in the `fakeroot` package in Debian and Ubuntu).  This test
330 will be skipped if `fakeroot` isn't available.
331
332 The following additional Perl modules will be used by the test suite for
333 the main package and the Perl bindings if installed:
334
335 * Test::MinimumVersion
336 * Test::Perl::Critic
337 * Test::Pod
338 * Test::Pod::Coverage
339 * Test::Spelling
340 * Test::Strict
341 * Test::Synopsis
342
343 All are available on CPAN.  Those tests will be skipped if the modules are
344 not available.
345
346 To enable tests that don't detect functionality problems but are used to
347 sanity-check the release, set the environment variable `RELEASE_TESTING`
348 to a true value.  To enable tests that may be sensitive to the local
349 environment or that produce a lot of false positives without uncovering
350 many problems, set the environment variable `AUTHOR_TESTING` to a true
351 value.
352
353 ## Building on Windows
354
355 (These instructions are not tested by the author and are now dated.
356 Updated instructions via a pull request, issue, or email are very
357 welcome.)
358
359 First, install the Microsoft Windows SDK for Windows Vista if you have not
360 already.  This is a free download from Microsoft for users of "Genuine
361 Microsoft Windows."  The `vcvars32.bat` environment provided by Visual
362 Studio may work as an alternative, but has not been tested.
363
364 Next, install the [MIT Kerberos for Windows
365 SDK](https://web.mit.edu/kerberos/www/dist/index.html).  remctl has been
366 tested with version 3.2.1 but should hopefully work with later versions.
367
368 Then, follow these steps:
369
370 1. Run the `InitEnv.cmd` script included with the Windows SDK with
371    parameters `"/xp /release"`.
372
373 2. Run the `configure.bat` script, giving it as an argument the location
374    of the Kerberos for Windows SDK.  For example, if you installed the KfW
375    SDK in `"c:\KfW SDK"`, you should run:
376
377    ```
378        configure "c:\KfW SDK"
379    ```
380
381 3. Run `nmake` to start compiling.  You can ignore the warnings.
382
383 If all goes well, you will have `remctl.exe` and `remctl.dll`.  The latter
384 is a shared library used by the client program.  It exports the same
385 interface as the UNIX libremctl library.
386
387 ## Support
388
389 The [remctl web page](https://www.eyrie.org/~eagle/software/remctl/) will
390 always have the current version of this package, the current
391 documentation, and pointers to any additional resources.
392
393 For bug tracking, use the [issue tracker on
394 GitHub](https://github.com/rra/remctl/issues).  However, please be aware
395 that I tend to be extremely busy and work projects often take priority.
396 I'll save your report and get to it as soon as I can, but it may take me a
397 couple of months.
398
399 ## Source Repository
400
401 remctl is maintained using Git.  You can access the current source on
402 [GitHub](https://github.com/rra/remctl) or by cloning the repository at:
403
404 https://git.eyrie.org/git/kerberos/remctl.git
405
406 or [view the repository on the
407 web](https://git.eyrie.org/?p=kerberos/remctl.git).
408
409 The eyrie.org repository is the canonical one, maintained by the author,
410 but using GitHub is probably more convenient for most purposes.  Pull
411 requests are gratefully reviewed and normally accepted.
412
413 ## License
414
415 The remctl package as a whole is covered by the following copyright
416 statement and license:
417
418 > Copyright 2015-2022
419 >     Russ Allbery <eagle@eyrie.org>
420 >
421 > Copyright 2002-2014
422 >     The Board of Trustees of the Leland Stanford Junior University
423 >
424 > Permission is hereby granted, free of charge, to any person obtaining a
425 > copy of this software and associated documentation files (the "Software"),
426 > to deal in the Software without restriction, including without limitation
427 > the rights to use, copy, modify, merge, publish, distribute, sublicense,
428 > and/or sell copies of the Software, and to permit persons to whom the
429 > Software is furnished to do so, subject to the following conditions:
430 >
431 > The above copyright notice and this permission notice shall be included in
432 > all copies or substantial portions of the Software.
433 >
434 > THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
435 > IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
436 > FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
437 > THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
438 > LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
439 > FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
440 > DEALINGS IN THE SOFTWARE.
441
442 Some files in this distribution are individually released under different
443 licenses, all of which are compatible with the above general package
444 license but which may require preservation of additional notices.  All
445 required notices, and detailed information about the licensing of each
446 file, are recorded in the LICENSE file.
447
448 Files covered by a license with an assigned SPDX License Identifier
449 include SPDX-License-Identifier tags to enable automated processing of
450 license information.  See https://spdx.org/licenses/ for more information.
451
452 For any copyright range specified by files in this package as YYYY-ZZZZ,
453 the range specifies every single year in that closed interval.