remctld is normally started using tcpserver or from inetd, but it may be run in stand-alone mode as a daemon using -m. Either -s must be given to use an alternate identity (which will require the same flag be used for remctl client invocations), or it must be run as root to read the host keytab file. remctld logs its activity using syslog (the daemon facility).
The location of the configuration file may be specified with the -f option. The default location is /etc/remctl/remctl.conf. For information on the format of the configuration file, see ``CONFIGURATION FILE'' below.
When the command is run, several environment variables will be set providing information about the remote connection. See ENVIRONMENT below for more information.
To determine the port, remctld attempts to look up the "remctl" service in the local /etc/services file and uses the port defined there. If the "remctl" service could not be found, it uses 4373, the registered remctl port.
command subcommand executable [option=value ...] acl [acl ...]
Each command consists of a command, a subcommand, and zero or more arguments. Each configuration line defines an acceptable command and subcommand (or, if "ALL" is used as mentioned below under command and subcommand, a set of commands). The first configuration line matching the received command is used, so list more specific entries before more general entries.
Blank lines and lines beginning with "#" are ignored. Lines can be continued on the next line by ending them with a backslash ("\"). Be aware that comments can be continued with a backslash as well.
As a special case, a line like:
include file
will include file as if its contents were pasted verbatim into the configuration file at that point. file may be a directory, in which case all files whose names do not contain a period found in that directory will be included (in no particular order). file should be a fully qualified path.
The meaning of these fields is:
If the keyword "ALL" is used instead of a specific subcommand, this line matches all commands with the given subcommand (so "ALL ALL" matches any command) and can be used to dispatch all commands to the same executable with the same ACLs. Since the first matching entry is used, list entries for specific commands first (if any) and then the "ALL" catch-all. Note that while the subcommand is passed to the executable, the command is not, so the program run will not be able to distinguish between different commands.
If the keyword "ALL" is used instead of a specific subcommand, this line matches all subcommands with the given command and can be used to dispatch all subcommands under that command to the same executable with the same ACLs. Since the first matching entry is used, list entries for specific services first (if any) and then the "ALL" catch-all.
If the keyword "EMPTY" is used instead of a specific subcommand, this line matches only commands where no subcommand was given.
The subcommand is always passed as the first argument to the executable program that is listed for that service unless no subcommand was given.
For example, if the command is "admin passwd username password", then you'd want to set logmask to 3, so the password argument gets logged as "**MASKED**". If the command is "user passwd username old-password new-password", you'd want to set logmask to "3,4".
The subcommand cannot be passed on standard input, so n must be at least 2. If this option is set to "last" and no arguments are given except the command and possibly the subcommand, nothing will be passed on standard input.
This option is used primarily for passing large amounts of data that may not fit on the command line or data that contains NUL characters. It can also be used for arguments like passwords that shouldn't be exposed on the command line. Only at most one argument may be passed on standard input to the command.
If method is omitted, acl must either begin with "/" or must not contain "=". Otherwise, it will be parsed as an option instead. If there is any ambiguity, prepend the method.
Each entry is checked in order, and access is granted as soon as an entry matches. If no entry matches, access is denied. The following methods are supported:
For backward compatibility, a line like:
include [<method>:]<data>
in an ACL file behaves exactly as if the "include" directive had been omitted, except that the default method is "file". Thus, writing:
include <path>
in an ACL file is the same as writing:
file:<path>
and is handled identically to the include directive in configuration files.
Remember that access is granted as soon as an entry matches. For "deny" rules to be effective, they therefore must come before any ACLs they are intended to override. Be careful when using "deny" when including a directory of ACL files, since the files in that directory are read in an undefined order (not in alphabetical order by filename). It's best to explicitly include the file containing "deny" ACL rules first.
Note that "deny" only denies access; it never grants it. Thus, deny alone does not grant access to anyone, and using deny on itself as in "deny:deny:foo" neither denies nor grants access to anyone.
This method is supported only if remctld was compiled with GPUT support by using the "--with-gput" configure option.
This method is supported only if remctld was compiled with PCRE support by using the "--with-pcre" configure option.
To see the list of ACL types supported by a particular build of remctld, run "remctld -h".
The keyword ANYUSER may be used instead of the ACLs to allow access to all users. The user still needs to authenticate to remctld; this only affects authorization. This can be used for backend programs that want to check ACLs themselves and will retrieve the authenticated principal from the REMOTE_USER environment variable. Note that ANYUSER accepts any authenticated user, including cross-realm users from foreign Kerberos realms.
Support for ACL schemes is new in remctl 2.13. Prior versions of remctld expected only files in the main remctld configuration file, and only principals or lines starting with "include" in those files, without any method: prefixes.
remctld also used to set SCPRINCIPAL for (partial) backward compatibility with sysctld, but stopped doing so as of remctl 2.1.
If the -k flag is used, remctld will also set KRB5_KTNAME to the provided keytab path. This is primarily for communication with the GSS-API library, but this setting will also be inherited by any commands run by remctld.
tcpserver hostname 4373 remctld
The equivalent line for /etc/inetd.conf is:
4373 stream tcp nowait root /usr/sbin/tcpd /usr/sbin/remctld
or:
remctl stream tcp nowait root /usr/sbin/tcpd /usr/sbin/remctld
if the "remctl" service is listed in your /etc/services file.
To start remctld in stand-alone mode instead, run:
remctld -m
Example configuration file:
# Comments can be used like this.
accounts create /usr/local/bin/doaccount /etc/acl/group1 \
/etc/acl/group2
accounts delete /usr/local/bin/doaccount /etc/acl/group3
accounts view /usr/local/bin/doaccount ANYUSER
accounts passwd /usr/local/bin/dopasswd logmask=3 /etc/acl/group1
printing ALL /usr/local/bin/printthing /etc/acl/group2
The commands "accounts create", "accounts delete", and so forth will all be passed to /usr/local/bin/doaccount with the first argument being the specific subcommand, with the exception of "accounts passwd". That command will be passed to /usr/local/bin/dopasswd instead, but it will still get "passwd" as its first argument. The third argument to "accounts passwd" (presumably the password) will not be logged to syslog. All commands starting with "printing" will be passed to /usr/local/bin/printthing.
Example ACL file using the scheme support new in remctl 2.13:
# This is a comment.
deny:baduser@EXAMPLE.ORG
file:/etc/remctl/acl/admins
principal:service/admin@EXAMPLE.ORG
service/other@EXAMPLE.ORG
This ACL file will reject "baduser@EXAMPLE.ORG" even if that user would have been allowed by one of the other ACL rules. It will then grant access according to the ACL entries in /etc/remctl/acl/admins and the specific principals "service/admin@EXAMPLE.ORG" and "service/other@EXAMPLE.ORG". The last line takes advantage of the default ACL method of "principal" when processing an ACL file.
remctld does not itself impose any limits on the number of child processes or other system resources. You may want to set resource limits in your inetd server or with ulimit when running it as a standalone daemon or under tcpserver.
Command arguments may not contain NUL characters and must be shorter than the operating system limit on the length of a command line since they're passed to the command as command-line arguments. The exception is an argument passed via standard input using the "stdin=" option in the configuration file. At most one argument may be passed that way.
The current version of this program is available from its web page at <http://www.eyrie.org/~eagle/software/remctl/>.
Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Stanford University not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. Stanford University makes no representations about the suitability of this software for any purpose. It is provided ``as is'' without express or implied warranty.
THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.