Mention need of wildcard support in make.
[rsync/rsync.git] / rsyncd.conf.yo
index f6f34a6..fa25d6d 100644 (file)
@@ -78,6 +78,18 @@ You may also include any module parameters in the global part of the
 config file in which case the supplied value will override the
 default for that parameter.
 
+You may use references to environment variables in the values of parameters.
+String parameters will have %VAR% references expanded as late as possible (when
+the string is used in the program), allowing for the use of variables that
+rsync sets at connection time, such as RSYNC_USER_NAME.  Non-string parameters
+(such as true/false settings) are expanded when read from the config file.  If
+a variable does not exist in the environment, or if a sequence of characters is
+not a valid reference (such as an un-paired percent sign), the raw characters
+are passed through unchanged.  This helps with backward compatibility and
+safety (e.g. expanding a non-existent %VAR% to an empty string in a path could
+result in a very unsafe path).  The safest way to insert a literal % into a
+value is to use %%.
+
 startdit()
 dit(bf(motd file)) This parameter allows you to specify a
 "message of the day" to display to clients on each connect. This
@@ -121,6 +133,9 @@ name contains whitespace, each internal sequence of whitespace will be
 changed into a single space, while leading or trailing whitespace will be
 discarded.
 
+As with GLOBAL PARAMETERS, you may use references to environment variables in
+the values of parameters.  See the GLOBAL PARAMETERS section for more details.
+
 startdit()
 
 dit(bf(comment)) This parameter specifies a description string
@@ -131,6 +146,13 @@ dit(bf(path)) This parameter specifies the directory in the daemon's
 filesystem to make available in this module.  You must specify this parameter
 for each module in tt(rsyncd.conf).
 
+You may base the path's value off of an environment variable by surrounding
+the variable name with percent signs.  You can even reference a variable
+that is set by rsync when the user connects.
+For example, this would use the authorizing user's name in the path:
+
+verb(    path = /home/%RSYNC_USER_NAME% )
+
 dit(bf(use chroot)) If "use chroot" is true, the rsync daemon will chroot
 to the "path" before starting the file transfer with the client.  This has
 the advantage of extra protection against possible implementation security
@@ -195,8 +217,9 @@ to translate names, and that it is not possible for a user to change those
 resources.
 
 dit(bf(munge symlinks)) This parameter tells rsync to modify
-all incoming symlinks in a way that makes them unusable but recoverable
-(see below).  This should help protect your files from user trickery when
+all symlinks in the same way as the (non-daemon-affecting)
+bf(--munge-links) command-line option (using a method described below).
+This should help protect your files from user trickery when
 your daemon module is writable.  The default is disabled when "use chroot"
 is on and the inside-chroot path is "/", otherwise it is enabled.
 
@@ -216,7 +239,8 @@ to the exclude setting for the module so that
 a user can't try to create it.
 
 Note:  rsync makes no attempt to verify that any pre-existing symlinks in
-the hierarchy are as safe as you want them to be.  If you setup an rsync
+the module's hierarchy are as safe as you want them to be (unless, of
+course, it just copied in the whole hierarchy).  If you setup an rsync
 daemon on a new area or locally add symlinks, you can manually protect your
 symlinks from being abused by prefixing "/rsyncd-munged/" to the start of
 every symlink's value.  There is a perl script in the support directory
@@ -302,24 +326,41 @@ attempted downloads will fail. If "write only" is false then downloads
 will be possible if file permissions on the daemon side allow them.  The
 default is for this parameter to be disabled.
 
-dit(bf(list)) This parameter determines if this module should be
-listed when the client asks for a listing of available modules. By
-setting this to false you can create hidden modules. The default is
-for modules to be listable.
+dit(bf(list)) This parameter determines whether this module is
+listed when the client asks for a listing of available modules.  In addition,
+if this is false, the daemon will pretend the module does not exist
+when a client denied by "hosts allow" or "hosts deny" attempts to access it.
+Realize that if "reverse lookup" is disabled globally but enabled for the
+module, the resulting reverse lookup to a potentially client-controlled DNS
+server may still reveal to the client that it hit an existing module.
+The default is for modules to be listable.
 
 dit(bf(uid)) This parameter specifies the user name or user ID that
 file transfers to and from that module should take place as when the daemon
 was run as root. In combination with the "gid" parameter this determines what
-file permissions are available. The default is uid -2, which is normally
-the user "nobody".
-
-dit(bf(gid)) This parameter specifies the group name or group ID that
-file transfers to and from that module should take place as when the daemon
-was run as root. This complements the "uid" parameter. The default is gid -2,
-which is normally the group "nobody".
+file permissions are available. The default when run by a super-user is to
+switch to the system's "nobody" user.  The default for a non-super-user is to
+not try to change the user.  See also the "gid" parameter.
+
+The RSYNC_USER_NAME environment variable may be used to request that rsync run
+as the authorizing user.  For example, if you want a rsync to run as the same
+user that was received for the rsync authentication, this setup is useful:
+
+verb(    uid = %RSYNC_USER_NAME%
+    gid = * )
+
+dit(bf(gid)) This parameter specifies one or more group names/IDs that will be
+used when accessing the module.  The first one will be the default group, and
+any extra ones be set as supplemental groups.  You may also specify a "*" as
+the first gid in the list, which will be replaced by all the normal groups for
+the transfer's user (see "uid").  The default when run by a super-user is to
+switch to your OS's "nobody" (or perhaps "nogroup") group with no other
+supplementary groups.  The default for a non-super-user is to not change any
+group attributes (and indeed, your OS may not allow a non-super-user to try to
+change their group settings).
 
 dit(bf(fake super)) Setting "fake super = yes" for a module causes the
