| 1 | ## NAME |
| 2 | |
| 3 | rsync-ssl - a helper script for connecting to an ssl rsync daemon |
| 4 | |
| 5 | ## SYNOPSIS |
| 6 | |
| 7 | ``` |
| 8 | rsync-ssl [--type=SSL_TYPE] RSYNC_ARGS |
| 9 | ``` |
| 10 | |
| 11 | The online version of this manpage (that includes cross-linking of topics) |
| 12 | is available at <https://download.samba.org/pub/rsync/rsync-ssl.1>. |
| 13 | |
| 14 | ## DESCRIPTION |
| 15 | |
| 16 | The rsync-ssl script helps you to run an rsync copy to/from an rsync daemon |
| 17 | that requires ssl connections. |
| 18 | |
| 19 | The script requires that you specify an rsync-daemon arg in the style of either |
| 20 | `hostname::` (with 2 colons) or `rsync://hostname/`. The default port used for |
| 21 | connecting is 874 (one higher than the normal 873) unless overridden in the |
| 22 | environment. You can specify an overriding port via `--port` or by including |
| 23 | it in the normal spot in the URL format, though both of those require your |
| 24 | rsync version to be at least 3.2.0. |
| 25 | |
| 26 | ## OPTIONS |
| 27 | |
| 28 | If the **first** arg is a `--type=SSL_TYPE` option, the script will only use |
| 29 | that particular program to open an ssl connection instead of trying to find an |
| 30 | openssl or stunnel executable via a simple heuristic (assuming that the |
| 31 | `RSYNC_SSL_TYPE` environment variable is not set as well -- see below). This |
| 32 | option must specify one of `openssl` or `stunnel`. The equal sign is |
| 33 | required for this particular option. |
| 34 | |
| 35 | All the other options are passed through to the rsync command, so consult the |
| 36 | **rsync**(1) manpage for more information on how it works. |
| 37 | |
| 38 | ## ENVIRONMENT VARIABLES |
| 39 | |
| 40 | The ssl helper scripts are affected by the following environment variables: |
| 41 | |
| 42 | 0. `RSYNC_SSL_TYPE` |
| 43 | |
| 44 | Specifies the program type that should be used to open the ssl connection. |
| 45 | It must be one of `openssl` or `stunnel`. The `--type=SSL_TYPE` option |
| 46 | overrides this, when specified. |
| 47 | |
| 48 | 0. `RSYNC_SSL_PORT` |
| 49 | |
| 50 | If specified, the value is the port number that is used as the default when |
| 51 | the user does not specify a port in their rsync command. When not |
| 52 | specified, the default port number is 874. (Note that older rsync versions |
| 53 | (prior to 3.2.0) did not communicate an overriding port number value to the |
| 54 | helper script.) |
| 55 | |
| 56 | 0. `RSYNC_SSL_CERT` |
| 57 | |
| 58 | If specified, the value is a filename that contains a certificate to use |
| 59 | for the connection. |
| 60 | |
| 61 | 0. `RSYNC_SSL_KEY` |
| 62 | |
| 63 | If specified, the value is a filename that contains a key for the provided |
| 64 | certificate to use for the connection. |
| 65 | |
| 66 | 0. `RSYNC_SSL_CA_CERT` |
| 67 | |
| 68 | If specified, the value is a filename that contains a certificate authority |
| 69 | certificate that is used to validate the connection. When set, the server |
| 70 | certificate is verified against this CA **and** its name is checked against |
| 71 | the host you are connecting to (the chain and the identity), for all of the |
| 72 | openssl, gnutls, and stunnel backends. Set it to an empty string to disable |
| 73 | certificate validation entirely (an encrypt-only connection). |
| 74 | |
| 75 | 0. `RSYNC_SSL_ALLOW_INSECURE_STUNNEL` |
| 76 | |
| 77 | Set to `1` to allow the stunnel backend to run without a CA certificate (and |
| 78 | thus with no server-certificate validation at all). Without this, stunnel |
| 79 | mode refuses to start unless `RSYNC_SSL_CA_CERT` is set, since an unvalidated |
| 80 | TLS connection can be silently man-in-the-middled. |
| 81 | |
| 82 | 0. `RSYNC_SSL_SKIP_HOSTNAME_CHECK` |
| 83 | |
| 84 | Set to `1` to verify the certificate **chain** but skip the **hostname** |
| 85 | (identity) check, for the openssl and stunnel backends. Use this only when |
| 86 | the server certificate legitimately cannot match the host you connect to -- |
| 87 | for example connecting by bare IP address, or to a server whose internal-CA |
| 88 | certificate carries a different name. The CA chain is still validated, so |
| 89 | this is much narrower than disabling validation with an empty |
| 90 | `RSYNC_SSL_CA_CERT`. |
| 91 | |
| 92 | 0. `RSYNC_SSL_OPENSSL` |
| 93 | |
| 94 | Specifies the openssl executable to run when the connection type is set to |
| 95 | openssl. If unspecified, the $PATH is searched for "openssl". |
| 96 | |
| 97 | 0. `RSYNC_SSL_GNUTLS` |
| 98 | |
| 99 | Specifies the gnutls-cli executable to run when the connection type is set |
| 100 | to gnutls. If unspecified, the $PATH is searched for "gnutls-cli". |
| 101 | |
| 102 | 0. `RSYNC_SSL_STUNNEL` |
| 103 | |
| 104 | Specifies the stunnel executable to run when the connection type is set to |
| 105 | stunnel. If unspecified, the $PATH is searched first for "stunnel4" and |
| 106 | then for "stunnel". |
| 107 | |
| 108 | ## EXAMPLES |
| 109 | |
| 110 | > rsync-ssl -aiv example.com::mod/ dest |
| 111 | |
| 112 | > rsync-ssl --type=openssl -aiv example.com::mod/ dest |
| 113 | |
| 114 | > rsync-ssl -aiv --port 9874 example.com::mod/ dest |
| 115 | |
| 116 | > rsync-ssl -aiv rsync://example.com:9874/mod/ dest |
| 117 | |
| 118 | ## THE SERVER SIDE |
| 119 | |
| 120 | For help setting up an SSL/TLS supporting rsync, see the [instructions in |
| 121 | rsyncd.conf](rsyncd.conf.5#SSL_TLS_Daemon_Setup). |
| 122 | |
| 123 | ## SEE ALSO |
| 124 | |
| 125 | [**rsync**(1)](rsync.1), [**rsyncd.conf**(5)](rsyncd.conf.5) |
| 126 | |
| 127 | ## CAVEATS |
| 128 | |
| 129 | Note that using an stunnel connection requires at least version 4 of stunnel, |
| 130 | which should be the case on modern systems. Also, it does not verify a |
| 131 | connection against the CA certificate collection, so it only encrypts the |
| 132 | connection without any cert validation unless you have specified the |
| 133 | certificate environment options. |
| 134 | |
| 135 | This script also supports a `--type=gnutls` option, but at the time of this |
| 136 | release the gnutls-cli command was dropping output, making it unusable. If |
| 137 | that bug has been fixed in your version, feel free to put gnutls into an |
| 138 | exported RSYNC_SSL_TYPE environment variable to make its use the default. |
| 139 | |
| 140 | ## BUGS |
| 141 | |
| 142 | Please report bugs! See the web site at <https://rsync.samba.org/>. |
| 143 | |
| 144 | ## VERSION |
| 145 | |
| 146 | This manpage is current for version @VERSION@ of rsync. |
| 147 | |
| 148 | ## CREDITS |
| 149 | |
| 150 | Rsync is distributed under the GNU General Public License. See the file |
| 151 | [COPYING](COPYING) for details. |
| 152 | |
| 153 | A web site is available at <https://rsync.samba.org/>. The site includes an |
| 154 | FAQ-O-Matic which may cover questions unanswered by this manual page. |
| 155 | |
| 156 | ## AUTHOR |
| 157 | |
| 158 | This manpage was written by Wayne Davison. |
| 159 | |
| 160 | Mailing lists for support and development are available at |
| 161 | <https://lists.samba.org/>. |