-daemon side to behave as if the bf(--fake-user) command-line option had
+daemon side to behave as if the bf(--fake-super) command-line option had
 been specified.  This allows the full attributes of a file to be stored
 without having to have the daemon actually running as root.
 
@@ -402,8 +443,8 @@ usernames and passwords are stored in the file specified by the
 "secrets file" parameter. The default is for all users to be able to
 connect without a password (this is called "anonymous rsync").
 
-See also the "CONNECTING TO AN RSYNC DAEMON OVER A REMOTE SHELL
-PROGRAM" section in bf(rsync)(1) for information on how handle an
+See also the section entitled "USING RSYNC-DAEMON FEATURES VIA A REMOTE
+SHELL CONNECTION" in bf(rsync)(1) for information on how handle an
 rsyncd.conf-level username that differs from the remote-shell-level
 username when using a remote shell to connect to an rsync daemon.
 
@@ -448,7 +489,8 @@ quote(itemization(
   addresses which match the masked IP address will be allowed in.
   it() a hostname. The hostname as determined by a reverse lookup will
   be matched (case insensitive) against the pattern. Only an exact
-  match is allowed in.
+  match is allowed in.  This only works if "reverse lookup" is enabled
+  (the default).
   it() a hostname pattern using wildcards. These are matched using the
   same rules as normal unix filename matching. If the pattern matches
   then the client is allowed in.
@@ -479,6 +521,18 @@ rejected. See the "hosts allow" parameter for more information.
 
 The default is no "hosts deny" parameter, which means all hosts can connect.
 
+dit(bf(reverse lookup)) Controls whether the daemon performs a reverse lookup
+on the client's IP address to determine its hostname, which is used for
+"hosts allow"/"hosts deny" checks and the "%h" log escape.  This is enabled by
+default, but you may wish to disable it to save time if you know the lookup will
+not return a useful result, in which case the daemon will use the name
+"UNDETERMINED" instead.
+
+If this parameter is enabled globally (even by default), rsync performs the
+lookup as soon as a client connects, so disabling it for a module will not
+avoid the lookup.  Thus, you probably want to disable it globally and then
+enable it for modules that need the information.
+
 dit(bf(ignore errors)) This parameter tells rsyncd to
 ignore I/O errors on the daemon when deciding whether to run the delete
 phase of the transfer. Normally rsync skips the bf(--delete) step if any
@@ -505,6 +559,11 @@ The format is a text string containing embedded single-character escape
 sequences prefixed with a percent (%) character.  An optional numeric
 field width may also be specified between the percent and the escape
 letter (e.g. "bf(%-50n %8l %07p)").
+In addition, one or more apostrophes may be specified prior to a numerical
+escape to indicate that the numerical value should be made more human-readable.
+The 3 supported levels are the same as for the bf(--human-readable)
+command-line option, though the default is for human-readability to be off.
+Each added apostrophe increases the level (e.g. "bf(%''l %'b %f)").
 
 The default log format is "%o %h [%a] %m (%u) %f %l", and a "%t [%p] "
 is always prefixed when using the "log file" parameter.
@@ -630,13 +689,17 @@ manpagesection(CONFIG DIRECTIVES)
 There are currently two config directives available that allow a config file to
 incorporate the contents of other files:  bf(&include) and bf(&merge).  Both
 allow a reference to either a file or a directory.  They differ in how
-segregated the file's contents are considered to be.  The bf(&include)
-directive treats each file as more distinct, with each one inheriting the
-defaults of the parent file, and starting the parameter parsing as
-globals/defaults.  The bf(&merge) directive, on the other hand, treats the
-file's contents as if it were simply inserted in place of the directive, and
-thus it can contain parameters that can be set inside a parent file's module
-settings, or whatever you like.
+segregated the file's contents are considered to be.
+
+The bf(&include) directive treats each file as more distinct, with each one
+inheriting the defaults of the parent file, starting the parameter parsing
+as globals/defaults, and leaving the defaults unchanged for the parsing of
+the rest of the parent file.
+
+The bf(&merge) directive, on the other hand, treats the file's contents as
+if it were simply inserted in place of the directive, and thus it can set
+parameters in a module started in another file, can affect the defaults for
+other files, etc.
 
 When an bf(&include) or bf(&merge) directive refers to a directory, it will read
 in all the bf(*.conf) files contained inside that directory (without any
@@ -644,23 +707,23 @@ recursive scanning), with the files sorted into alpha order.  So, if you have a
 directory named "rsyncd.d" with the files "foo.conf", "bar.conf", and
 "baz.conf" inside it, this directive:
 
-verb(    &include /path/rsyncd.d )
+verb(    &include /path/rsyncd.d )
 
 would be the same as this set of directives:
 
-verb(    &include /path/rsyncd.d/bar.conf
-    &include /path/rsyncd.d/baz.conf
-    &include /path/rsyncd.d/foo.conf )
+verb(    &include /path/rsyncd.d/bar.conf
+    &include /path/rsyncd.d/baz.conf
+    &include /path/rsyncd.d/foo.conf )
 
 except that it adjusts as files are added and removed from the directory.
 
 The advantage of the bf(&include) directive is that you can define one or more
-modules in a separate file with only the defaults you set in the parent file
-affecting it, so you don't need to worry about the settings of a prior include
-file changing a default.  For instance, this is a useful /etc/rsyncd.conf file:
+modules in a separate file without worrying about unintended side-effects
+between the self-contained module files.  For instance, this is a useful
+/etc/rsyncd.conf file:
 
 verb(    port = 873
-    log file = /path/rsync.log
+    log file = /var/log/rsync.log
     pid file = /var/lock/rsync.lock
 
     &include /etc/rsyncd.d )