| 1 | <!DOCTYPE html> |
| 2 | <html> |
| 3 | <head> |
| 4 | <title>ProFTPD module mod_sftp</title> |
| 5 | </head> |
| 6 | |
| 7 | <body bgcolor=white> |
| 8 | |
| 9 | <hr> |
| 10 | <center> |
| 11 | <h2><b>ProFTPD module <code>mod_sftp</code></b></h2> |
| 12 | </center> |
| 13 | <hr><br> |
| 14 | |
| 15 | <p> |
| 16 | <b>SFTP versus FTPS</b><br> |
| 17 | There is a great deal of confusion and misunderstanding surrounding two very |
| 18 | different protocols: SFTP and FTPS. |
| 19 | |
| 20 | <p> |
| 21 | FTPS stands for "FTP over SSL/TLS". It is the existing FTP protocol, |
| 22 | made to run over an SSL/TLS connection; in this manner, it is very similar to |
| 23 | HTTPS (HTTP over SSL/TLS). In fact, that is where the name "FTPS" comes from. |
| 24 | The <a href="http://www.proftpd.org/docs/contrib/mod_tls.html"><code>mod_tls</code></a> module for ProFTPD implements FTPS. Since FTPS is still FTP, any |
| 25 | FTPS sessions require multiple TCP connections: one TCP connection for the |
| 26 | FTP control channel, and separate TCP connections for each FTP data channel. |
| 27 | The need for these multiple connections is undesirable for many network |
| 28 | administrators, especially those that wish to restrict all protocols to a |
| 29 | single TCP connection which can be passed through firewalls/NAT/router |
| 30 | equipment. The network equipment, now, often inspects the application-level |
| 31 | data in FTP packets in order to dynamically open the necessary firewall rules |
| 32 | for the FTP data channels. However, FTPS encrypts those packets, and thus |
| 33 | the network firewall must resort to using a statically configured range of |
| 34 | ports, or not allow FTPS. There is a third solution: the <code>CCC</code> FTP |
| 35 | command, which clears the FTP control channel of encryption, once the user has |
| 36 | authenticated. Unfortunately, support for the <code>CCC</code> command is not |
| 37 | widespread among FTPS clients and servers; the <code>mod_tls</code> module does |
| 38 | support the <code>CCC</code> command. |
| 39 | |
| 40 | <p> |
| 41 | By contrast, SFTP refers to "Secure File Transfer Protocol", and is <b>not</b> |
| 42 | related to FTP in any way. SFTP is based on the SSH2 protocol, which uses |
| 43 | binary encoding of messages over a secure channel. Unlike FTP, SSH2 only |
| 44 | uses a single TCP connection, and multiplexes multiple transfers or "channels" |
| 45 | over that single connection. For this reason, many sites prefer SFTP |
| 46 | to FTPS for secure transfer of data. |
| 47 | |
| 48 | <p> |
| 49 | <b>SSH2 RFCs and SFTP Drafts</b><br> |
| 50 | For those wishing to learn more about the SSH2 and SFTP protocols, see: |
| 51 | <ul> |
| 52 | <li><a href="http://www.faqs.org/rfcs/rfc4250.html">SSH Assigned Numbers (RFC 4250)</a> |
| 53 | <li><a href="http://www.faqs.org/rfcs/rfc4251.html">SSH Architecture (RFC 4251)</a> |
| 54 | <li><a href="http://www.faqs.org/rfcs/rfc4252.html">SSH Authentication (RFC 4252)</a> |
| 55 | <li><a href="http://www.faqs.org/rfcs/rfc4253.html">SSH Transport Layer (RFC 4253)</a> |
| 56 | <li><a href="http://www.faqs.org/rfcs/rfc4254.html">SSH Connection (RFC 4254)</a> |
| 57 | <li><a href="http://www.faqs.org/rfcs/rfc4256.html">SSH Keyboard-Interactive Authentication (RFC 4256)</a> |
| 58 | <li><a href="http://www.faqs.org/rfcs/rfc4335.html">SSH Channel "Break" Extension (RFC 4335)</a> |
| 59 | <li><a href="http://www.faqs.org/rfcs/rfc4344.html">SSH Transport Encryption Modes (RFC 4344)</a> |
| 60 | <li><a href="http://www.faqs.org/rfcs/rfc4345.html">SSH Improved Arcfour Modes (RFC 4345)</a> |
| 61 | <li><a href="http://www.faqs.org/rfcs/rfc4419.html">SSH Diffie-Hellman Group Exchange Protocol (RFC 4419)</a> |
| 62 | <li><a href="http://www.faqs.org/rfcs/rfc4432.html">SSH RSA Key Exchange Protocol (RFC 4432)</a> |
| 63 | <li><a href="http://www.faqs.org/rfcs/rfc4716.html">SSH Public Key File Format (RFC 4716)</a> |
| 64 | <li><a href="http://www.vandyke.com/technology/draft-ietf-secsh-filexfer.txt">SFTP Draft</a> |
| 65 | <li><a href="http://tools.ietf.org/html/draft-ietf-secsh-filexfer-extensions-00">SFTP Extensions Draft</a> |
| 66 | <li><a href="http://www.faqs.org/rfcs/rfc5656.html">SSH Elliptic Curve Algorithms (RFC 5656)</a> |
| 67 | <li><a href="http://www.faqs.org/rfcs/rfc6668.html">SSH SHA-2 HMACs (RFC 6668)</a> |
| 68 | <li><a href="http://www.faqs.org/rfcs/rfc8270.html">SSH Increased Minimum DH Group Size (RFC 8270)</a> |
| 69 | <li><a href="http://www.faqs.org/rfcs/rfc8308.html">SSH Extension Negotiation (RFC 8308)</a> |
| 70 | <li><a href="http://www.faqs.org/rfcs/rfc8332.html">Use of RSA Keys with SHA-256 and SHA-512 in the SSH Protocol (RFC 8332)</a> |
| 71 | <li><a href="http://www.faqs.org/rfcs/rfc8731.html">SSH Key Exchange Method Using Curve25519 and Curve448 (RFC 8731)</a> |
| 72 | </ul> |
| 73 | |
| 74 | <p> |
| 75 | <b>The <code>mod_sftp</code> module for ProFTPD</b><br> |
| 76 | The <code>mod_sftp</code> module implements the SSH2 protocol and its SFTP |
| 77 | subsystem, for secure file transfer over an SSH2 connection. The |
| 78 | <code>mod_sftp</code> module supports: |
| 79 | <ul> |
| 80 | <li>Public key authentication |
| 81 | <li>Password authentication (<i>e.g.</i> user authentication via |
| 82 | <code>mod_sql</code>, <code>mod_ldap</code>, <code>mod_auth_file</code>, |
| 83 | <code>mod_auth_unix</code>, <code>mod_auth_pam</code>) |
| 84 | <li>SCP support |
| 85 | <li>Quotas (via the <code>mod_quotatab</code> module) |
| 86 | <li>FIPS support (see <a href="#Usage">Usage</a> section) |
| 87 | <li>Throttled transfers (via <code>TransferRate</code>, and/or the |
| 88 | <code>mod_shaper</code> module) |
| 89 | <li>Blacklisted public keys |
| 90 | <li>Configurable traffic analysis protection |
| 91 | <li>Passphrase-protected host keys |
| 92 | <li>SFTP extensions: check-file, copy-file, vendor-id, version-select, [email protected], [email protected], [email protected], [email protected] |
| 93 | </ul> |
| 94 | This module supports the SFTP and SCP file transfer protocols; it does |
| 95 | <b>not</b> support shell access. |
| 96 | |
| 97 | <p> |
| 98 | The <code>mod_sftp</code> module does <b>not</b> currently support: |
| 99 | <ul> |
| 100 | <li><code><Anonymous></code> |
| 101 | <li><code>ListOptions</code> |
| 102 | <li><code>MaxRetrieveFileSize</code> |
| 103 | </ul> |
| 104 | |
| 105 | <p> |
| 106 | The <code>mod_sftp</code> module is contained in the <code>mod_sftp/</code> |
| 107 | directory, is intended for ProFTPD 1.3.3rc1 and later, and is not compiled by |
| 108 | default. Installation instructions are discussed |
| 109 | <a href="#Installation">here</a>. |
| 110 | |
| 111 | <p> |
| 112 | The most current version of <code>mod_sftp</code> is distributed with the |
| 113 | ProFTPD source code. |
| 114 | |
| 115 | <p> |
| 116 | This product includes software developed by the OpenSSL Project for use in the |
| 117 | OpenSSL Toolkit (<a href="http://www.openssl.org/">http://www.openssl.org/</a>). |
| 118 | This product includes cryptographic software written by Eric Young ([email protected]). |
| 119 | |
| 120 | <h2>Author</h2> |
| 121 | <p> |
| 122 | Please contact TJ Saunders <tj <i>at</i> castaglia.org> with any |
| 123 | questions, concerns, or suggestions regarding this module. |
| 124 | |
| 125 | <h2>Directives</h2> |
| 126 | <ul> |
| 127 | <li><a href="#SFTPAcceptEnv">SFTPAcceptEnv</a> |
| 128 | <li><a href="#SFTPAuthMethods">SFTPAuthMethods</a> |
| 129 | <li><a href="#SFTPAuthPublicKeys">SFTPAuthPublicKeys</a> |
| 130 | <li><a href="#SFTPAuthorizedHostKeys">SFTPAuthorizedHostKeys</a> |
| 131 | <li><a href="#SFTPAuthorizedUserKeys">SFTPAuthorizedUserKeys</a> |
| 132 | <li><a href="#SFTPCiphers">SFTPCiphers</a> |
| 133 | <li><a href="#SFTPClientAlive">SFTPClientAlive</a> |
| 134 | <li><a href="#SFTPClientMatch">SFTPClientMatch</a> |
| 135 | <li><a href="#SFTPCompression">SFTPCompression</a> |
| 136 | <li><a href="#SFTPCryptoDevice">SFTPCryptoDevice</a> |
| 137 | <li><a href="#SFTPDHParamFile">SFTPDHParamFile</a> |
| 138 | <li><a href="#SFTPDigests">SFTPDigests</a> |
| 139 | <li><a href="#SFTPDisplayBanner">SFTPDisplayBanner</a> |
| 140 | <li><a href="#SFTPEngine">SFTPEngine</a> |
| 141 | <li><a href="#SFTPExtensions">SFTPExtensions</a> |
| 142 | <li><a href="#SFTPHostKey">SFTPHostKey</a> |
| 143 | <li><a href="#SFTPHostKeys">SFTPHostKeys</a> |
| 144 | <li><a href="#SFTPKeyBlacklist">SFTPKeyBlacklist</a> |
| 145 | <li><a href="#SFTPKeyExchanges">SFTPKeyExchanges</a> |
| 146 | <li><a href="#SFTPKeyLimits">SFTPKeyLimits</a> |
| 147 | <li><a href="#SFTPLog">SFTPLog</a> |
| 148 | <li><a href="#SFTPMaxChannels">SFTPMaxChannels</a> |
| 149 | <li><a href="#SFTPOptions">SFTPOptions</a> |
| 150 | <li><a href="#SFTPPassPhraseProvider">SFTPPassPhraseProvider</a> |
| 151 | <li><a href="#SFTPRekey">SFTPRekey</a> |
| 152 | <li><a href="#SFTPTrafficPolicy">SFTPTrafficPolicy</a> |
| 153 | </ul> |
| 154 | |
| 155 | <p> |
| 156 | <hr> |
| 157 | <h3><a name="SFTPAcceptEnv">SFTPAcceptEnv</a></h3> |
| 158 | <strong>Syntax:</strong> SFTPAcceptEnv <em>env1 ...</em><br> |
| 159 | <strong>Default:</strong> <em>LANG</em><br> |
| 160 | <strong>Context:</strong> server config, <code><VirtualHost></code>, <code><Global></code><br> |
| 161 | <strong>Module:</strong> mod_sftp<br> |
| 162 | <strong>Compatibility:</strong> 1.3.3rc3 and later |
| 163 | |
| 164 | <p> |
| 165 | The <code>SFTPAcceptEnv</code> directive specifies which environment variables |
| 166 | sent by the client, if any, will be used in the session environment. |
| 167 | Environment variables are specified by name, and may contain the '*' and '?' |
| 168 | wildcard characters. Multiple environment variables may be configured, either |
| 169 | separated by whitespace or spread across multiple <code>SFTPAcceptEnv</code> |
| 170 | directives. |
| 171 | |
| 172 | <p> |
| 173 | Be warned that some environment variables may have special meaning to |
| 174 | underlying libraries; care should be taken in the use of this directive. |
| 175 | |
| 176 | <p> |
| 177 | <hr> |
| 178 | <h3><a name="SFTPAuthMethods">SFTPAuthMethods</a></h3> |
| 179 | <strong>Syntax:</strong> SFTPAuthMethods <em>meth1 ...</em><br> |
| 180 | <strong>Default:</strong> <em>publickey password</em><br> |
| 181 | <strong>Context:</strong> server config, <code><VirtualHost></code>, <code><Global></code><br> |
| 182 | <strong>Module:</strong> mod_sftp<br> |
| 183 | <strong>Compatibility:</strong> 1.3.2rc2 and later |
| 184 | |
| 185 | <p> |
| 186 | The <code>SFTPAuthMethods</code> directive configures the list of available |
| 187 | authentication methods presented to connecting clients. The list of |
| 188 | currently supported methods is: |
| 189 | <ul> |
| 190 | <li>hostbased |
| 191 | <li>keyboard-interactive |
| 192 | <li>password |
| 193 | <li>publickey |
| 194 | </ul> |
| 195 | In general, there is no need to use this directive unless only one specific |
| 196 | authentication method must be used. Should it be needed, the list of |
| 197 | authentication methods to use is provided as a space-delimited list, |
| 198 | <i>e.g.</i>: |
| 199 | <pre> |
| 200 | # Offer publickey and keyboard-interactive authentication only |
| 201 | SFTPAuthMethods publickey keyboard-interactive |
| 202 | </pre> |
| 203 | |
| 204 | <p> |
| 205 | The <em>hostbased</em> authentication method is only offered to clients if |
| 206 | the <a href="#SFTPAuthorizedHostKeys"><code>SFTPAuthorizedHostKeys</code></a> |
| 207 | directive is configured. |
| 208 | |
| 209 | <p> |
| 210 | The <em>publickey</em> authentication method is only offered to clients if |
| 211 | the <a href="#SFTPAuthorizedUserKeys"><code>SFTPAuthorizedUserKeys</code></a> |
| 212 | directive is configured. |
| 213 | |
| 214 | <p> |
| 215 | The <em>keyboard-interactive</em> authentication method is only offered to |
| 216 | clients if the <a href="mod_sftp_pam.html"><code>mod_sftp_pam</code></a> |
| 217 | or <a href="mod_auth_otp.html"><code>mod_auth_otp</code></a> module is present. |
| 218 | |
| 219 | <p> |
| 220 | As of <code>proftpd-1.3.6rc2</code> and later, you can use the |
| 221 | <code>SFTPAuthMethods</code> directive to configure <em>chains</em> of |
| 222 | methods. An authentication <em>chain</em> is a list of authentication |
| 223 | methods, <b>all</b> of which must succeed in order for login to succeed. |
| 224 | For example, using: |
| 225 | <pre> |
| 226 | # Require both publickey and password authentication |
| 227 | SFTPAuthMethods publickey+password |
| 228 | </pre> |
| 229 | Note that <i>order of the methods in a chain is important</i>. In the above |
| 230 | example, the publickey authentication <b>must</b> succeed first, before |
| 231 | password authentication will be offered. If you want require both |
| 232 | publickey and password authentication, but that they can be used in any |
| 233 | order, you can configure multiple chains: |
| 234 | <pre> |
| 235 | # Require both publickey and password authentication, in any order |
| 236 | SFTPAuthMethods publickey+password password+publickey |
| 237 | </pre> |
| 238 | As long as any <i>one</i> chain is completed, login will succeed. |
| 239 | |
| 240 | <p> |
| 241 | You can even require that multiple different keys be used (<i>e.g.</i> a |
| 242 | RSA and a DSA public key, or multiple different RSA/DSA keys) using: |
| 243 | <pre> |
| 244 | # Require different keys for publickey authentication |
| 245 | SFTPAuthMethods publickey+publickey |
| 246 | </pre> |
| 247 | |
| 248 | <p> |
| 249 | <hr> |
| 250 | <h3><a name="SFTPAuthPublicKeys">SFTPAuthPublicKeys</a></h3> |
| 251 | <strong>Syntax:</strong> SFTPAuthPublicKeys <em>algo1 ...</em><br> |
| 252 | <strong>Default:</strong> <em>None</em><br> |
| 253 | <strong>Context:</strong> server config, <code><VirtualHost></code>, <code><Global></code><br> |
| 254 | <strong>Module:</strong> mod_sftp<br> |
| 255 | <strong>Compatibility:</strong> 1.3.9rc3 and later |
| 256 | |
| 257 | <p> |
| 258 | The <code>SFTPAuthPublicKeys</code> directive is used to specify the list of |
| 259 | public key algorithms that <code>mod_sftp</code> allows during authentication. |
| 260 | The current list of supported public key algorithms is: |
| 261 | <ul> |
| 262 | <li>ssh-dss |
| 263 | <li>ssh-rsa |
| 264 | <li>rsa-sha2-256 |
| 265 | <li>rsa-sha2-512 |
| 266 | <li>ecdsa-sha2-nistp256 |
| 267 | <li>ecdsa-sha2-nistp384 |
| 268 | <li>ecdsa-sha2-nistp521 |
| 269 | <li>[email protected] |
| 270 | <li>ssh-ed25519 (<i>requires Sodium</i>) |
| 271 | <li>[email protected] (<i>requires Sodium</i>) |
| 272 | <li>ssh-ed448 (<i>requires OpenSSL 1.1.1 or later</i>) |
| 273 | </ul> |
| 274 | By default, all of the above public key algorithms are allowed. |
| 275 | |
| 276 | <p> |
| 277 | In general, there is no need to use this directive unless specific public key |
| 278 | algorithms must be used (or avoided). |
| 279 | |
| 280 | <p> |
| 281 | <hr> |
| 282 | <h3><a name="SFTPAuthorizedHostKeys">SFTPAuthorizedHostKeys</a></h3> |
| 283 | <strong>Syntax:</strong> SFTPAuthorizedHostKeys <em>store1 ...</em><br> |
| 284 | <strong>Default:</strong> <em>None</em><br> |
| 285 | <strong>Context:</strong> server config, <code><VirtualHost></code>, <code><Global></code><br> |
| 286 | <strong>Module:</strong> mod_sftp<br> |
| 287 | <strong>Compatibility:</strong> 1.3.2rc2 and later |
| 288 | |
| 289 | <p> |
| 290 | The <code>SFTPAuthorizedHostKeys</code> directive configures the file that |
| 291 | <code>mod_sftp</code> will use during the handling of hostbased authentication |
| 292 | of users. The configured file may contain several public keys in RFC4716 |
| 293 | format, in no particular order. |
| 294 | |
| 295 | <p> |
| 296 | <b>Note</b> that a <code>SFTPAuthorizedHostKeys</code> directive is |
| 297 | required for <code>mod_sftp</code> to handle sessions which want to use |
| 298 | hostbased authentication properly. |
| 299 | |
| 300 | <p> |
| 301 | <b>Note:</b> In order to use OpenSSH public keys in a |
| 302 | <code>SFTPAuthorizedHostKeys</code>, you <b>must</b> convert them to the |
| 303 | RFC4716 format (see the <a href="#UsageRFC4716Format">Usage</a> section). |
| 304 | This is done using OpenSSH's <code>ssh-keygen</code> tool: |
| 305 | <pre> |
| 306 | $ ssh-keygen -e -f /path/to/file |
| 307 | </pre> |
| 308 | The output from this command can then be added to the |
| 309 | <code>SFTPAuthorizedHostKeys</code> file. |
| 310 | |
| 311 | <p> |
| 312 | <hr> |
| 313 | <h3><a name="SFTPAuthorizedUserKeys">SFTPAuthorizedUserKeys</a></h3> |
| 314 | <strong>Syntax:</strong> SFTPAuthorizedUserKeys <em>store1 ...</em><br> |
| 315 | <strong>Default:</strong> <em>None</em><br> |
| 316 | <strong>Context:</strong> server config, <code><VirtualHost></code>, <code><Global></code><br> |
| 317 | <strong>Module:</strong> mod_sftp<br> |
| 318 | <strong>Compatibility:</strong> 1.3.2rc2 and later |
| 319 | |
| 320 | <p> |
| 321 | The <code>SFTPAuthorizedUserKeys</code> directive configures the file that |
| 322 | <code>mod_sftp</code> will use during the handling of publickey authentication |
| 323 | of users. The configured file may contain several public keys in RFC4716 |
| 324 | format, in no particular order. |
| 325 | |
| 326 | <p> |
| 327 | Example: |
| 328 | <pre> |
| 329 | SFTPAuthorizedUserKeys file:~/.sftp/authorized_keys |
| 330 | </pre> |
| 331 | |
| 332 | <p> |
| 333 | <b>Note:</b> In order to use OpenSSH public keys in a |
| 334 | <code>SFTPAuthorizedUserKeys</code>, you <b>must</b> convert them to the |
| 335 | RFC4716 format (see the <a href="#UsageRFC4716Format">Usage</a> section). |
| 336 | This is done using OpenSSH's <code>ssh-keygen</code> tool: |
| 337 | <pre> |
| 338 | $ ssh-keygen -e -f ~/.ssh/id_rsa.pub -m RFC4716 |
| 339 | </pre> |
| 340 | The output from this command can then be added to the |
| 341 | <code>SFTPAuthorizedUserKeys</code> file. |
| 342 | |
| 343 | <p> |
| 344 | The configured path for a file containing authorized keys can use the |
| 345 | <code>%u</code> variable, which will be interpolated with the name of the user |
| 346 | being authenticated. This feature supports having per-user files of authorized |
| 347 | keys that reside in a central location, rather than requiring (or allowing) |
| 348 | users to manage their own authorized keys. For example: |
| 349 | <pre> |
| 350 | SFTPAuthorizedUserKeys file:/etc/sftp/authorized_keys/%u |
| 351 | </pre> |
| 352 | |
| 353 | <p> |
| 354 | <hr> |
| 355 | <h3><a name="SFTPCiphers">SFTPCiphers</a></h3> |
| 356 | <strong>Syntax:</strong> SFTPCiphers <em>algo1 ...</em><br> |
| 357 | <strong>Default:</strong> <em>None</em><br> |
| 358 | <strong>Context:</strong> server config, <code><VirtualHost></code>, <code><Global></code><br> |
| 359 | <strong>Module:</strong> mod_sftp<br> |
| 360 | <strong>Compatibility:</strong> 1.3.2rc2 and later |
| 361 | |
| 362 | <p> |
| 363 | The <code>SFTPCiphers</code> directive is used to specify the list of |
| 364 | cipher algorithms that <code>mod_sftp</code> should use. The current list |
| 365 | of supported cipher algorithms is, in the default order of preference: |
| 366 | <ul> |
| 367 | <li>[email protected] |
| 368 | <li>aes256-ctr |
| 369 | <li>aes192-ctr |
| 370 | <li>aes128-ctr |
| 371 | <li>[email protected] |
| 372 | <li>[email protected] |
| 373 | <li>aes256-cbc |
| 374 | <li>aes192-cbc |
| 375 | <li>aes128-cbc |
| 376 | <li>cast128-cbc |
| 377 | <li>3des-ctr |
| 378 | <li>3des-cbc |
| 379 | </ul> |
| 380 | By default, all of the above cipher algorithms are presented to the client, |
| 381 | in the above order, during the key exchange. |
| 382 | |
| 383 | <p> |
| 384 | In ProFTPD 1.3.7rc1 and later, the following list of algorithms are |
| 385 | <em>supported</em>, but <b>not</b> presented to clients by default. These |
| 386 | algorithms must be <em>explicitly</em> configured via <code>SFTPCiphers</code> |
| 387 | to be available for use by clients: |
| 388 | <ul> |
| 389 | <li>blowfish-ctr |
| 390 | <li>blowfish-cbc |
| 391 | <li>arcfour256 |
| 392 | <li>arcfour128 |
| 393 | </ul> |
| 394 | |
| 395 | <p> |
| 396 | The "none" cipher (<i>i.e.</i> no encryption) will <b>not</b> be presented to |
| 397 | the client by default; any sites which wish to use "none" will have to |
| 398 | explicitly configure it via <code>SFTPCiphers</code>. |
| 399 | |
| 400 | <p> |
| 401 | Note that CTR mode ciphers (<i>e.g.</i> the <code>aes128-ctr</code>, |
| 402 | <code>aes192-ctr</code>, and <code>aes256-ctr</code> ciphers) are recommended. |
| 403 | Any CBC mode cipher allows for the possibility of an attack which causes |
| 404 | several bits of plaintext to be leaked; the attack is described |
| 405 | <a href="http://www.cpni.gov.uk/Docs/Vulnerability_Advisory_SSH.txt">here</a>. |
| 406 | This attack is on the SSH2 protocol design itself; any SSH2 implementation |
| 407 | which conforms to the RFCs will have this weakness. |
| 408 | |
| 409 | <p> |
| 410 | In general, there is no need to use this directive unless only one specific |
| 411 | cipher must be used. |
| 412 | |
| 413 | <p> |
| 414 | For comparison, the cipher algorithms used by OpenSSH by default are: |
| 415 | <ul> |
| 416 | <li>aes128-cbc |
| 417 | <li>3des-cbc |
| 418 | <li>blowfish-cbc |
| 419 | <li>cast128-cbc |
| 420 | <li>arcfour128 |
| 421 | <li>arcfour256 |
| 422 | <li>aes192-cbc |
| 423 | <li>aes256-cbc |
| 424 | <li>aes128-ctr |
| 425 | <li>aes192-ctr |
| 426 | <li>aes256-ctr |
| 427 | <li>[email protected] |
| 428 | <li>[email protected] |
| 429 | <li>[email protected] |
| 430 | </ul> |
| 431 | Thus if you wanted to configure <code>mod_sftp</code> to present the same |
| 432 | cipher algorithms as OpenSSH, you would use: |
| 433 | <pre> |
| 434 | # Make mod_sftp present the same ciphers as OpenSSH |
| 435 | SFTPCiphers aes128-cbc 3des-cbc blowfish-cbc cast128-cbc arcfour128 \ |
| 436 | arcfour256 aes192-cbc aes256-cbc aes128-ctr aes192-ctr aes256-ctr \ |
| 437 | [email protected] [email protected] \ |
| 438 | [email protected] |
| 439 | </pre> |
| 440 | |
| 441 | <p> |
| 442 | <hr> |
| 443 | <h3><a name="SFTPClientAlive">SFTPClientAlive</a></h3> |
| 444 | <strong>Syntax:</strong> SFTPClientAlive <em>count</em> <em>interval</em><br> |
| 445 | <strong>Default:</strong> None<br> |
| 446 | <strong>Context:</strong> server config, <code><VirtualHost></code>, <code><Global></code><br> |
| 447 | <strong>Module:</strong> mod_sftp<br> |
| 448 | <strong>Compatibility:</strong> 1.3.4rc1 and later |
| 449 | |
| 450 | <p> |
| 451 | The <code>SFTPClientAlive</code> directive configured <code>mod_sftp</code> |
| 452 | to send messages to a client, through the encrypted channel, to request a |
| 453 | response from the client. If <em>count</em> client alive messages are sent |
| 454 | without receiving any response messages from the client, the client will |
| 455 | be disconnected. The <em>interval</em> indicates how much time, in seconds, |
| 456 | that <code>mod_sftp</code> waits for data from the client before sending a |
| 457 | client alive message. |
| 458 | |
| 459 | <p> |
| 460 | For example, using: |
| 461 | <pre> |
| 462 | SFTPClientAlive 3 15 |
| 463 | </pre> |
| 464 | will cause an unresponsive client to be disconnected after approximately 45 |
| 465 | seconds. |
| 466 | |
| 467 | <p> |
| 468 | <hr> |
| 469 | <h3><a name="SFTPClientMatch">SFTPClientMatch</a></h3> |
| 470 | <strong>Syntax:</strong> SFTPClientMatch <em>pattern key1 val1 ...</em><br> |
| 471 | <strong>Default:</strong> None<br> |
| 472 | <strong>Context:</strong> server config, <code><VirtualHost></code>, <code><Global></code><br> |
| 473 | <strong>Module:</strong> mod_sftp<br> |
| 474 | <strong>Compatibility:</strong> 1.3.2rc2 and later |
| 475 | |
| 476 | <p> |
| 477 | The <code>SFTPClientMatch</code> directive is used to tune some of the |
| 478 | SSH2/SFTP values based on the connecting client, for better interoperability |
| 479 | with those clients. The <em>pattern</em> parameter specifies a POSIX regular |
| 480 | expression which will be matched against the connecting client's SSH version |
| 481 | banner. If the client's banner version matches <em>pattern</em>, then |
| 482 | the configured keys/values are used for that session. |
| 483 | |
| 484 | <p> |
| 485 | The currently supported SSH2/SFTP keys which can be tuned via |
| 486 | <code>SFTPClientMatch</code> are: |
| 487 | <ul> |
| 488 | <li>channelPacketSize<br> |
| 489 | The <em>value</em> for this key can be a number, with an optional "KB" |
| 490 | (kilobytes) suffix. |
| 491 | |
| 492 | <p> |
| 493 | The default <code>mod_sftp</code> channel packet size is 32KB. |
| 494 | </li> |
| 495 | |
| 496 | <p> |
| 497 | <li>channelWindowSize</br> |
| 498 | The <em>value</em> for this key can be a number, with an optional |
| 499 | "GB" (gigabytes), "MB" (megabytes), or "KB" (kilobytes) suffix. |
| 500 | |
| 501 | <p> |
| 502 | The default <code>mod_sftp</code> channel window size is 4GB. Using |
| 503 | smaller window sizes may be necessary for some clients; larger window |
| 504 | sizes can help reduce latency for bulk data transfers. |
| 505 | </li> |
| 506 | |
| 507 | <p> |
| 508 | <li>sftpCiphers</br> |
| 509 | The <em>value</em> for this key should be a comma-separated list |
| 510 | of cipher algorithms, as for the |
| 511 | <a href="#SFTPCiphers><code>SFTPCiphers</code></a> directive. Use of |
| 512 | this <em>key</em> automatically enables the <code>PessimisticKexinit</code> |
| 513 | SFTPOption as well. |
| 514 | |
| 515 | <p> |
| 516 | <b>Note</b> that this option first appeared in |
| 517 | <code>proftpd-1.3.8rc4</code>. |
| 518 | </li> |
| 519 | |
| 520 | <p> |
| 521 | <li>sftpDigests</br> |
| 522 | The <em>value</em> for this key should be a comma-separated list |
| 523 | of digest algorithms, as for the |
| 524 | <a href="#SFTPDigests><code>SFTPDigests</code></a> directive. Use of |
| 525 | this <em>key</em> automatically enables the <code>PessimisticKexinit</code> |
| 526 | SFTPOption as well. |
| 527 | |
| 528 | <p> |
| 529 | <b>Note</b> that this option first appeared in |
| 530 | <code>proftpd-1.3.8rc4</code>. |
| 531 | </li> |
| 532 | |
| 533 | <p> |
| 534 | <li>sftpHostKeys</br> |
| 535 | The <em>value</em> for this key should be a comma-separated list |
| 536 | of host key algorithms, as for the |
| 537 | <a href="#SFTPHostKeys><code>SFTPHostKeys</code></a> directive. Use of |
| 538 | this <em>key</em> automatically enables the <code>PessimisticKexinit</code> |
| 539 | SFTPOption as well. |
| 540 | |
| 541 | <p> |
| 542 | <b>Note</b> that this option first appeared in |
| 543 | <code>proftpd-1.3.8rc4</code>. |
| 544 | </li> |
| 545 | |
| 546 | <p> |
| 547 | <li>sftpKeyExchanges</br> |
| 548 | The <em>value</em> for this key should be a comma-separated list |
| 549 | of key exchange algorithms, as for the |
| 550 | <a href="#SFTPKeyExchanges"><code>SFTPKeyExchanges</code></a> directive. |
| 551 | Use of this <em>key</em> automatically enables the |
| 552 | <code>PessimisticKexinit</code> SFTPOption as well. |
| 553 | |
| 554 | <p> |
| 555 | <b>Note</b> that this option first appeared in |
| 556 | <code>proftpd-1.3.8rc4</code>. |
| 557 | </li> |
| 558 | |
| 559 | <p> |
| 560 | <li>sftpProtocolVersion</br> |
| 561 | The <em>value</em> for this key can be a specific version number, |
| 562 | <i>e.g.</i> "3", or it can be a range such as "1-3". The |
| 563 | <code>mod_sftp</code> module supports SFTP protocol versions 1-6; |
| 564 | using any other protocol versions will result in bad configuration. |
| 565 | </li> |
| 566 | |
| 567 | <p> |
| 568 | <li>sftpUTF8ProtocolVersion</br> |
| 569 | The <em>value</em> for this key is a specific version number, |
| 570 | <i>e.g.</i> "3". The <code>mod_sftp</code> module uses UTF8 encoding |
| 571 | for handling paths/strings in SFTP messages for protocol version 4 and |
| 572 | above by default; this key can be used to change the protocol versions for |
| 573 | which UTF8 encoding is used. |
| 574 | |
| 575 | <p> |
| 576 | For example, if you set: |
| 577 | <pre> |
| 578 | SFTPClientMatch .* sftpUTF8ProtocolVersion 1 |
| 579 | </pre> |
| 580 | then <code>mod_sftp</code> will try to use UTF8 for all SFTP protocol |
| 581 | versions, all clients. |
| 582 | |
| 583 | <p> |
| 584 | <b>Note</b>: the <code>sftpUTF8ProtocolVersion</code> key <b>requires</b> |
| 585 | NLS support (<i>i.e.</i> the <code>--enable-nls</code> configure option). |
| 586 | </li> |
| 587 | </ul> |
| 588 | |
| 589 | <p> |
| 590 | For example, to make <code>mod_sftp</code> only allow SFTP protocol version 3 |
| 591 | to WinSCP clients, you would use: |
| 592 | <pre> |
| 593 | SFTPClientMatch ".*WinSCP.*" sftpProtocolVersion 3 |
| 594 | </pre> |
| 595 | Or for older OpenSSH clients, you may need to use a smaller channel window |
| 596 | size, <i>e.g.</i>: |
| 597 | <pre> |
| 598 | SFTPClientMatch "^OpenSSH_3\\.*" channelWindowSize 8MB |
| 599 | </pre> |
| 600 | |
| 601 | <p> |
| 602 | <hr> |
| 603 | <h3><a name="SFTPCompression">SFTPCompression</a></h3> |
| 604 | <strong>Syntax:</strong> SFTPCompression <em>on|off|delayed</em><br> |
| 605 | <strong>Default:</strong> <em>off</em><br> |
| 606 | <strong>Context:</strong> server config, <code><VirtualHost></code>, <code><Global></code><br> |
| 607 | <strong>Module:</strong> mod_sftp<br> |
| 608 | <strong>Compatibility:</strong> 1.3.2rc2 and later |
| 609 | |
| 610 | <p> |
| 611 | The <code>SFTPCompression</code> directive enables the use of zlib compression |
| 612 | of the payload of SSH2 packets. This can make for smaller packets, but require |
| 613 | more CPU time to compress/uncompress the data. |
| 614 | |
| 615 | <p> |
| 616 | The <em>delayed</em> parameter tells <code>mod_sftp</code> to support a custom |
| 617 | extension used by OpenSSH, where compression is not actually enabled until |
| 618 | after the client has successfully authenticated. |
| 619 | |
| 620 | <p> |
| 621 | <hr> |
| 622 | <h3><a name="SFTPCryptoDevice">SFTPCryptoDevice</a></h3> |
| 623 | <strong>Syntax:</strong> SFTPCryptoDevice <em>driver|"all"|"none"</em><br> |
| 624 | <strong>Default:</strong> <em>None</em><br> |
| 625 | <strong>Context:</strong> server config, <code><VirtualHost></code>, <code><Global></code><br> |
| 626 | <strong>Module:</strong> mod_sftp<br> |
| 627 | <strong>Compatibility:</strong> 1.3.2rc2 and later |
| 628 | |
| 629 | <p> |
| 630 | The <code>SFTPCryptoDevice</code> directive is used to configure |
| 631 | <code>mod_sftp</code> to use an OpenSSL "engine", a cryptographic module |
| 632 | that OpenSSL library can use for accelerated cryptographic support, or |
| 633 | HSM keys, <i>etc</i>. |
| 634 | |
| 635 | <p> |
| 636 | To use all of the engines compiled into OpenSSL, use: |
| 637 | <pre> |
| 638 | SFTPCryptoDevice all |
| 639 | </pre> |
| 640 | OpenSSL will find, from the list of supported engines, the first one |
| 641 | usable, if any. If no usable engines are found, OpenSSL will default to |
| 642 | its normal software implementation. If a specific engine is desired as |
| 643 | the default engine to use, specify the engine name, <i>e.g.</i>: |
| 644 | <pre> |
| 645 | SFTPCryptoDevice chil |
| 646 | </pre> |
| 647 | |
| 648 | <p> |
| 649 | The OpenSSL command |
| 650 | <pre> |
| 651 | openssl engine |
| 652 | </pre> |
| 653 | may be used to list all of the engine drivers supported by OpenSSL. |
| 654 | |
| 655 | <p> |
| 656 | <hr> |
| 657 | <h3><a name="SFTPDHParamFile">SFTPDHParamFile</a></h3> |
| 658 | <strong>Syntax:</strong> SFTPDHParamFile <em>path</em><br> |
| 659 | <strong>Default:</strong> <em>dhparams.pem</em><br> |
| 660 | <strong>Context:</strong> server config, <code><VirtualHost></code>, <code><Global></code><br> |
| 661 | <strong>Module:</strong> mod_sftp<br> |
| 662 | <strong>Compatibility:</strong> 1.3.2rc2 and later |
| 663 | |
| 664 | <p> |
| 665 | The <code>SFTPDHParamFile</code> directive is used to configure the path |
| 666 | to a file containing pre-computed Diffie-Hellman (DH) group parameters. |
| 667 | These parameters will be used by <code>mod_sftp</code> when handling the |
| 668 | Diffie-Hellman group exchange (see RFC 4419) portion of the key exchange. |
| 669 | |
| 670 | <p> |
| 671 | The <code>SFTPDHParamFile</code> is produced using OpenSSL, which uses |
| 672 | PEM encodings of PKCS#3 <code>DHparam</code> structures. It is similar in |
| 673 | nature to OpenSSH's <code>moduli(5)</code> file. |
| 674 | |
| 675 | <p> |
| 676 | The <code>mod_sftp</code> source code comes with a <code>dhparams.pem</code> |
| 677 | file which should be sufficient. If for any reason you find that you |
| 678 | need to generate your own <code>SFTPDHParamFile</code>, use one of the |
| 679 | following OpenSSL commands to create this file: |
| 680 | <pre> |
| 681 | # openssl dhparam -outform PEM -2 <i>nbits</i> >> dhparams.pem |
| 682 | # openssl dhparam -outform PEM -5 <i>nbits</i> >> dhparams.pem |
| 683 | </pre> |
| 684 | Using either <code>-2</code> or <code>-5</code> as the generator is fine. |
| 685 | The <em>nbits</em> value used should vary between 1024 and 8192, inclusive. |
| 686 | <b>Beware</b>: this process is quite slow, and CPU/memory intensive! |
| 687 | |
| 688 | <p> |
| 689 | <hr> |
| 690 | <h3><a name="SFTPDigests">SFTPDigests</a></h3> |
| 691 | <strong>Syntax:</strong> SFTPDigests <em>algo1 ...</em><br> |
| 692 | <strong>Default:</strong> <em>None</em><br> |
| 693 | <strong>Context:</strong> server config, <code><VirtualHost></code>, <code><Global></code><br> |
| 694 | <strong>Module:</strong> mod_sftp<br> |
| 695 | <strong>Compatibility:</strong> 1.3.2rc2 and later |
| 696 | |
| 697 | <p> |
| 698 | The <code>SFTPDigests</code> directive is used to specify the list of |
| 699 | MAC digest algorithms that <code>mod_sftp</code> should use. The current list |
| 700 | of supported MAC algorithms is: |
| 701 | <ul> |
| 702 | <li>hmac-sha2-256 |
| 703 | <li>[email protected] |
| 704 | <li>hmac-sha2-512 |
| 705 | <li>[email protected] |
| 706 | <li>hmac-sha1 |
| 707 | <li>[email protected] |
| 708 | <li>hmac-sha1-96 |
| 709 | <li>[email protected] |
| 710 | <li>[email protected] |
| 711 | <li>[email protected] |
| 712 | <li>[email protected] |
| 713 | <li>[email protected] |
| 714 | </ul> |
| 715 | By default, all of the above MAC algorithms are presented to the client, |
| 716 | in the above order, during the key exchange. <b>Note</b> that some algorithms |
| 717 | (<i>e.g.</i> the SHA256 and SHA512 algorithms) may not be supported by |
| 718 | the version of OpenSSL used; this will be automatically detected. |
| 719 | |
| 720 | <p> |
| 721 | The following list of algorithms are <em>supported</em>, but <b>not</b> |
| 722 | presented to clients by default. These algorithms must be <em>explicitly</em> |
| 723 | configured via <code>SFTPDigests</code> to be available for use by clients: |
| 724 | <ul> |
| 725 | <li>hmac-md5 |
| 726 | <li>[email protected] |
| 727 | <li>hmac-md5-96 |
| 728 | <li>hmac-ripemd160 |
| 729 | </ul> |
| 730 | |
| 731 | <p> |
| 732 | The "none" MAC (<i>i.e.</i> no MAC) will <b>not</b> be presented to the client |
| 733 | by default; any sites which wish to use "none" will have to explicitly |
| 734 | configure it via <code>SFTPDigests</code>. |
| 735 | |
| 736 | <p> |
| 737 | In general, there is no need to use this directive unless only one specific |
| 738 | MAC algorithm must be used. |
| 739 | |
| 740 | <p> |
| 741 | For comparison, the MAC algorithms used by OpenSSH (depending on the version) |
| 742 | by default are: |
| 743 | <ul> |
| 744 | <li>hmac-md5 |
| 745 | <li>[email protected] |
| 746 | <li>hmac-sha1 |
| 747 | <li>[email protected] |
| 748 | <li>hmac-sha2-256 |
| 749 | <li>[email protected] |
| 750 | <li>hmac-sha2-512 |
| 751 | <li>[email protected] |
| 752 | <li>hmac-ripemd160 |
| 753 | <li>hmac-sha1-96 |
| 754 | <li>hmac-md5-96 |
| 755 | <li>[email protected] |
| 756 | <li>[email protected] |
| 757 | <li>[email protected] |
| 758 | <li>[email protected] |
| 759 | </ul> |
| 760 | Thus if you wanted to configure <code>mod_sftp</code> to present the same |
| 761 | MAC algorithms as OpenSSH, you would use: |
| 762 | <pre> |
| 763 | # Make mod_sftp present the MAC ciphers as OpenSSH |
| 764 | SFTPDigests hmac-md5 hmac-sha1 hmac-sha2-256 hmac-sha2-512 \ |
| 765 | hmac-ripemd160 hmac-sha1-96 hmac-md5-96 [email protected] \ |
| 766 | [email protected] |
| 767 | </pre> |
| 768 | |
| 769 | <p> |
| 770 | <hr> |
| 771 | <h3><a name="SFTPDisplayBanner">SFTPDisplayBanner</a></h3> |
| 772 | <strong>Syntax:</strong> SFTPDisplayBanner <em>path</em><br> |
| 773 | <strong>Default:</strong> <em>None</em><br> |
| 774 | <strong>Context:</strong> server config, <code><VirtualHost></code>, <code><Global></code><br> |
| 775 | <strong>Module:</strong> mod_sftp<br> |
| 776 | <strong>Compatibility:</strong> 1.3.2rc2 and later |
| 777 | |
| 778 | <p> |
| 779 | The <code>SFTPDisplayBanner</code> directive is used to configure the path |
| 780 | of a file which will be sent to the client prior to authentication. Such |
| 781 | files are often used to sent terms of use or other such policy terms to |
| 782 | connecting clients. |
| 783 | |
| 784 | <p> |
| 785 | See the <a href="../howto/DisplayFiles.html">Display files</a> howto for |
| 786 | more information on the variables that can be used in an |
| 787 | <code>SFTPDisplayBanner</code> file. |
| 788 | |
| 789 | <p> |
| 790 | <hr> |
| 791 | <h3><a name="SFTPEngine">SFTPEngine</a></h3> |
| 792 | <strong>Syntax:</strong> SFTPEngine <em>on|off</em><br> |
| 793 | <strong>Default:</strong> <em>off</em><br> |
| 794 | <strong>Context:</strong> server config, <code><VirtualHost></code>, <code><Global></code><br> |
| 795 | <strong>Module:</strong> mod_sftp<br> |
| 796 | <strong>Compatibility:</strong> 1.3.2rc2 and later |
| 797 | |
| 798 | <p> |
| 799 | The <code>SFTPEngine</code> directive toggles the use of the SSH2/SFTP protocols |
| 800 | engine (<i>e.g.</i> <code>mod_sftp</code>). This is usually used inside a |
| 801 | <code><VirtualHost></code> section to enable SFTP sessions for a |
| 802 | particular virtual host. By default <code>mod_sftp</code> is disabled for both |
| 803 | the main server and all configured virtual hosts. |
| 804 | |
| 805 | <p> |
| 806 | <hr> |
| 807 | <h3><a name="SFTPExtensions">SFTPExtensions</a></h3> |
| 808 | <strong>Syntax:</strong> SFTPExtensions <em>ext1 ... extN</em><br> |
| 809 | <strong>Default:</strong> None<br> |
| 810 | <strong>Context:</strong> server config, <code><VirtualHost></code>, <code><Global></code><br> |
| 811 | <strong>Module:</strong> mod_sftp<br> |
| 812 | <strong>Compatibility:</strong> 1.3.3rc3 and later |
| 813 | |
| 814 | <p> |
| 815 | The <code>SFTPExtensions</code> directive can be used to enable/disable |
| 816 | support for the various SFTP extensions supported by <code>mod_sftp</code>. |
| 817 | The extension names used for the <code>SFTPExtensions</code> directive are: |
| 818 | <ul> |
| 819 | <li>checkFile |
| 820 | <li>copyFile |
| 821 | <li>fsync |
| 822 | <li>hardlink |
| 823 | <li>homeDirectory |
| 824 | <li>limits |
| 825 | <li>posixRename |
| 826 | <li>spaceAvailable |
| 827 | <li>statvfs |
| 828 | <li>userGroupNames |
| 829 | <li>vendorID |
| 830 | <li>versionSelect |
| 831 | <li>xattr |
| 832 | </ul> |
| 833 | All extensions <i>except</i> <code>vendorID</code> <b>and</b> |
| 834 | <code>xattr</code> are enabled by default. |
| 835 | |
| 836 | <p> |
| 837 | To enable an extension, preface the extension name with a '+' (plus) character; |
| 838 | to disable the extension, use a '-' (minus) character prefix. For example: |
| 839 | <pre> |
| 840 | # Allow the copy-file extension, but not version-select |
| 841 | SFTPExtensions +copyFile -versionSelect |
| 842 | </pre> |
| 843 | |
| 844 | <p> |
| 845 | <hr> |
| 846 | <h3><a name="SFTPHostKey">SFTPHostKey</a></h3> |
| 847 | <strong>Syntax:</strong> SFTPHostKey <em>file</em>|agent:<em>/path</em>|"NoRSA"|"NoDSA"|"NoECDSA"<br> |
| 848 | <strong>Default:</strong> <em>None</em><br> |
| 849 | <strong>Context:</strong> server config, <code><VirtualHost></code>, <code><Global></code><br> |
| 850 | <strong>Module:</strong> mod_sftp<br> |
| 851 | <strong>Compatibility:</strong> 1.3.2rc2 and later |
| 852 | |
| 853 | <p> |
| 854 | The <code>SFTPHostKey</code> directive configures the path to a host key file. |
| 855 | The <code>mod_sftp</code> module uses the keys thus configured as part of |
| 856 | the SSH2 key exchange process. |
| 857 | |
| 858 | <p> |
| 859 | Note that the <code>SFTPHostKey</code> directive is <b>required</b>. You |
| 860 | can use either an RSA key, a DSA key, and/or ECDSA keys. These should be the |
| 861 | <b>exact same host key files as used by your SSH2 server</b>, <i>e.g.</i>: |
| 862 | <pre> |
| 863 | SFTPHostKey /etc/ssh_host_dsa_key |
| 864 | SFTPHostKey /etc/ssh_host_rsa_key |
| 865 | SFTPHostKey /etc/ssh_host_ecdsa_key |
| 866 | SFTPHostKey /etc/ssh_host_ed25519_key |
| 867 | </pre> |
| 868 | or the equivalents in the <code>/usr/local/etc/</code> directory. Using |
| 869 | different host keys between your SSH2 server and <code>mod_sftp</code> will |
| 870 | only cause confusion and problems for any SFTP clients. Most SFTP clients |
| 871 | will assume that the host uses the same keys for SSH2 and SFTP; after all, |
| 872 | it is the same <i>host</i> (even the same port), just different services. |
| 873 | Thus having different host keys for an SSH2 server and <code>mod_sftp</code> |
| 874 | will cause clients to constantly switch the host keys they record for the |
| 875 | same host (and cause confusion for users). |
| 876 | |
| 877 | <p> |
| 878 | The <code>SFTPHostKey</code> directive, as of <code>proftpd-1.3.5rc1</code> |
| 879 | and later, can also be used to load host keys from an SSH agent such as |
| 880 | OpenSSH's <code>ssh-agent</code>. For example: |
| 881 | <pre> |
| 882 | # Load all of the keys from the ssh-agent configured for server use |
| 883 | SFTPHostKey agent:%{env:SSH_AUTH_SOCK} |
| 884 | </pre> |
| 885 | Using an SSH agent for storing host keys allows for configurations where |
| 886 | the host keys are not stored on files on the server system, <i>e.g.</i> |
| 887 | the keys can be loaded into the SSH agent from a PKCS#11 token. |
| 888 | |
| 889 | <p> |
| 890 | The <code>SFTPHostKey</code> directive, as of <code>proftpd-1.3.6rc1</code> |
| 891 | and later, can be used to <em>disable</em> host keys configured via |
| 892 | <code><Global></code>. For example, if you have a global RSA key that |
| 893 | you wish to disable in all vhosts, you might use the "NoRSA" flag, <i>e.g.</i>: |
| 894 | <pre> |
| 895 | <Global> |
| 896 | SFTPHostKey /path/to/ssh_rsa_host_key |
| 897 | ... |
| 898 | </Global> |
| 899 | |
| 900 | <VirtualHost a.b.c.d> |
| 901 | ... |
| 902 | # Configure our per-vhost DSA host key |
| 903 | SFTPHostKey /path/to/ssh_dsa_host_key |
| 904 | |
| 905 | # ...and disable the global RSA host key |
| 906 | SFTPHostKey NoRSA |
| 907 | ... |
| 908 | </VirtualHost> |
| 909 | </pre> |
| 910 | |
| 911 | <p> |
| 912 | OpenSSH started using an OpenSSH-specific private key format in version 7.8. |
| 913 | ProFTPD did not support reading this OpenSSH-specific format until 1.3.7. Thus |
| 914 | if you need to use SSH hostkeys in the OpenSSH-specific private key format |
| 915 | with ProFTPD prior to 1.3.7, you will need to convert those private keys to |
| 916 | the more conventional PEM format that <code>mod_sftp</code> supported. If |
| 917 | your <code>SFTPHostKey</code> file starts with: |
| 918 | <pre> |
| 919 | -----BEGIN OPENSSH PRIVATE KEY----- |
| 920 | </pre> |
| 921 | then it is using the OpenSSH-specific private key format. To convert this |
| 922 | private key to a PEM private key, use <i>e.g.</i>: |
| 923 | <pre> |
| 924 | $ cp /etc/ssh/ssh_host_rsa_key /etc/proftpd/ssh_host_rsa_key |
| 925 | $ ssh-keygen -p -f /etc/proftpd/ssh_host_rsa_key -m PEM |
| 926 | </pre> |
| 927 | <b>Note</b> that you <b>cannot</b> use the <code>-e</code> option for this: |
| 928 | <pre> |
| 929 | $ ssh-keygen -e -f /etc/ssh/ssh_host_rsa_key -m PEM > /etc/proftpd/ssh_host_rsa_key |
| 930 | </pre> |
| 931 | Since that "exports" the corresponding <b><i>public key</i></b>, not the |
| 932 | <em>private key</em> as you would want for a hostkey. |
| 933 | |
| 934 | <p> |
| 935 | <hr> |
| 936 | <h3><a name="SFTPHostKeys">SFTPHostKeys</a></h3> |
| 937 | <strong>Syntax:</strong> SFTPHostKeys <em>algo1 ...</em><br> |
| 938 | <strong>Default:</strong> <em>None</em><br> |
| 939 | <strong>Context:</strong> server config, <code><VirtualHost></code>, <code><Global></code><br> |
| 940 | <strong>Module:</strong> mod_sftp<br> |
| 941 | <strong>Compatibility:</strong> 1.3.8rc4 and later |
| 942 | |
| 943 | <p> |
| 944 | The <code>SFTPHostKeys</code> directive is used to specify the list of host |
| 945 | key algorithms that <code>mod_sftp</code> should use. The current list |
| 946 | of supported host key algorithms is: |
| 947 | <ul> |
| 948 | <li>ssh-ed25519 (<i>requires Sodium</i>) |
| 949 | <li>ssh-ed448 (<i>requires OpenSSL 1.1.1 or later</i>) |
| 950 | <li>ecdsa-sha2-nistp256 |
| 951 | <li>ecdsa-sha2-nistp384 |
| 952 | <li>ecdsa-sha2-nistp521 |
| 953 | <li>rsa-sha2-512 |
| 954 | <li>rsa-sha2-256 |
| 955 | <li>ssh-rsa |
| 956 | <li>ssh-dss |
| 957 | </ul> |
| 958 | By default, all of the above host key algorithms are presented to the |
| 959 | client, in the above order, during the key exchange, <em>assuming</em> that |
| 960 | a suitable <code>SFTPHostKey</code> file for that algorithm has been provided. |
| 961 | |
| 962 | <p> |
| 963 | In general, there is no need to use this directive unless specific host keys |
| 964 | algorithm must be used (or avoided). |
| 965 | |
| 966 | <p> |
| 967 | <hr> |
| 968 | <h3><a name="SFTPKeyBlacklist">SFTPKeyBlacklist</a></h3> |
| 969 | <strong>Syntax:</strong> SFTPKeyBlacklist <em>"none"|path</em><br> |
| 970 | <strong>Default:</strong> <em>None</em><br> |
| 971 | <strong>Context:</strong> server config, <code><VirtualHost></code>, <code><Global></code><br> |
| 972 | <strong>Module:</strong> mod_sftp<br> |
| 973 | <strong>Compatibility:</strong> 1.3.2rc2 and later |
| 974 | |
| 975 | <p> |
| 976 | The <code>SFTPKeyBlacklist</code> directive configures the path to |
| 977 | a specially formatted dictionary of known weak public keys. This key |
| 978 | blacklist, and the code for using it, was primarily developed by |
| 979 | Dmitry V. Levin under sponsorship by |
| 980 | <a href="http://www.civicactions.com">CivicActions</a>. For the original |
| 981 | posting, and further information, see: |
| 982 | <pre> |
| 983 | <a href="http://www.openwall.com/lists/oss-security/2008/05/27/3">http://www.openwall.com/lists/oss-security/2008/05/27/3</a> |
| 984 | </pre> |
| 985 | |
| 986 | <p> |
| 987 | These known weak public keys arose because of a vulnerability in the OpenSSL |
| 988 | packages distributed by Debian: |
| 989 | <pre> |
| 990 | <a href="http://www.debian.org/security/2008/dsa-1571">http://www.debian.org/security/2008/dsa-1571</a> |
| 991 | </pre> |
| 992 | |
| 993 | <p> |
| 994 | The <code>mod_sftp</code> source code comes with a <code>blacklist.dat</code> |
| 995 | file which should be sufficient. If for any reason you find that you |
| 996 | need to generate your own <code>SFTPDKeyBlacklist</code>, use the |
| 997 | <code>blacklist-encode</code> program mentioned in the above URLs. |
| 998 | |
| 999 | <p> |
| 1000 | <hr> |
| 1001 | <h3><a name="SFTPKeyExchanges">SFTPKeyExchanges</a></h3> |
| 1002 | <strong>Syntax:</strong> SFTPKeyExchanges <em>algo1 ...</em><br> |
| 1003 | <strong>Default:</strong> <em>None</em><br> |
| 1004 | <strong>Context:</strong> server config, <code><VirtualHost></code>, <code><Global></code><br> |
| 1005 | <strong>Module:</strong> mod_sftp<br> |
| 1006 | <strong>Compatibility:</strong> 1.3.2rc2 and later |
| 1007 | |
| 1008 | <p> |
| 1009 | The <code>SFTPKeyExchanges</code> directive is used to specify the list of |
| 1010 | key exchange algorithms that <code>mod_sftp</code> should use. The current list |
| 1011 | of supported key exchange algorithms is: |
| 1012 | <ul> |
| 1013 | <li>curve448-sha512 |
| 1014 | <li>curve25519-sha256 |
| 1015 | <li>ecdh-sha2-nistp521 |
| 1016 | <li>ecdh-sha2-nistp384 |
| 1017 | <li>ecdh-sha2-nistp256 |
| 1018 | <li>diffie-hellman-group18-sha512 |
| 1019 | <li>diffie-hellman-group16-sha512 |
| 1020 | <li>diffie-hellman-group14-sha256 |
| 1021 | <li>diffie-hellman-group-exchange-sha256 |
| 1022 | <li>diffie-hellman-group-exchange-sha1 |
| 1023 | <li>diffie-hellman-group14-sha1 |
| 1024 | <li>diffie-hellman-group1-sha1 |
| 1025 | <li>rsa1024-sha1 |
| 1026 | </ul> |
| 1027 | By default, all of the above key exchange algorithms <i>except |
| 1028 | <code>diffie-hellman-group1-sha1</code></i> are presented to the client, in |
| 1029 | the above order, during the key exchange. |
| 1030 | |
| 1031 | <p> |
| 1032 | <b>Note</b> that the <code>diffie-hellman-group1-sha1</code> key exchange |
| 1033 | algorithm uses a weak hardcoded Diffie-Hellman group, and thus is <b>not</b> |
| 1034 | enabled by default. To enable this key exchange algorithm, you must |
| 1035 | configure the <code>SFTPKeyExchanges</code> list to <b>explicitly</b> include |
| 1036 | this algorithm, <i>or</i> use the following in your configuration: |
| 1037 | <pre> |
| 1038 | SFTPOptions AllowWeakDH |
| 1039 | </pre> |
| 1040 | |
| 1041 | <p> |
| 1042 | <b>Note</b> that the <code>curve448-sha512</code> key exchange algorithm |
| 1043 | requires an Ed448 SSH host key. To generate such a key, use: |
| 1044 | <pre> |
| 1045 | openssl genpkey -out /etc/ssh/ssh_host_ed448_key -algorithm ED448 |
| 1046 | </pre> |
| 1047 | |
| 1048 | <p> |
| 1049 | In general, there is no need to use this directive unless only one specific |
| 1050 | key exchange algorithm must be used. |
| 1051 | |
| 1052 | <p> |
| 1053 | <hr> |
| 1054 | <h3><a name="SFTPKeyLimits">SFTPKeyLimits</a></h3> |
| 1055 | <strong>Syntax:</strong> SFTPKeyLimits <em>limit1 ...</em><br> |
| 1056 | <strong>Default:</strong> MinimumRSASize 768 MinimumDSASize 384 MinimumECSize 160<em>None</em><br> |
| 1057 | <strong>Context:</strong> server config, <code><VirtualHost></code>, <code><Global></code><br> |
| 1058 | <strong>Module:</strong> mod_sftp<br> |
| 1059 | <strong>Compatibility:</strong> 1.3.6rc3 and later |
| 1060 | |
| 1061 | <p> |
| 1062 | The <code>SFTPKeyLimits</code> directive is used to configure limits on the |
| 1063 | sizes of keys (in terms of <em>bits</em>), both host keys <b>and</b> user keys. |
| 1064 | The currently supported limits are: |
| 1065 | <ul> |
| 1066 | <li><code>MinimumDSASize</code> |
| 1067 | <li><code>MinimumECSize</code> |
| 1068 | <li><code>MinimumRSASize</code> |
| 1069 | </ul> |
| 1070 | |
| 1071 | <p> |
| 1072 | Examples: |
| 1073 | <pre> |
| 1074 | # Require at least 1024-bit RSA keys; leave other default limits alone |
| 1075 | SFTPKeyLimits MinimumRSASize 1024 |
| 1076 | |
| 1077 | # Require at least 256-bit EC keys, and remove other default limits |
| 1078 | SFTPKeyLimits MinimumECSize 256 MinimumDSASize 0 MinimumRSASize 0 |
| 1079 | </pre> |
| 1080 | |
| 1081 | <p> |
| 1082 | <hr> |
| 1083 | <h3><a name="SFTPLog">SFTPLog</a></h3> |
| 1084 | <strong>Syntax:</strong> SFTPLog <em>file|"none"</em><br> |
| 1085 | <strong>Default:</strong> <em>None</em><br> |
| 1086 | <strong>Context:</strong> server config, <code><VirtualHost></code>, <code><Global></code><br> |
| 1087 | <strong>Module:</strong> mod_sftp<br> |
| 1088 | <strong>Compatibility:</strong> 1.3.2rc2 and later |
| 1089 | |
| 1090 | <p> |
| 1091 | The <code>SFTPLog</code> directive is used to specify a log file for |
| 1092 | <code>mod_sftp</code>'s reporting on a per-server basis. The <em>file</em> |
| 1093 | parameter given must be the full path to the file to use for logging. |
| 1094 | |
| 1095 | <p> |
| 1096 | Note that this path must <b>not</b> be to a world-writable directory and, |
| 1097 | unless <code>AllowLogSymlinks</code> is explicitly set to <em>on</em> |
| 1098 | (generally a bad idea), the path must <b>not</b> be a symbolic link. |
| 1099 | |
| 1100 | <p> |
| 1101 | <hr> |
| 1102 | <h3><a name="SFTPMaxChannels">SFTPMaxChannels</a></h3> |
| 1103 | <strong>Syntax:</strong> SFTPMaxChannels <em>count</em><br> |
| 1104 | <strong>Default:</strong> 10<br> |
| 1105 | <strong>Context:</strong> server config, <code><VirtualHost></code>, <code><Global></code><br> |
| 1106 | <strong>Module:</strong> mod_sftp<br> |
| 1107 | <strong>Compatibility:</strong> 1.3.2rc2 and later |
| 1108 | |
| 1109 | <p> |
| 1110 | The <code>SFTPMaxChannels</code> directive is used to configure the maximum |
| 1111 | number of simultaneously open channels permitted for a client. The |
| 1112 | default value is 10. |
| 1113 | |
| 1114 | <p> |
| 1115 | A malicious client might try to abuse the server's resources by opening |
| 1116 | an large number of SSH2 channels and then not using them. Most well-behaved |
| 1117 | SSH2 clients only ever open one channel. |
| 1118 | |
| 1119 | <p> |
| 1120 | <hr> |
| 1121 | <h3><a name="SFTPOptions">SFTPOptions</a></h3> |
| 1122 | <strong>Syntax:</strong> SFTPOptions <em>opt1 ...</em><br> |
| 1123 | <strong>Default:</strong> None<br> |
| 1124 | <strong>Context:</strong> server config, <code><VirtualHost></code>, <code><Global></code><br> |
| 1125 | <strong>Module:</strong> mod_sftp<br> |
| 1126 | <strong>Compatibility:</strong> 1.3.2rc2 and later |
| 1127 | |
| 1128 | <p> |
| 1129 | The <code>SFTPOptions</code> directive is used to configure various optional |
| 1130 | behavior of <code>mod_sftp</code>. |
| 1131 | |
| 1132 | <p> |
| 1133 | For example: |
| 1134 | <pre> |
| 1135 | SFTPOptions IgnoreSFTPUploadPerms IgnoreSCPUploadPerms PessimisticKexinit |
| 1136 | </pre> |
| 1137 | |
| 1138 | <p> |
| 1139 | The currently implemented options are: |
| 1140 | <ul> |
| 1141 | <li><code>AllowInsecureLogin</code><br> |
| 1142 | <p> |
| 1143 | By default, <code>mod_sftp</code> will <b>not</b> allow password or |
| 1144 | keyboard-interactive authentication <b>if</b> either the 'none' cipher |
| 1145 | <b>or</b> MAC/digest is selected. (These must be explicitly allowed via |
| 1146 | <code>SFTPCiphers</code> and <code>SFTPDigests</code> as well.) However, |
| 1147 | some sites may deliberately wish to allow such logins, as for <i>e.g.</i> |
| 1148 | performance testing. To allow such logins/sessions, then, use this option. |
| 1149 | |
| 1150 | <p> |
| 1151 | <b>Note</b> that this option first appeared in |
| 1152 | <code>proftpd-1.3.5</code>. |
| 1153 | </li> |
| 1154 | |
| 1155 | <p> |
| 1156 | <li><code>AllowWeakDH</code><br> |
| 1157 | <p> |
| 1158 | The <code>mod_sftp</code> will not use Diffie-Hellman groups of less |
| 1159 | than 2048 bits, due to <a href="https://www.weakdh.org">weaknesses</a> |
| 1160 | that can downgrade the security of an SSH session. If for any reason |
| 1161 | your SFTP/SCP clients <b>require</b> smaller Diffie-Hellman groups, then |
| 1162 | use this option. |
| 1163 | |
| 1164 | <p> |
| 1165 | <b>Note</b> that this option first appeared in |
| 1166 | <code>proftpd-1.3.6rc1</code>. |
| 1167 | </li> |
| 1168 | |
| 1169 | <p> |
| 1170 | <li><code>FIDOTouchRequired</code><br> |
| 1171 | <p> |
| 1172 | When a FIDO security key is used for authentication, <code>mod_sftp</code> |
| 1173 | will require that the signature prove user presence, usually via touching |
| 1174 | the authenticator. A security key which does not prove user presence |
| 1175 | will be rejected. Note that this option only applies to the FIDO |
| 1176 | authenticator algorithms "ecdsa-sk" and "ed25519-sk". |
| 1177 | |
| 1178 | <p> |
| 1179 | However, the <code>SFTPAuthorizedHostKeys</code>/ |
| 1180 | <code>SFTPAuthorizedUserKeys</code> entries for such FIDO keys |
| 1181 | <em>can</em> indicate that proof of user presence is <b>not</b> required |
| 1182 | for a given key. There are cases where this is useful. |
| 1183 | |
| 1184 | <p> |
| 1185 | This option should be used by site administrators who always want to |
| 1186 | require proof of user presence for FIDO keys, <em>regardless</em> of |
| 1187 | any per-key overrides configured elsewhere. |
| 1188 | |
| 1189 | <p> |
| 1190 | <b>Note</b> that this option first appeared in |
| 1191 | <code>proftpd-1.3.9rc1</code>. |
| 1192 | </li> |
| 1193 | |
| 1194 | <p> |
| 1195 | <li><code>FIDOVerifyRequired</code><br> |
| 1196 | <p> |
| 1197 | When a FIDO security key is used for authentication, <code>mod_sftp</code> |
| 1198 | does not require that the signature prove user <em>verification</em>, |
| 1199 | such as via PIN or biometrics. Use this option to require such |
| 1200 | user verification for all security keys; a security key which does not |
| 1201 | prove user verification will be rejected. Note that this option only |
| 1202 | applies to the FIDO authenticator algorithms "ecdsa-sk" and "ed25519-sk". |
| 1203 | |
| 1204 | <p> |
| 1205 | <b>Note</b> that this option first appeared in |
| 1206 | <code>proftpd-1.3.9rc1</code>. |
| 1207 | </li> |
| 1208 | |
| 1209 | <p> |
| 1210 | <li><code>IgnoreFIFOs</code> |
| 1211 | <p> |
| 1212 | By default, <code>mod_sftp</code> allows uploading and downloading of FIFOs, |
| 1213 | just as if they were regular files. However, in some cases this can lead |
| 1214 | to "hangs" on the SFTP/SCP client end, especially when the FIFO |
| 1215 | reader/writer processes are not running at the time. Thus to tell |
| 1216 | <code>mod_sftp</code> to ignore/reject requests to read from/write to FIFOs, |
| 1217 | for both SFTP and SCP, use this option. |
| 1218 | |
| 1219 | <p> |
| 1220 | <b>Note</b> that this option first appeared in |
| 1221 | <code>proftpd-1.3.6rc3</code>. |
| 1222 | </li> |
| 1223 | |
| 1224 | <p> |
| 1225 | <li><code>IgnoreSCPUploadPerms</code><br> |
| 1226 | <p> |
| 1227 | When an SCP client uploads a file, the desired permissions on the file |
| 1228 | are sent to the server as part of the upload. (This is different from |
| 1229 | FTP, which does <b>not</b> include the file permissions in an upload.) |
| 1230 | If you need more FTP-like functionality for any reason and wish to |
| 1231 | have <code>mod_sftp</code> silently ignore any permissions sent by the |
| 1232 | SCP client, use this option. |
| 1233 | </li> |
| 1234 | |
| 1235 | <p> |
| 1236 | <li><code>IgnoreSCPUploadTimes</code><br> |
| 1237 | <p> |
| 1238 | Use this option to have <code>mod_sftp</code> silently ignore any |
| 1239 | timestamps sent by SCP clients as part of the upload. |
| 1240 | |
| 1241 | <p> |
| 1242 | <b>Note</b> that this option first appeared in |
| 1243 | <code>proftpd-1.3.5rc4</code>. |
| 1244 | </li> |
| 1245 | |
| 1246 | <p> |
| 1247 | <li><code>IgnoreSFTPSetExtendedAttributes</code><br> |
| 1248 | <p> |
| 1249 | Use this option to have <code>mod_sftp</code> silently ignore any |
| 1250 | extended attributes sent by SFTP clients via the <code>SETSTAT</code> or |
| 1251 | <code>FSETSTAT</code> SFTP requests. |
| 1252 | |
| 1253 | <p> |
| 1254 | <b>Note</b> that this option first appeared in |
| 1255 | <code>proftpd-1.3.6rc3</code>. |
| 1256 | </li> |
| 1257 | |
| 1258 | <p> |
| 1259 | <li><code>IgnoreSFTPSetOwners</code><br> |
| 1260 | <p> |
| 1261 | Use this option to have <code>mod_sftp</code> silently ignore any |
| 1262 | ownership changes sent by SFTP clients via the <code>SETSTAT</code> or |
| 1263 | <code>FSETSTAT</code> SFTP requests; these are equivalent to |
| 1264 | an FTP <code>SITE CHGRP</code> command. |
| 1265 | |
| 1266 | <p> |
| 1267 | <b>Note</b> that this option first appeared in |
| 1268 | <code>proftpd-1.3.5rc1</code>. |
| 1269 | </li> |
| 1270 | |
| 1271 | <p> |
| 1272 | <li><code>IgnoreSFTPSetPerms</code><br> |
| 1273 | <p> |
| 1274 | Use this option to have <code>mod_sftp</code> silently ignore any |
| 1275 | permissions sent by SFTP clients via the <code>SETSTAT</code> or |
| 1276 | <code>FSETSTAT</code> SFTP requests; these are equivalent to |
| 1277 | an FTP <code>SITE CHMOD</code> command. |
| 1278 | |
| 1279 | <p> |
| 1280 | <b>Note</b> that this option first appeared in |
| 1281 | <code>proftpd-1.3.4rc2</code>. |
| 1282 | </li> |
| 1283 | |
| 1284 | <p> |
| 1285 | <li><code>IgnoreSFTPSetTimes</code><br> |
| 1286 | <p> |
| 1287 | Use this option to have <code>mod_sftp</code> silently ignore any |
| 1288 | timestamps sent by SFTP clients via the <code>SETSTAT</code> or |
| 1289 | <code>FSETSTAT</code> SFTP requests; these are equivalent to |
| 1290 | an FTP <code>SITE UTIMES</code> command. |
| 1291 | |
| 1292 | <p> |
| 1293 | <b>Note</b> that this option first appeared in |
| 1294 | <code>proftpd-1.3.4rc4</code>. |
| 1295 | </li> |
| 1296 | |
| 1297 | <p> |
| 1298 | <li><code>IgnoreSFTPUploadExtendedAttributes</code><br> |
| 1299 | <p> |
| 1300 | When an SFTP client uploads a file or creates a directory, the desired |
| 1301 | extended attributes ("xattrs") on the path are sent to the server as part |
| 1302 | of the upload. (This is different from FTP, which does <b>not</b> include |
| 1303 | the file attributes in an upload.) If you need more FTP-like functionality |
| 1304 | for any reason and wish to have <code>mod_sftp</code> silently ignore any |
| 1305 | extended attributes sent by the SFTP client, use this option. |
| 1306 | |
| 1307 | <p> |
| 1308 | <b>Note</b> that this option first appeared in |
| 1309 | <code>proftpd-1.3.6rc3</code>. |
| 1310 | </li> |
| 1311 | |
| 1312 | <p> |
| 1313 | <li><code>IgnoreSFTPUploadPerms</code><br> |
| 1314 | <p> |
| 1315 | When an SFTP client uploads a file or creates a directory, the desired |
| 1316 | permissions on the path are sent to the server as part of the upload. |
| 1317 | (This is different from FTP, which does <b>not</b> include the file |
| 1318 | permissions in an upload.) If you need more FTP-like functionality for any |
| 1319 | reason and wish to have <code>mod_sftp</code> silently ignore any |
| 1320 | permissions sent by the SFTP client, use this option. |
| 1321 | </li> |
| 1322 | |
| 1323 | <p> |
| 1324 | <li><code>IncludeSFTPTimes</code><br> |
| 1325 | <p> |
| 1326 | Some SFTP clients (<i>e.g.</i> the Rebex SFTP library) do not implement |
| 1327 | SFTP protocol versions 4+ well, and do not <em>request</em> the |
| 1328 | access/modify time attributes but <em>expect/assume</em> that those |
| 1329 | time attributes will be present in the <code>STAT</code> responses. |
| 1330 | Use this option to tell <code>mod_sftp</code> to always include the |
| 1331 | access and modify time attributes in <code>STAT</code> responses for |
| 1332 | clients using SFTP protocol version 4 and higher. |
| 1333 | |
| 1334 | <p> |
| 1335 | <b>Note</b> that this option first appeared in |
| 1336 | <code>proftpd-1.3.7rc1</code>. |
| 1337 | </li> |
| 1338 | |
| 1339 | <p> |
| 1340 | <li><code>InsecureHostKeyPerms</code><br> |
| 1341 | <p> |
| 1342 | When this option is used, <code>mod_sftp</code> will ignore insecure |
| 1343 | permissions (<i>i.e.</i> group- or world-readable) on |
| 1344 | <code>SFTPHostKey</code> files. This option should appear <em>before</em> |
| 1345 | any <code>SFTPHostKey</code> directives in the configuration, as hostkey |
| 1346 | permissions are checked at configuration parse time. |
| 1347 | |
| 1348 | <p> |
| 1349 | <b>Note</b> that this option first appeared in |
| 1350 | <code>proftpd-1.3.6rc1</code>. |
| 1351 | </li> |
| 1352 | |
| 1353 | <p> |
| 1354 | <li><code>MatchKeySubject</code><br> |
| 1355 | <p> |
| 1356 | When this option is used, if public key authentication is used, the |
| 1357 | <code>mod_sftp</code> module will check if the public key has a "Subject" |
| 1358 | header. If so, that the value of that header <b>must</b> match the |
| 1359 | name of the authenticating user/host. |
| 1360 | |
| 1361 | <p> |
| 1362 | <b>Note</b> that this option first appeared in |
| 1363 | <code>proftpd-1.3.4rc1</code>. |
| 1364 | </li> |
| 1365 | |
| 1366 | <p> |
| 1367 | <li><code>NoExtensionNegotiation</code><br> |
| 1368 | <p> |
| 1369 | By default, <code>mod_sftp</code> will offer/support the SSH extension |
| 1370 | negotiation, defined by |
| 1371 | <a href="https://tools.ietf.org/html/rfc8308">RFC 8308</a>. Use this |
| 1372 | option to disable support for extension negotiations. |
| 1373 | |
| 1374 | <p> |
| 1375 | <b>Note</b> that this option first appeared in |
| 1376 | <code>proftpd-1.3.7rc4</code>. |
| 1377 | </li> |
| 1378 | |
| 1379 | <p> |
| 1380 | <li><code>NoHostkeyRotation</code><br> |
| 1381 | <p> |
| 1382 | By default, <code>mod_sftp</code> will offer/support the OpenSSH |
| 1383 | hostkey rotation extensions, "[email protected]" and |
| 1384 | "[email protected]". Use this option to disable support for |
| 1385 | these custom OpenSSH extensions. |
| 1386 | |
| 1387 | <p> |
| 1388 | <b>Note</b> that this option first appeared in |
| 1389 | <code>proftpd-1.3.8rc3</code>. |
| 1390 | </li> |
| 1391 | |
| 1392 | <p> |
| 1393 | <li><code>NoStrictKex</code><br> |
| 1394 | <p> |
| 1395 | By default, <code>mod_sftp</code> will honor/support the OpenSSH |
| 1396 | "strict KEX" mode extension, "[email protected]" and |
| 1397 | "[email protected]". Use this option to disable support for |
| 1398 | these custom OpenSSH extensions. |
| 1399 | |
| 1400 | <p> |
| 1401 | <b>Note</b> that this option first appeared in |
| 1402 | <code>proftpd-1.3.9rc2</code>. |
| 1403 | </li> |
| 1404 | |
| 1405 | <p> |
| 1406 | <li><code>OldProtocolCompat</code><br> |
| 1407 | <p> |
| 1408 | Older clients identity their protocol versions as "1.99", rather than as |
| 1409 | "2.0". By default, <code>mod_sftp</code> will refuse to handle connections |
| 1410 | from such clients. To enable compatibility with these clients (which |
| 1411 | tend to be derived from ssh.com/Tectia code), use this option. |
| 1412 | |
| 1413 | <p> |
| 1414 | Note that this option automatically enables the |
| 1415 | <code>PessimisticKexinit</code> SFTPOption as well. |
| 1416 | |
| 1417 | <p> |
| 1418 | <b>Note</b> that this option first appeared in |
| 1419 | <code>proftpd-1.3.4rc1</code>. |
| 1420 | </li> |
| 1421 | |
| 1422 | <p> |
| 1423 | <li><code>PessimisticKexinit</code><br> |
| 1424 | <p> |
| 1425 | As described <a href="#SFTPTelnetBanner">here</a>, the <code>mod_sftp</code> |
| 1426 | module tries to reduce the connection latency by optimistically sending |
| 1427 | the <code>KEXINIT</code> key exchange message. However, some SSH clients |
| 1428 | cannot handle this behavior. Use this option to disable the optimistic |
| 1429 | sending of the <code>KEXINIT</code> message. |
| 1430 | |
| 1431 | <p> |
| 1432 | <b>Note</b> that this option first appeared in |
| 1433 | <code>proftpd-1.3.4rc1</code>. |
| 1434 | </li> |
| 1435 | </ul> |
| 1436 | |
| 1437 | <p> |
| 1438 | <hr> |
| 1439 | <h3><a name="SFTPPassPhraseProvider">SFTPPassPhraseProvider</a></h3> |
| 1440 | <strong>Syntax:</strong> SFTPPassPhraseProvider <em>path</em><br> |
| 1441 | <strong>Default:</strong> <em>None</em><br> |
| 1442 | <strong>Context:</strong> server config<br> |
| 1443 | <strong>Module:</strong> mod_sftp<br> |
| 1444 | <strong>Compatibility:</strong> 1.3.2rc2 and later |
| 1445 | |
| 1446 | <p> |
| 1447 | The <code>SFTPPassPhraseProvider</code> directive is used to specify an |
| 1448 | external program which will be called, when <code>mod_sftp</code> starts up, |
| 1449 | for each encrypted host key file. The program will be invoked with two |
| 1450 | command-line arguments, passed on <code>stdin</code> to the program: |
| 1451 | <pre> |
| 1452 | <em>servername</em>:<em>portnumber</em> <em>file</em> |
| 1453 | </pre> |
| 1454 | where <code><em>servername</em>:<em>portnumber</em></code> indicates the |
| 1455 | server using that encrypted certificate key, and <em>file</em> indicates the |
| 1456 | host key file in question. The program then must print the corresponding |
| 1457 | passphrase for the key to <code>stdout</code>. |
| 1458 | |
| 1459 | <p> |
| 1460 | The intent is that this external program can perform any security checks |
| 1461 | necessary, to make sure that the system is not compromised by an attacker, |
| 1462 | and only when these checks pass successfully will the passphrase be provided. |
| 1463 | These security checks, and the way the passphrase is determined, can be as |
| 1464 | complex as you like. |
| 1465 | |
| 1466 | <p> |
| 1467 | Example: |
| 1468 | <pre> |
| 1469 | SFTPPassPhraseProvider /etc/ftpd/sftp/get-passphrase |
| 1470 | </pre> |
| 1471 | |
| 1472 | <p> |
| 1473 | <hr> |
| 1474 | <h3><a name="SFTPRekey">SFTPRekey</a></h3> |
| 1475 | <strong>Syntax:</strong> SFTPRekey <em>"none"|"required" [[interval bytes] timeout]</em><br> |
| 1476 | <strong>Default:</strong> <em>None</em><br> |
| 1477 | <strong>Context:</strong> server config, <code><VirtualHost></code>, <code><Global></code><br> |
| 1478 | <strong>Module:</strong> mod_sftp<br> |
| 1479 | <strong>Compatibility:</strong> 1.3.2rc2 and later |
| 1480 | |
| 1481 | <p> |
| 1482 | The <code>SFTPRekey</code> directive configures the session rekey policy |
| 1483 | used by the <code>mod_sftp</code> module. When an SSH2 client connects, |
| 1484 | there is an initial exchange of hostkey, cipher, digest, and compression |
| 1485 | algorithms, followed by sharing of information which leads to the calculation |
| 1486 | of shared session keys. These keys are used in the various algorithms. |
| 1487 | The exchange of algorithms and calculation of new session keys can happen |
| 1488 | at any time during the SSH2 session; this is known as "rekeying". |
| 1489 | |
| 1490 | <p> |
| 1491 | By default, <code>mod_sftp</code> will only <b>require</b> rekeying when |
| 1492 | the packet sequence number (for sent <i>or</i> received SSH2 packets) reaches |
| 1493 | a rather high limit. The digest algorithm used, for example, might begin |
| 1494 | to leak cryptographically sensitive information if used for too many |
| 1495 | packets (see RFC 4344). Outside of these sequence number limits, however, |
| 1496 | <code>mod_sftp</code> will not attempt to initiate rekeying. |
| 1497 | |
| 1498 | <p> |
| 1499 | To prevent <code>mod_sftp</code> from attempting rekeying, use: |
| 1500 | <pre> |
| 1501 | SFTPRekey none |
| 1502 | </pre> |
| 1503 | Note that disabling rekeying altogether is a Very Bad Idea. While rekeying |
| 1504 | can cause delays in the SSH2 session, it is intended to guard against certain |
| 1505 | attacks. You should therefore <b>only</b> disable rekeying for certain |
| 1506 | SSH2 clients which cannot support rekeying. Please report those clients |
| 1507 | (<b>including</b> the client version) to the mod_sftp maintainer, so that that |
| 1508 | client can be added to the list of known clients which cannot handle rekeying. |
| 1509 | |
| 1510 | <p> |
| 1511 | To require rekeying, simply use: |
| 1512 | <pre> |
| 1513 | SFTPRekey required |
| 1514 | </pre> |
| 1515 | With this parameter, <code>mod_sftp</code> will default to requiring a rekey |
| 1516 | within 1 hour (3600 seconds) or after 2GB of data sent <i>or</i> received, |
| 1517 | whichever happens first. There will be no timeout once a rekeying has been |
| 1518 | requested. |
| 1519 | |
| 1520 | <p> |
| 1521 | However, administrators wishing to use different rekey intervals or rekey |
| 1522 | byte limits can use the optional <em>interval</em> (in seconds) and |
| 1523 | <em>bytes</em> (in MB) parameters, <i>e.g.</i>: |
| 1524 | <pre> |
| 1525 | # Require rekeying after 30 minutes, or 4 GB |
| 1526 | SFTPRekey required 1800 4096 |
| 1527 | </pre> |
| 1528 | |
| 1529 | <p> |
| 1530 | Finally, the paranoid administrator may wish to set a timeout, in seconds, |
| 1531 | in which a client <b>must</b> complete a session rekeying, otherwise the |
| 1532 | client will be disconnected. This would look like: |
| 1533 | <pre> |
| 1534 | # Require rekeying after 30 minutes, or 4 GB. If the rekeying is not |
| 1535 | # completed within 5 minutes of a rekey request, disconnect the client. |
| 1536 | SFTPRekey required 1800 4096 300 |
| 1537 | </pre> |
| 1538 | Note that normally such rekey timeouts are not necessary. |
| 1539 | |
| 1540 | <p> |
| 1541 | <hr> |
| 1542 | <h3><a name="SFTPTrafficPolicy">SFTPTrafficPolicy</a></h3> |
| 1543 | <strong>Syntax:</strong> SFTPTrafficPolicy <em>policy</em><br> |
| 1544 | <strong>Default:</strong> <em>None</em><br> |
| 1545 | <strong>Context:</strong> server config, <code><VirtualHost></code>, <code><Global></code><br> |
| 1546 | <strong>Module:</strong> mod_sftp<br> |
| 1547 | <strong>Compatibility:</strong> 1.3.2rc2 and later |
| 1548 | |
| 1549 | <p> |
| 1550 | The <code>SFTPTrafficPolicy</code> directive is used to configure a measure |
| 1551 | of protection against traffic analysis attacks. Such attacks use the number |
| 1552 | of packets sent, the size of the packets, and the timing of the packets to try |
| 1553 | to gain information about the nature of the data being transmitted. |
| 1554 | |
| 1555 | <p> |
| 1556 | The SSH2 protocol includes a particular message, <code>SSH_MSG_IGNORE</code>, |
| 1557 | which all implementations (both clients and servers) must handle by |
| 1558 | dropping on the floor. Implementations, like <code>mod_sftp</code>, can |
| 1559 | use these messages to add random data to the session in the hopes of making |
| 1560 | such traffic analyses more difficult. |
| 1561 | |
| 1562 | <p> |
| 1563 | The <code>SFTPTrafficPolicy</code> directive supports the following range |
| 1564 | of policies; the chances columns list the probability that |
| 1565 | <code>mod_sftp</code> will send an <code>SSH_MSG_IGNORE</code> message. |
| 1566 | |
| 1567 | <p> |
| 1568 | <table border=1 summary="SFTP Traffic Policies"> |
| 1569 | <tr> |
| 1570 | <td><b>Policy Name</b></td> |
| 1571 | <td><b>Chances</b></td> |
| 1572 | <td><b>Checks</b></td> |
| 1573 | </tr> |
| 1574 | |
| 1575 | <tr> |
| 1576 | <td>"none"</td> |
| 1577 | <td>Never</td> |
| 1578 | <td>Never</td> |
| 1579 | </tr> |
| 1580 | |
| 1581 | <tr> |
| 1582 | <td>"low"</td> |
| 1583 | <td>1 in 1000</td> |
| 1584 | <td>Every 5 seconds</td> |
| 1585 | </tr> |
| 1586 | |
| 1587 | <tr> |
| 1588 | <td>"medium"</td> |
| 1589 | <td>1 in 100</td> |
| 1590 | <td>Every 5 seconds</td> |
| 1591 | </tr> |
| 1592 | |
| 1593 | <tr> |
| 1594 | <td>"high"</td> |
| 1595 | <td>1 in 10</td> |
| 1596 | <td>Every second</td> |
| 1597 | </tr> |
| 1598 | |
| 1599 | <tr> |
| 1600 | <td>"paranoid"</td> |
| 1601 | <td>Always</td> |
| 1602 | <td>Every second</td> |
| 1603 | </tr> |
| 1604 | </table> |
| 1605 | |
| 1606 | <p> |
| 1607 | The default <code>SFTPTrafficPolicy</code> setting is "none". |
| 1608 | |
| 1609 | <p> |
| 1610 | <b>However</b>, <i>if</i> a client negotiates the use of a CBC cipher, then a |
| 1611 | defensive traffic policy will <b>automatically</b> be used. |
| 1612 | <a href="http://www.faqs.org/rfcs/rfc4251.html">RFC 4251</a>, Section 9.3.1, |
| 1613 | specifically mentions the insertion of <code>SSH_MSG_IGNORE</code> messages as |
| 1614 | a way of mitigating the "Rogaway" attack on CBC ciphers. In order to disable |
| 1615 | this automatic mitigation behavior, you must <i>explicitly</i> configure |
| 1616 | a <code>SFTPTrafficPolicy</code> setting in your configuration, <i>e.g.</i> |
| 1617 | <pre> |
| 1618 | # Disable any automatic protection when CBC ciphers are used |
| 1619 | SFTPTrafficPolicy none |
| 1620 | </pre> |
| 1621 | <b>Note that this is not recommended</b>! |
| 1622 | |
| 1623 | <p> |
| 1624 | <hr> |
| 1625 | <h2><a name="Installation">Installation</a></h2> |
| 1626 | The <code>mod_sftp</code> module is distributed with ProFTPD. For including |
| 1627 | <code>mod_sftp</code> as a statically linked module, use: |
| 1628 | <pre> |
| 1629 | $ ./configure --enable-openssl --with-modules=mod_sftp ... |
| 1630 | </pre> |
| 1631 | Alternatively, <code>mod_sftp</code> can be built as a DSO module: |
| 1632 | <pre> |
| 1633 | $ ./configure --enable-dso --enable-openssl --with-shared=mod_sftp ... |
| 1634 | </pre> |
| 1635 | Then follow the usual steps: |
| 1636 | <pre> |
| 1637 | $ make |
| 1638 | $ make install |
| 1639 | </pre> |
| 1640 | <b>Note</b> that if the <code>libsodium</code> library is available, |
| 1641 | <code>mod_sftp</code> will auto-detect this, which enables other supported |
| 1642 | algorithms. You can ensure that <code>mod_sftp</code> compiles with the |
| 1643 | <code>libsodium</code> library like so: |
| 1644 | <pre> |
| 1645 | $ ./configure --enable-openssl --with-modules=mod_sftp ... \ |
| 1646 | --with-includes=/path/to/libsodium/include \ |
| 1647 | --with-libraries=/path/to/libsodium/lib |
| 1648 | </pre> |
| 1649 | |
| 1650 | <p> |
| 1651 | <hr> |
| 1652 | <h2><a name="Usage">Usage</a></h2> |
| 1653 | <p> |
| 1654 | |
| 1655 | <p> |
| 1656 | <b>Access Controls for SFTP Requests</b><br> |
| 1657 | Some of the requests supported by SFTP have FTP command equivalents. Other |
| 1658 | requests in SFTP have no FTP command equivalent. This makes the use of |
| 1659 | <code><Limit></code> sections for access controls in <code>mod_sftp</code> |
| 1660 | a little interesting. |
| 1661 | |
| 1662 | <p> |
| 1663 | First, the familiar territory. The following shows the |
| 1664 | <code><Limit></code> sections for FTP commands (just as for normal FTP |
| 1665 | sessions) which are honored by <code>mod_sftp</code>: |
| 1666 | <ul> |
| 1667 | <li><code><Limit DELE></code><br> |
| 1668 | Applies to the <code>REMOVE</code> SFTP request |
| 1669 | </li> |
| 1670 | |
| 1671 | <p> |
| 1672 | <li><code><Limit MKD XMKD></code><br> |
| 1673 | Applies to the <code>MKDIR</code> SFTP request |
| 1674 | </li> |
| 1675 | |
| 1676 | <p> |
| 1677 | <li><code><Limit MLSD></code><br> |
| 1678 | Applies to the <code>OPENDIR</code> SFTP request |
| 1679 | </li> |
| 1680 | |
| 1681 | <p> |
| 1682 | <li><code><Limit LIST NLST></code><br> |
| 1683 | Applies to the <code>READDIR</code> SFTP request, resulting in an |
| 1684 | <em>empty directory listing</em>. |
| 1685 | </li> |
| 1686 | |
| 1687 | <p> |
| 1688 | <li><code><Limit RETR></code><br> |
| 1689 | Applies to the <code>READ</code> SFTP request |
| 1690 | </li> |
| 1691 | |
| 1692 | <p> |
| 1693 | <li><code><Limit RNFR RNTO></code><br> |
| 1694 | Applies to the <code>RENAME</code> SFTP request |
| 1695 | </li> |
| 1696 | |
| 1697 | <p> |
| 1698 | <li><code><Limit RMD XRMD></code><br> |
| 1699 | Applies to the <code>RMDIR</code> SFTP request |
| 1700 | </li> |
| 1701 | |
| 1702 | <p> |
| 1703 | <li><code><Limit STOR></code><br> |
| 1704 | Applies to the <code>WRITE</code> SFTP request |
| 1705 | </li> |
| 1706 | |
| 1707 | <p> |
| 1708 | <li><code><Limit SITE_CHGRP></code><br> |
| 1709 | Applies to the <code>SETSTAT</code> and <code>FSETSTAT</code> SFTP |
| 1710 | requests when they change file ownership |
| 1711 | </li> |
| 1712 | |
| 1713 | <p> |
| 1714 | <li><code><Limit SITE_CHMOD></code><br> |
| 1715 | Applies to the <code>SETSTAT</code> and <code>FSETSTAT</code> SFTP |
| 1716 | requests when they change file permissions |
| 1717 | </li> |
| 1718 | </ul> |
| 1719 | Thus you can see that <code>mod_sftp</code> will reuse much of your existing |
| 1720 | <code><Limit></code>-based access controls for SFTP sessions. |
| 1721 | |
| 1722 | <p> |
| 1723 | For those SFTP requests which have no direct FTP equivalents elsewhere in |
| 1724 | <code>proftpd</code>, the <code>mod_sftp</code> module supports some |
| 1725 | slightly different <code><Limit></code> sections. <b>Note</b> that |
| 1726 | the following does <b>not</b> apply to FTP sessions, nor does it imply |
| 1727 | that FTP supports these commands: |
| 1728 | <ul> |
| 1729 | <li><code><Limit FSTAT></code><br> |
| 1730 | Applies to the <code>FSTAT</code> SFTP request |
| 1731 | </li> |
| 1732 | |
| 1733 | <p> |
| 1734 | <li><code><Limit LSTAT></code><br> |
| 1735 | Applies to the <code>LSTAT</code> SFTP request |
| 1736 | </li> |
| 1737 | |
| 1738 | <p> |
| 1739 | <li><code><Limit LOCK></code><br> |
| 1740 | Applies to the <code>LOCK</code> and <code>UNLOCK</code> SFTP requests |
| 1741 | </li> |
| 1742 | |
| 1743 | <p> |
| 1744 | <li><code><Limit OPEN></code><br> |
| 1745 | Applies to the <code>OPEN</code> SFTP request |
| 1746 | </li> |
| 1747 | |
| 1748 | <p> |
| 1749 | <li><code><Limit READLINK></code><br> |
| 1750 | Applies to the <code>READLINK</code> SFTP request |
| 1751 | </li> |
| 1752 | |
| 1753 | <p> |
| 1754 | <li><code><Limit SETSTAT></code><br> |
| 1755 | Applies to the <code>FSETSTAT</code> and <code>SETSTAT</code> SFTP requests |
| 1756 | </li> |
| 1757 | |
| 1758 | <p> |
| 1759 | <li><code><Limit STAT></code><br> |
| 1760 | Applies to the <code>STAT</code> SFTP request |
| 1761 | </li> |
| 1762 | |
| 1763 | <p> |
| 1764 | <li><code><Limit SYMLINK></code><br> |
| 1765 | Applies to the <code>LINK</code> and <code>SYMLINK</code> SFTP requests |
| 1766 | </li> |
| 1767 | </ul> |
| 1768 | Not all versions of SFTP support all of these requests; the <code>LOCK</code> |
| 1769 | and <code>UNLOCK</code> requests, for example, appear only in later versions |
| 1770 | of the SFTP protocol. |
| 1771 | |
| 1772 | <p> |
| 1773 | What about the <code>READ</code> and <code>WRITE</code> command groups? |
| 1774 | <ul> |
| 1775 | <li><code><Limit READ></code><br> |
| 1776 | Applies to the <code>SYMLINK</code> and <code>READ</code> SFTP requests |
| 1777 | </li> |
| 1778 | |
| 1779 | <p> |
| 1780 | <li><code><Limit WRITE></code><br> |
| 1781 | Applies to the <code>LOCK</code>, <code>SETSTAT</code>, |
| 1782 | <code>SYMLINK</code>, and <code>WRITE</code> SFTP requests |
| 1783 | </li> |
| 1784 | </ul> |
| 1785 | |
| 1786 | <p><a name="ExtendedLogClasses"> |
| 1787 | Here is table of the supported <a href="../modules/mod_log.html#ExtendedLog"><code>ExtendedLog</code></a> directive <em>command classes</em> for SFTP sessions: |
| 1788 | <p> |
| 1789 | <table border=1 summary="Command Classes"> |
| 1790 | <tr> |
| 1791 | <td><b>Command Class</b></td> |
| 1792 | <td><b>SSH, SFTP Requests</b></td> |
| 1793 | </tr> |
| 1794 | |
| 1795 | <tr> |
| 1796 | <td><code>ALL</code></td> |
| 1797 | <td>All requests <i>except</i> the <code>EXIT</code> pseudo-command (<i>default</i>)</td> |
| 1798 | </tr> |
| 1799 | |
| 1800 | <tr> |
| 1801 | <td><code>NONE</code></td> |
| 1802 | <td>No requests</td> |
| 1803 | </tr> |
| 1804 | |
| 1805 | <tr> |
| 1806 | <td><code>AUTH</code></td> |
| 1807 | <td>Authentication requests: <code>USERAUTH_REQUEST</code></td> |
| 1808 | </tr> |
| 1809 | |
| 1810 | <tr> |
| 1811 | <td><code>INFO</code></td> |
| 1812 | <td>Informational commands: <code>EXT_INFO</code> |
| 1813 | (SSH extension negotiation), <code>REALPATH</code></td> |
| 1814 | </tr> |
| 1815 | |
| 1816 | <tr> |
| 1817 | <td><code>DIRS</code></td> |
| 1818 | <td>Directory commands: <code>MKDIR</code>, <code>OPENDIR</code>, |
| 1819 | <code>READDIR</code>, <code>REALPATH</code>, <code>RMDIR</code></td> |
| 1820 | </tr> |
| 1821 | |
| 1822 | <tr> |
| 1823 | <td><code>READ</code></td> |
| 1824 | <td>File reading: <code>CLOSE</code>, <code>FSTAT</code>, |
| 1825 | <code>LSTAT</code>, <code>OPEN</code>, <code>READ</code>, |
| 1826 | <code>READLINK</code>, <code>STAT</code></td> |
| 1827 | </tr> |
| 1828 | |
| 1829 | <tr> |
| 1830 | <td><code>WRITE</code></td> |
| 1831 | <td>File/directory writing or creation: <code>CLOSE</code>, |
| 1832 | <code>FSETSTAT</code>, <code>LINK</code>, <code>LOCK</code>, |
| 1833 | <code>MKDIR</code>, <code>OPEN</code>, <code>REMOVE</code>, |
| 1834 | <code>RENAME</code>, <code>RMDIR</code>, <code>SETSTAT</code>, |
| 1835 | <code>SYMLINK</code>, <code>WRITE</code>, <code>UNLOCK</code></td> |
| 1836 | </tr> |
| 1837 | |
| 1838 | <tr> |
| 1839 | <td><code>MISC</code></td> |
| 1840 | <td>Miscellaneous commands: <code>EXTENDED</code>, <code>FSYNC</code>, |
| 1841 | <code>HARDLINK</code>, <code>HOMEDIR</code>, <code>INIT</code>, |
| 1842 | <code>RENAME</code>, <code>SERVICE_REQUEST</code></td> |
| 1843 | </tr> |
| 1844 | |
| 1845 | <tr> |
| 1846 | <td><code>SEC</code></td> |
| 1847 | <td>SSH security requests: <code>DH_GEX_INIT</code>, |
| 1848 | <code>DH_GEX_REQUEST</code>, <code>DH_INIT</code>, <code>ECDH_INIT</code>, |
| 1849 | <code>KEXINIT</code>, <code>KEXRSA_SECRET</code>, |
| 1850 | <code>NEWKEYS</code></td> |
| 1851 | </tr> |
| 1852 | |
| 1853 | <tr> |
| 1854 | <td><code>SSH</code></td> |
| 1855 | <td>SSH protocol requests: <code>CHANNEL_CLOSE</code>, |
| 1856 | <code>CHANNEL_EOF</code>, <code>CHANNEL_OPEN</code>, |
| 1857 | <code>CHANNEL_REQUEST</code>, <code>CHANNEL_WINDOW_ADJUST</code>, |
| 1858 | <code>DH_GEX_INIT</code>, <code>DH_GEX_REQUEST</code>, |
| 1859 | <code>DH_INIT</code>, <code>ECDH_INIT</code>, <code>EXT_INFO</code>, |
| 1860 | <code>KEXINIT</code>, <code>KEXRSA_SECRET</code>, <code>NEWKEYS</code>, |
| 1861 | <code>SERVICE_REQUEST</code>, <code>USERAUTH_REQUEST</code></td> |
| 1862 | </tr> |
| 1863 | |
| 1864 | <tr> |
| 1865 | <td><code>SFTP</code></td> |
| 1866 | <td>SFTP protocol requests: <code>CLOSE</code>, <code>EXTENDED</code>, |
| 1867 | <code>FSETSTAT</code>, <code>FSTAT</code>, <code>FSYNC</code>, |
| 1868 | <code>HARDLINK</code>, <code>HOMEDIR</code>, <code>INIT</code>, |
| 1869 | <code>LINK</code>, <code>LOCK</code>, <code>LSTAT</code>, |
| 1870 | <code>MKDIR</code>, <code>OPEN</code>, <code>OPENDIR</code>, |
| 1871 | <code>READ</code>, <code>READDIR</code>, <code>READLINK</code>, |
| 1872 | <code>REALPATH</code>, <code>REMOVE</code>, <code>RENAME</code>, |
| 1873 | <code>RMDIR</code>, <code>SETSTAT</code>, <code>STAT</code>, |
| 1874 | <code>SYMLINK</code>, <code>WRITE</code>, <code>UNLOCK</code></td> |
| 1875 | </tr> |
| 1876 | |
| 1877 | <tr> |
| 1878 | <td><code>EXIT</code></td> |
| 1879 | <td>Logs the configured <code>LogFormat</code> at session exit.<br> |
| 1880 | <b>NOTE</b>: <code>EXIT</code> is <b>not</b> part of the |
| 1881 | <code>ALL</code> command class, in order to preserve |
| 1882 | backward-compatible <code>ALL</code> behavior.</td> |
| 1883 | </tr> |
| 1884 | </table> |
| 1885 | |
| 1886 | <p><a name="EnvironmentVariables"> |
| 1887 | <b>Environment Variables</b><br> |
| 1888 | The <code>mod_sftp</code> module will set the following environment |
| 1889 | variables whenever an SSH2 client connects: |
| 1890 | <ul> |
| 1891 | <li><code>SFTP</code> |
| 1892 | <li><code>SFTP_LIBRARY_VERSION</code> |
| 1893 | <li><code>SSH_CONNECTION</code> |
| 1894 | </ul> |
| 1895 | In addition, the following environment variables will be set (with appropriate |
| 1896 | values), once the client has successfully exchanged keys with |
| 1897 | <code>mod_sftp</code>: |
| 1898 | <ul> |
| 1899 | <li><code>SFTP_CLIENT_BANNER</code> |
| 1900 | <li><code>SFTP_CLIENT_CIPHER_ALGO</code> |
| 1901 | <li><code>SFTP_CLIENT_COMPRESSION_ALGO</code> |
| 1902 | <li><code>SFTP_CLIENT_MAC_ALGO</code> |
| 1903 | <li><code>SFTP_KEX_ALGO</code> |
| 1904 | <li><code>SFTP_HOST_KEY_ALGO</code> |
| 1905 | <li><code>SFTP_SERVER_CIPHER_ALGO</code> |
| 1906 | <li><code>SFTP_SERVER_COMPRESSION_ALGO</code> |
| 1907 | <li><code>SFTP_SERVER_MAC_ALGO</code> |
| 1908 | </ul> |
| 1909 | When a client attempts to use publickey authentication, the following variables |
| 1910 | <i>may</i> be set: |
| 1911 | <ul> |
| 1912 | <li><code>SFTP_USER_AUTH_METHOD</code> |
| 1913 | <li><code>SFTP_USER_PUBLICKEY_ALGO</code> |
| 1914 | <li><code>SFTP_USER_PUBLICKEY_FINGERPRINT</code> |
| 1915 | <li><code>SFTP_USER_PUBLICKEY_FINGERPRINT_ALGO</code> |
| 1916 | </ul> |
| 1917 | <b>Note</b> that the above variables may be present even if the user was |
| 1918 | authenticated by a mechanism <i>other than publickey authentication</i>. This |
| 1919 | is intentional; the logs may be used to help troubleshoot <i>failed</i> |
| 1920 | authentication attempts, as well as successful authentications. |
| 1921 | |
| 1922 | <p> |
| 1923 | These values are also available in the <code>session.notes</code> table, |
| 1924 | under keys of the names above. These note variables are intended for |
| 1925 | informational purposes, <i>e.g.</i> <code>ExtendedLog</code> or |
| 1926 | <code>SQLLog</code> directives via the <code>%{note:...}</code> syntax. |
| 1927 | |
| 1928 | <p><a name="UsageRFC4716Format"> |
| 1929 | <b>SSH2 Public Key Formats</b><br> |
| 1930 | SSH2 uses public keys for authentication and message protection. The very |
| 1931 | popular OpenSSH server uses a particular file format for storing public |
| 1932 | keys in files. However, that format is not portable; it uses a format very |
| 1933 | specific to OpenSSH. Thus the <code>mod_sftp</code> module uses a different |
| 1934 | format for public keys, specifically, the format specified in |
| 1935 | <a href="http://www.faqs.org/rfcs/rfc4716.html">RFC 4716</a>. The hope |
| 1936 | is that this format is more interoperable with other SSH2/SFTP implementations. |
| 1937 | |
| 1938 | <p> |
| 1939 | This means that if you wish to use your OpenSSH public keys with the |
| 1940 | <code>mod_sftp</code> module, you will need to convert them from OpenSSH's |
| 1941 | format to the RFC4716 format. Fortunately, this is supported by |
| 1942 | OpenSSH's <code>ssh-keygen</code> utility, <i>e.g.</i>: |
| 1943 | <pre> |
| 1944 | $ ssh-keygen -e -f ~/.ssh/id_rsa.pub -m RFC4716 |
| 1945 | </pre> |
| 1946 | The output from this command can be added to the |
| 1947 | <code>SFTPAuthorizedUserKeys</code> used by <code>mod_sftp</code>. |
| 1948 | |
| 1949 | <p> |
| 1950 | Now that <code>mod_sftp</code> supports FIDO security keys, it is possible |
| 1951 | to configure policy requirements for a given key, using the RFC4716 format. |
| 1952 | For example, you might generate a FIDO security key using OpenSSH that does |
| 1953 | not require touching the authenticator, using <i>e.g.</i>: |
| 1954 | <pre> |
| 1955 | $ ssh-keygen -t edcsa-sk -O no-touch-required -f ./id_ecdsa_sk |
| 1956 | </pre> |
| 1957 | You then export that public key to the RFC 4716 format, for use by |
| 1958 | <code>mod_sftp</code>: |
| 1959 | <pre> |
| 1960 | $ ssh-keygen -e -f ./id_ecdsa_sk.pub -m RFC4716 |
| 1961 | ---- BEGIN SSH2 PUBLIC KEY ---- |
| 1962 | Comment: "256-bit ECDSA-SK, converted by ... from OpenSSH" |
| 1963 | AAAAInNrLWVjZHNhLXNoYTItbmlzdHAyNTZAb3BlbnNzaC5jb20AAAAIbmlzdHAyNTYAAA |
| 1964 | ... |
| 1965 | ---- END SSH2 PUBLIC KEY ---- |
| 1966 | </pre> |
| 1967 | Now you can manually add more headers, underneath <code>Comment:</code>, |
| 1968 | to indicate whether this key requires proof of user presence ("touch required"), |
| 1969 | and/or proof of user verification ("verify required"). How? Using the |
| 1970 | custom <code>X-FIDO-Touch-Required</code> and |
| 1971 | <code>X-FIDO-Verify-Required</code> headers supported by <code>mod_sftp</code>: |
| 1972 | </pre> |
| 1973 | ---- BEGIN SSH2 PUBLIC KEY ---- |
| 1974 | Comment: "256-bit ECDSA-SK, converted by ... from OpenSSH" |
| 1975 | x-fido-touch-required: false |
| 1976 | AAAAInNrLWVjZHNhLXNoYTItbmlzdHAyNTZAb3BlbnNzaC5jb20AAAAIbmlzdHAyNTYAAA |
| 1977 | ... |
| 1978 | ---- END SSH2 PUBLIC KEY ---- |
| 1979 | </pre> |
| 1980 | The values for these headers are expected to be Boolean values. |
| 1981 | |
| 1982 | <p> |
| 1983 | These <code>X-FIDO-Touch-Required</code>, <code>X-FIDO-Verify-Required</code> |
| 1984 | headers are handled in a case-insensitive manner, per RFC. These headers are |
| 1985 | only applied to keys that use the FIDO authenticator algorithms "ecdsa-sk" and |
| 1986 | "ed25519-sk", and are ignored for other keys. |
| 1987 | |
| 1988 | <p> |
| 1989 | <b>Note</b> that the RFC4716 format is <b>not</b> to be used with the |
| 1990 | <code>SFTPHostKey</code> directive. Even though OpenSSH's host keys have |
| 1991 | ".pub" public equivalents, host keys are different from the per-user keys |
| 1992 | that are used for authentication. |
| 1993 | |
| 1994 | <p><a name="ClientIssues"></a> |
| 1995 | <b>Known Client Issues</b><br> |
| 1996 | The following lists some of the various client interoperability issues that |
| 1997 | have been encountered, and how to address them. |
| 1998 | |
| 1999 | <p> |
| 2000 | <i>SSH Channel Window Sizes</i><br> |
| 2001 | Some SFTP client implementations do not support the large SSH channel window |
| 2002 | size that the <code>mod_sftp</code> module uses by default. These clients |
| 2003 | include: |
| 2004 | <ul> |
| 2005 | <li><a href="http://www.ipswitch.com/WS_FTP">WS_FTP Pro</a> |
| 2006 | <li>OpenSSH 3.0 and older |
| 2007 | <li><a href="http://www.axway.com">Axway</a> |
| 2008 | </ul> |
| 2009 | This <a href="#SFTPBadWindowSize">FAQ</a> describes the configuration to use |
| 2010 | for such clients. |
| 2011 | |
| 2012 | <p> |
| 2013 | <i>SSH Protocol Version</i><br> |
| 2014 | If you are using an old ssh.com client, or perhaps a client which derives |
| 2015 | from the ssh.com (or Tectia) code, you may see the following error in the |
| 2016 | <code>SFTPLog</code> when trying to connect to <code>mod_sftp</code>: |
| 2017 | <pre> |
| 2018 | Bad protocol version 'SSH-1.99-3.2.9.1 SSH Secure Shell (non-commercial)' from <i>x.x.x.x</i> |
| 2019 | </pre> |
| 2020 | To support such clients in <code>mod_sftp</code>, use |
| 2021 | <a href="#SFTPOptions"><code>SFTPOptions</code></a> to enable compatibility with |
| 2022 | older protocol versions, <i>e.g.</i>: |
| 2023 | <pre> |
| 2024 | <font color=green># Support old ssh.com/Tectia clients</font> |
| 2025 | SFTPOptions OldProtocolCompat |
| 2026 | </pre> |
| 2027 | |
| 2028 | <p> |
| 2029 | <i>SFTP Protocol Versions</i><br> |
| 2030 | Some SFTP clients do not properly handle some of the newer SFTP protocol |
| 2031 | versions. These clients include: |
| 2032 | <ul> |
| 2033 | <li><a href="http://winscp.net/">WinSCP</a> |
| 2034 | <li><a href="http://www.cuteftp.com/products/ftp_clients.aspx">CuteFTP</a> |
| 2035 | </ul> |
| 2036 | For these clients, use a |
| 2037 | <a href="#SFTPClientMatch"><code>SFTPClientMatch</code></a> rule to restrict |
| 2038 | the SFTP protocol versions offered by the <code>mod_sftp</code> module, |
| 2039 | <i>e.g.</i>: |
| 2040 | <pre> |
| 2041 | <font color=green># Only support SFTP protocol version 1 through 3 for WinSCP and CuteFTP</font> |
| 2042 | SFTPClientMatch WinSCP|ClientSftp sftpProtocolVersion 1-3 |
| 2043 | </pre> |
| 2044 | |
| 2045 | <p> |
| 2046 | <i><code>KEXINIT</code> Optimization</i><br> |
| 2047 | Some SFTP clients do not like this |
| 2048 | <a href="#SFTPTelnetBanner">KEXINIT optimization</a> that the |
| 2049 | <code>mod_sftp</code> module uses. These clients include: |
| 2050 | <ul> |
| 2051 | <li><code>Net::SSH::Perl</code>, <code>Net::SFTP</code> Perl modules |
| 2052 | <li><a href="http://www.enterprisedt.com/products/edtftpj/">edtFTPj</a> |
| 2053 | </ul> |
| 2054 | For these clients, use this configuration to disable the optimization: |
| 2055 | <pre> |
| 2056 | <font color=green># Disable the KEXINIT optimization at the cost of latency</font> |
| 2057 | SFTPOptions PessimisticKexinit |
| 2058 | </pre> |
| 2059 | |
| 2060 | <p> |
| 2061 | <i>Cipher Implementations</i><br> |
| 2062 | Some SFTP clients (most notably the SecureBlackBox libraries) do not implement |
| 2063 | the <code>blowfish-ctr</code> cipher correctly. If your site needs to |
| 2064 | support such clients, then you will need to use the |
| 2065 | <a href="#SFTPCiphers"><code>SFTPCiphers</code></a> directive to configure |
| 2066 | a list of ciphers which does <b>not</b> include <code>blowfish-ctr</code>. |
| 2067 | Clients with this bug will show up in the <code>SFTPLog</code> with this |
| 2068 | log message: |
| 2069 | <pre> |
| 2070 | client sent buggy/malicious packet payload length, ignoring |
| 2071 | </pre> |
| 2072 | <b>However</b>, this log message can also be caused by other factors. It |
| 2073 | is the combination of this error message, <b>and</b> the negotiation of |
| 2074 | the <code>blowfish-ctr</code> cipher, that indicates the use of these |
| 2075 | buggy clients. |
| 2076 | |
| 2077 | <p><a name="ClientMatches"></a> |
| 2078 | <b>Recommended <code>SFTPClientMatch</code> Settings</b><br> |
| 2079 | Based on the above client issues, the following is the recommended list of |
| 2080 | configurations -- contributed by the <a href="https://forums.proftpd.org/smf/index.php/topic,4616.0/all.html">ProFTPD community</a> -- to use as workarounds |
| 2081 | for all of the clients' known issues: |
| 2082 | <pre> |
| 2083 | <IfModule mod_sftp.c> |
| 2084 | <Global> |
| 2085 | # The default values used by mod_sftp are: |
| 2086 | # channelPacketSize 32KB |
| 2087 | # channelWindowSize 4GB |
| 2088 | # sftpProtocolVersion 1-6 |
| 2089 | |
| 2090 | # Axway (SSH-2.0-XFB.Gateway Unix) |
| 2091 | SFTPClientMatch .*Axway channelWindowSize 1GB |
| 2092 | SFTPClientMatch ".*XFB.*" channelWindowSize 1GB |
| 2093 | |
| 2094 | # CoreFTP LE (free version 2.2) |
| 2095 | SFTPClientMatch CoreFTP channelWindowSize 1GB |
| 2096 | |
| 2097 | # CuteFTPPro8 |
| 2098 | SFTPClientMatch ".*ClientSftp" sftpProtocolVersion 3 |
| 2099 | |
| 2100 | # Network Automation (SSH-2.0-EldoS.SSHBlackbox.3) |
| 2101 | # http://www.networkautomation.com/ |
| 2102 | SFTPClientMatch ".*EldoS.SSHBlackbox.3.*" channelWindowSize 1GB sftpProtocolVersion 3 |
| 2103 | |
| 2104 | # GlobalScape FTP application (SSH2 client 'GSSFTP1.0') - (needs v2) |
| 2105 | # http://www.globalscape.com/downloads/ |
| 2106 | # GoAnywhere (SSH-2.0-1.0) |
| 2107 | # http://www.goanywheremft.com/products |
| 2108 | SFTPClientMatch "1.0" channelWindowSize 1GB sftpProtocolVersion 2 |
| 2109 | |
| 2110 | # JaSFtp (SSH-2.0-J2SSH_Maverick_1.2.10_Sterling Commerce) |
| 2111 | # http://www.hiteksoftware.com/jasf/ |
| 2112 | SFTPClientMatch ".*J2SSH_Maverick.*" channelWindowSize 1GB |
| 2113 | |
| 2114 | # JSch - Java Secure Channel (SSH-2.0-JSCH-0.1.39) |
| 2115 | # http://www.jcraft.com/jsch/ |
| 2116 | SFTPClientMatch "JSCH.*" channelWindowSize 1GB |
| 2117 | |
| 2118 | # Robo-FTP (SSH-2.0-WeOnlyDo) |
| 2119 | # http://www.robo-ftp.com/ |
| 2120 | SFTPClientMatch ".*WeOnlyDo.*" channelWindowSize 1GB sftpProtocolVersion 3 |
| 2121 | |
| 2122 | # SecureBlackbox (SSH-2.0-SecureBlackbox.7) |
| 2123 | # http://www.eldos.com/sbb/download-release.php |
| 2124 | SFTPClientMatch ".*SecureBlackbox.*" sftpProtocolVersion 3 |
| 2125 | |
| 2126 | # SecureFX - SSH2 client 'SecureFX_2_2_5_225 SecureFX' |
| 2127 | # http://www.vandyke.com/products/securefx/ |
| 2128 | SFTPClientMatch "SecureFX.*" sftpProtocolVersion 3 |
| 2129 | |
| 2130 | # SSH-2.0-1.30 |
| 2131 | SFTPClientMatch "1.30" channelPacketSize 16KB channelWindowSize 256MB |
| 2132 | |
| 2133 | # SSH-2.0-Sun_SSH_1.0.1 |
| 2134 | SFTPClientMatch ".*Sun_SSH.*" channelWindowSize 1GB |
| 2135 | |
| 2136 | # SSH-2.0-SharpSSH-1.1.1.13-JSCH-0.1.28 |
| 2137 | SFTPClientMatch ".*SharpSSH.*" channelWindowSize 256MB |
| 2138 | |
| 2139 | # WinSCP |
| 2140 | SFTPClientMatch ".*WinSCP.*" sftpProtocolVersion 3 |
| 2141 | |
| 2142 | # WS_FTP |
| 2143 | SFTPClientMatch ".*WS_FTP.*" channelWindowSize 1GB |
| 2144 | |
| 2145 | # /n Software BizTalk SFTP Receive (SSH-2.0-IP*Works! SSH Client v8.0) |
| 2146 | # http://www.nsoftware.com/products/biztalk/adapters/sftp.aspx |
| 2147 | SFTPClientMatch ".*IP.Works.*" channelWindowSize 1GB |
| 2148 | </Global> |
| 2149 | </IfModule> |
| 2150 | </pre> |
| 2151 | |
| 2152 | <p> |
| 2153 | <b>FIPS Compliance</b><br> |
| 2154 | FIPS stands for "Federal Information Processing Standard", and refers to |
| 2155 | a series of information processing standards issued and used by the US |
| 2156 | government. When speaking of FIPS and cryptographic software, the pertinent |
| 2157 | standard in particular is |
| 2158 | <a href="http://en.wikipedia.org/wiki/FIPS_140">FIPS-140</a>. |
| 2159 | |
| 2160 | <p> |
| 2161 | How then would you build OpenSSL and <code>mod_sftp</code>, and use them |
| 2162 | such that <code>mod_sftp</code> would be FIPS-compliant? Using OpenSSL in |
| 2163 | FIPS mode requires quite a few steps. First, you would configure |
| 2164 | <code>proftpd</code> to use the <code>mod_sftp</code> module as normal, |
| 2165 | assuming your OpenSSL installation has been compiled with FIPS support: |
| 2166 | <pre> |
| 2167 | ./configure --enable-openssl --with-modules=mod_sftp ... |
| 2168 | </pre> |
| 2169 | |
| 2170 | <p> |
| 2171 | Compiling <code>proftpd</code> requires the following, for FIPS support |
| 2172 | to work properly: |
| 2173 | <pre> |
| 2174 | make CC=<em>/path/to/openssl/bin/</em>fipsld FIPSLD_CC=<em>gcc</em> |
| 2175 | </pre> |
| 2176 | The <code>FIPSLD_CC</code> variable should point to your normal C compiler, |
| 2177 | <i>e.g.</i> <code>gcc</code>. The use of this <code>fipsld</code> program |
| 2178 | is <b>mandatory</b>. The FIPS standard requires that the linking process |
| 2179 | happen a very specific way, involving verification of calculated and expected |
| 2180 | checksums of compiled code, <i>etc</i>. The OpenSSL packages with FIPS |
| 2181 | support supply this <code>fipsld</code> program which will link the compiled |
| 2182 | code according to the FIPS specifications. <i>If you do not use |
| 2183 | <code>fipsld</code>, then attempts to use OpenSSL in FIPS mode will fail.</i> |
| 2184 | For example, you would see the following if starting a <code>proftpd</code> |
| 2185 | daemon which has not been linked using <code>fipsld</code> while requesting |
| 2186 | use of FIPS: |
| 2187 | <pre> |
| 2188 | - mod_sftp/0.0: unable to use FIPS mode: (unknown) |
| 2189 | - Fatal: unable to load module 'mod_sftp.c': Operation not permitted |
| 2190 | </pre> |
| 2191 | |
| 2192 | <p> |
| 2193 | Now, assuming you have compiled and installed your <code>proftpd</code> |
| 2194 | properly, <i>e.g.</i>: |
| 2195 | <pre> |
| 2196 | make CC=<em>/path/to/openssl/bin/</em>fipsld FIPSLD_CC=<em>gcc</em> |
| 2197 | make CC=<em>/path/to/openssl/bin/</em>fipsld FIPSLD_CC=<em>gcc</em> install |
| 2198 | </pre> |
| 2199 | you will now be ready to start <code>proftpd</code>. |
| 2200 | |
| 2201 | <p> |
| 2202 | In order for FIPS mode to be effective, OpenSSL must be told to run in FIPS |
| 2203 | mode from the very beginning. The <code>mod_sftp</code> module initializes the |
| 2204 | OpenSSL library when the <code>mod_sftp</code> module is loaded, <i>before the |
| 2205 | <code>proftpd.conf</code> file is parsed</i>. Thus the requesting of FIPS mode |
| 2206 | <b>cannot</b> be done via a setting in <code>proftpd.conf</code>. (Annoying, |
| 2207 | I know.) |
| 2208 | |
| 2209 | <p> |
| 2210 | Instead, you must use the -D command-line parameter when starting |
| 2211 | <code>proftpd</code> (see the docs for the <code><IfDefine></code> and |
| 2212 | <code>Define</code> directives) to define a specific variable, which the |
| 2213 | <code>mod_sftp</code> module will look for. Specifically, you will need to |
| 2214 | start <code>proftpd</code> like thus: |
| 2215 | <pre> |
| 2216 | /path/to/proftpd -DSFTP_USE_FIPS ... |
| 2217 | </pre> |
| 2218 | This will define the <code>SFTP_USE_FIPS</code> variable; this tells |
| 2219 | <code>mod_sftp</code> to initialize OpenSSL using FIPS mode. When this works, |
| 2220 | you will see the following when <code>proftpd</code> starts up: |
| 2221 | <pre> |
| 2222 | - mod_sftp/0.0: FIPS mode enabled |
| 2223 | </pre> |
| 2224 | |
| 2225 | <p> |
| 2226 | When <code>mod_sftp</code> detects that OpenSSL has been configured for FIPS |
| 2227 | mode, it will refuse to advertise support for the following cipher algorithms: |
| 2228 | <ul> |
| 2229 | <li><code>arcfour128</code> |
| 2230 | <li><code>arcfour256</code> |
| 2231 | <li><code>blowfish-cbc</code> |
| 2232 | <li><code>blowfish-ctr</code> |
| 2233 | <li><code>cast128-cbc</code> |
| 2234 | </ul> |
| 2235 | and for the following digest algorithms: |
| 2236 | <ul> |
| 2237 | <li><code>hmac-md5</code> |
| 2238 | <li><code>hmac-md5-96</code> |
| 2239 | <li><code>hmac-ripemd160</code> |
| 2240 | </ul> |
| 2241 | as these algorithms are not compliant with the FIPS specification. |
| 2242 | |
| 2243 | <p> |
| 2244 | For additional reading on OpenSSL and FIPS, see: |
| 2245 | <pre> |
| 2246 | <a href="http://www.openssl.org/docs/fips/SecurityPolicy-1.1.1.pdf">http://www.openssl.org/docs/fips/SecurityPolicy-1.1.1.pdf</a> |
| 2247 | <a href="http://www.openssl.org/docs/fips/UserGuide-1.1.1.pdf">http://www.openssl.org/docs/fips/UserGuide-1.1.1.pdf</a> |
| 2248 | </pre> |
| 2249 | |
| 2250 | <p> |
| 2251 | <b>Example Configuration</b><br> |
| 2252 | When using <code>mod_sftp</code> to handle SFTP connections, you will want |
| 2253 | to create a separate <code><VirtualHost></code> section for the |
| 2254 | <code>mod_sftp</code> configuration. SSH2 (and thus SFTP) requires a different |
| 2255 | port than FTP; in order to listen on different ports, <code>proftpd</code> |
| 2256 | requires different <code><VirtualHost></code> sections. You can have |
| 2257 | multiple <code><VirtualHost></code> sections for the same <i>address</i> |
| 2258 | (IP address or DNS name), just different <code>Port</code> directives. |
| 2259 | <pre> |
| 2260 | <IfModule mod_sftp.c> |
| 2261 | <VirtualHost <i>a.b.c.d</i>> |
| 2262 | SFTPEngine on |
| 2263 | SFTPLog /etc/proftpd/sftp/sftp.log |
| 2264 | |
| 2265 | # Configure the server to listen on the normal SSH2 port, port 22 |
| 2266 | Port 22 |
| 2267 | |
| 2268 | # Configure the RSA, DSA, and ECDSA host keys, using the same host key |
| 2269 | # files that OpenSSH uses. |
| 2270 | SFTPHostKey /etc/ssh_host_rsa_key |
| 2271 | SFTPHostKey /etc/ssh_host_dsa_key |
| 2272 | SFTPHostKey /etc/ssh_host_ecdsa_key |
| 2273 | |
| 2274 | # Configure the file used for comparing authorized public keys of users. |
| 2275 | SFTPAuthorizedUserKeys file:~/.sftp/authorized_keys |
| 2276 | |
| 2277 | # Enable compression |
| 2278 | SFTPCompression delayed |
| 2279 | |
| 2280 | # Allow the same number of authentication attempts as OpenSSH. |
| 2281 | # |
| 2282 | # It is recommended that you explicitly configure MaxLoginAttempts |
| 2283 | # for your SSH2/SFTP instance to be higher than the normal |
| 2284 | # MaxLoginAttempts value for FTP, as there are more ways to authenticate |
| 2285 | # using SSH2. |
| 2286 | MaxLoginAttempts 6 |
| 2287 | |
| 2288 | </VirtualHost> |
| 2289 | </IfModule> |
| 2290 | </pre> |
| 2291 | |
| 2292 | <p> |
| 2293 | <b>Logging</b><br> |
| 2294 | The <code>mod_sftp</code> module supports different forms of logging. The |
| 2295 | main module logging is done via the <code>SFTPLog</code> directive. For |
| 2296 | debugging purposes, the module also uses <a href="../howto/Tracing.html">trace logging</a>, via the module-specific log channels: |
| 2297 | <ul> |
| 2298 | <li>ssh2 |
| 2299 | <li>sftp |
| 2300 | <li>scp |
| 2301 | </ul> |
| 2302 | Thus for trace logging, to aid in debugging, you would use the following in |
| 2303 | your <code>proftpd.conf</code>: |
| 2304 | <pre> |
| 2305 | TraceLog /path/to/sftp-trace.log |
| 2306 | Trace scp:20 sftp:20 ssh2:20 |
| 2307 | </pre> |
| 2308 | This trace logging can generate large files; it is intended for debugging |
| 2309 | use only, and should be removed from any production configuration. |
| 2310 | |
| 2311 | <p> |
| 2312 | <b>Suggested Future Features</b><br> |
| 2313 | The following lists the features I hope to add to <code>mod_sftp</code>, |
| 2314 | according to need, demand, inclination, and time: |
| 2315 | <ul> |
| 2316 | <li>Look up authorized public keys from LDAP directories |
| 2317 | <li>Honor the <code>MaxTransferPerHost</code>, |
| 2318 | <code>MaxTransfersPerUser</code>, <code>MaxRetrieveFileSize</code> |
| 2319 | directives |
| 2320 | </ul> |
| 2321 | |
| 2322 | <p><a name="FAQ"> |
| 2323 | <b>Frequently Asked Questions</b><br> |
| 2324 | |
| 2325 | <p><a name="SFTPTelnetBanner"> |
| 2326 | <font color=red>Question</font>: When I telnet to port 22 of other SSH2 servers, |
| 2327 | I see the SSH2 version banner displayed, <i>e.g.</i>: |
| 2328 | <pre> |
| 2329 | # telnet example.com 22 |
| 2330 | Trying 1.2.3.4... |
| 2331 | Connected to example.com. |
| 2332 | Escape character is '^]'. |
| 2333 | SSH-1.99-OpenSSH_5.1 |
| 2334 | </pre> |
| 2335 | However, when I telnet to the port on which <code>mod_sftp</code> is listening, |
| 2336 | I see the version banner plus some data which can't be rendered in the terminal. |
| 2337 | What is that extra data?<br> |
| 2338 | <font color=blue>Answer</font>: The short answer is that <code>mod_sftp</code> |
| 2339 | is pre-emptively sending the first key exchange data; it is this data which is |
| 2340 | not displayed well. |
| 2341 | |
| 2342 | <p> |
| 2343 | This pre-emptive sending of the first key exchange message is an optimization. |
| 2344 | The SSH2 protocol (and many SSH2 servers) start off doing: |
| 2345 | <pre> |
| 2346 | (1) <i>client</i> ------------ connect -------------> <i>server</i> |
| 2347 | (2) <i>client</i> <-------- version banner ---------- <i>server</i> |
| 2348 | (3) <i>client</i> --- client's first key exchange --> <i>server</i> |
| 2349 | (4) <i>client</i> <-- server's first key exchange --- <i>server</i> |
| 2350 | </pre> |
| 2351 | So you can see that there's some back and forth. The "first key exchange" |
| 2352 | messages sent by the client are always the same for that client, likewise the |
| 2353 | server always sends the same "first key exchange" message (based on its |
| 2354 | configuration). So the above has several TCP packets and ACKs that need to be |
| 2355 | sent back and forth. |
| 2356 | |
| 2357 | <p> |
| 2358 | The <code>mod_sftp</code> module avoids one unnecessary TCP packet+ACK by |
| 2359 | sending its version banner and its first key exchange message in the same TCP |
| 2360 | packet: |
| 2361 | <pre> |
| 2362 | (1) <i>client</i> ------------ connect -------------> <i>server</i> |
| 2363 | (2) <i>client</i> <-- version banner/1st key exch---- <i>server</i> |
| 2364 | (3) <i>client</i> --- client's first key exchange --> <i>server</i> |
| 2365 | </pre> |
| 2366 | This helps cut down on the latency during startup, since <code>mod_sftp</code> |
| 2367 | saves on one TCP round-trip time. |
| 2368 | |
| 2369 | <p> |
| 2370 | This optimization was added after reading this informative paper on SSH and |
| 2371 | SSL/TLS by Peter Gutmann: |
| 2372 | <pre> |
| 2373 | <a href="http://www.cs.auckland.ac.nz/~pgut001/pubs/app_sec.pdf">Performance Characteristics of Application-level Security Protocols</a> |
| 2374 | </pre> |
| 2375 | |
| 2376 | <p><a name="SFTPBadWindowSize"> |
| 2377 | <font color=red>Question</font>: My SSH2/SFTP client dies when trying to |
| 2378 | connect to <code>mod_sftp</code>. The login succeeds, but then the client |
| 2379 | is disconnected. The client logs show something like: |
| 2380 | <pre> |
| 2381 | ServerMaxPacket(32768) ServerWindow(-1) (<i>from WS_FTP</i>) |
| 2382 | </pre> |
| 2383 | or |
| 2384 | <pre> |
| 2385 | debug1: channel 0: open confirm rwindow -1 rmax 32768 (<i>from OpenSSH_3.0.2p1</i>) |
| 2386 | </pre> |
| 2387 | <font color=blue>Answer</font>: The issue, in short, involves that "-1" value |
| 2388 | you see, and the particular client implementation in question. (The example |
| 2389 | error above is from an old OpenSSH client.) |
| 2390 | |
| 2391 | <p> |
| 2392 | The SSH2 protocol specifications say that implementations must encode |
| 2393 | the SSH2 channel "window size" as a 32-bit unsigned number. This means that |
| 2394 | the maximum window size is effectively 4294967295 (<i>i.e.</i> 2 ^ 32 - 1). |
| 2395 | This maximum window size is what <code>mod_sftp</code> uses by default. |
| 2396 | However, some client implementations use a <i>signed</i> data type for |
| 2397 | holding this value. This means that the value that <code>mod_sftp</code> |
| 2398 | sends to the client becomes a negative signed number to the client (the |
| 2399 | large value "wraps around" to the negative value), and the client chokes. |
| 2400 | |
| 2401 | <p> |
| 2402 | As another example, the <a href="http://www.ipswitch.com/WS_FTP">WS_FTP Pro</a> |
| 2403 | client has this same problem; in the client, you will see something like |
| 2404 | the following error: |
| 2405 | <pre> |
| 2406 | Started subsystem "sftp" on channel 0760a2ce |
| 2407 | error 84350000 initializing sftp protocol |
| 2408 | Sending channel close message for channel 0760a2ce |
| 2409 | SSH Transport closed. |
| 2410 | </pre> |
| 2411 | |
| 2412 | <p> |
| 2413 | There are two approaches for handling such cases. You can use the |
| 2414 | <a href="#SFTPClientMatch"><code>SFTPClientMatch</code></a> directive to |
| 2415 | set a smaller channel window size for that particular client, <i>e.g.</i>: |
| 2416 | <pre> |
| 2417 | SFTPClientMatch ".*WS_FTP.*" channelWindowSize 256MB |
| 2418 | SFTPClientMatch ".*Axway" channelWindowSize 256MB |
| 2419 | </pre> |
| 2420 | or you can use <code>SFTPClientMatch</code> to set a general channel window |
| 2421 | size for all clients: |
| 2422 | <pre> |
| 2423 | SFTPClientMatch .* channelWindowSize 256MB |
| 2424 | </pre> |
| 2425 | |
| 2426 | <p> |
| 2427 | The larger the channel window size, the better. (Note that the SSH2 channel |
| 2428 | window size has absolutely <b>no</b> relation to the TCP window size.) |
| 2429 | The smaller this SSH2 channel window size, the more frequently the peer needs |
| 2430 | to send a "window size adjustment" SSH2 request (which entails its own TCP |
| 2431 | packet and ACK) in order to keep the window size open. The larger the channel |
| 2432 | window size, the fewer "window size adjustment" requests the peer has to send, |
| 2433 | and thus the fewer TCP packets/ACKs are needed. Since each TCP packet adds |
| 2434 | latency, the smaller channel window sizes can increase the latency for data |
| 2435 | transfers. |
| 2436 | |
| 2437 | <p> |
| 2438 | For this reason, my personal recommendation is to only set smaller channel |
| 2439 | window sizes for those SSH2/SFTP clients which need it; no need to incur |
| 2440 | the additional latency if the client supports the larger window sizes. |
| 2441 | |
| 2442 | <p><a name="SFTPSubsystem"> |
| 2443 | <font color=red>Question</font>: Can I configure <code>mod_sftp</code> to be |
| 2444 | an OpenSSH subsystem, <i>e.g.</i> by using the following in my |
| 2445 | <code>sshd_config</code> file: |
| 2446 | <pre> |
| 2447 | Subsystem sftp /usr/local/sbin/proftpd |
| 2448 | </pre> |
| 2449 | <font color=blue>Answer</font>: No. The <code>mod_sftp</code> module cannot |
| 2450 | be used as an OpenSSH subsystem because proftpd needs more information about |
| 2451 | the session than is provided to OpenSSH subsystems. ProFTPD needs to know all |
| 2452 | of the information about the authenticated user, the SSH2 channel IDs being |
| 2453 | used for the SFTP/SCP sessions, <i>etc</i>. |
| 2454 | |
| 2455 | <p><a name="SFTPAndFTP"> |
| 2456 | <font color=red>Question</font>: How can I configure <code>proftpd</code> |
| 2457 | so that it can handle both FTP and SFTP at the same time?<br> |
| 2458 | <font color=blue>Answer</font>: The key to doing this is to create a |
| 2459 | <code><VirtualHost></code> section just for the <code>mod_sftp</code> |
| 2460 | configuration, listening on the address and port that you wish, <i>e.g.</i>: |
| 2461 | <pre> |
| 2462 | # The FTP configuration |
| 2463 | DefaultAddress <i>a.b.c.d</i> |
| 2464 | Port 21 |
| 2465 | |
| 2466 | <IfModule mod_sftp.c> |
| 2467 | <VirtualHost <i>a.b.c.d</i>> |
| 2468 | # The SFTP configuration |
| 2469 | Port 22 |
| 2470 | |
| 2471 | SFTPEngine on |
| 2472 | ... |
| 2473 | </VirtualHost> |
| 2474 | </IfModule> |
| 2475 | </pre> |
| 2476 | <b>Note</b> that if you use the above configuration, and you wish to handle |
| 2477 | <b><i>any</i></b> address requested by incoming connections, use |
| 2478 | <code>0.0.0.0</code> as the <i>a.b.c.d</i> IP address. <code>0.0.0.0</code> |
| 2479 | is known as the "wildcard address", and indicates that ProFTPD wants to listen |
| 2480 | on any/all addresses, on those ports. |
| 2481 | |
| 2482 | <p><a name="SFTPOnly"> |
| 2483 | <font color=red>Question</font>: How can I configure <code>proftpd</code> |
| 2484 | so that it only accepts SFTP connections (via <code>mod_sftp</code>), and no |
| 2485 | FTP connections?<br> |
| 2486 | <font color=blue>Answer</font>: Use the following in your |
| 2487 | <code>proftpd.conf</code>: |
| 2488 | <pre> |
| 2489 | <Limit LOGIN> |
| 2490 | DenyAll |
| 2491 | </Limit> |
| 2492 | |
| 2493 | <VirtualHost <i>a.b.c.d</i>> |
| 2494 | <Limit LOGIN> |
| 2495 | AllowAll |
| 2496 | </Limit> |
| 2497 | |
| 2498 | SFTPEngine on |
| 2499 | ... |
| 2500 | </VirtualHost> |
| 2501 | </pre> |
| 2502 | The idea is to use the <code><Limit LOGIN></code> to deny all logins to |
| 2503 | any/all virtual host sections <i>except</i> for the <code>mod_sftp</code> |
| 2504 | section. |
| 2505 | |
| 2506 | <p><a name="SFTPAuthorizedKeyTooLong"> |
| 2507 | <font color=red>Question</font>: I followed the instructions to convert |
| 2508 | my authorized keys from OpenSSH to RFC4716 format, yet I see the following |
| 2509 | error in my <code>SFTPLog</code>: |
| 2510 | <pre> |
| 2511 | mod_sftp/0.9.7[31050]: line too long (74) on line 1 of '<i>authorized_keys</i>' |
| 2512 | </pre> |
| 2513 | What can I do to fix this?<br><br> |
| 2514 | <font color=blue>Answer</font>: OpenSSH's <code>ssh-keygen</code> tool had a |
| 2515 | bug where the RFC4716 keys it would generate might not comply to the RFC; see |
| 2516 | the <a href="https://bugzilla.mindrot.org/show_bug.cgi?id=1630">OpenSSH bug</a> |
| 2517 | filed for this issue. |
| 2518 | |
| 2519 | <p> |
| 2520 | Chances are that the offending line in the RFC4716 key is a "Comment: " header |
| 2521 | that is too long. Simply delete that "Comment: " line; the |
| 2522 | <code>mod_sftp</code> ignores this header. |
| 2523 | |
| 2524 | <p><a name="SFTPAuthorizedKeyFormat"> |
| 2525 | <font color=red>Question</font>: I generated an SSH key using |
| 2526 | <code>ssh-keygen</code>, then added it to my <code>authorized_keys</code> file |
| 2527 | using: |
| 2528 | <pre> |
| 2529 | $ cat id_rsa.pub >> authorized_keys |
| 2530 | </pre> |
| 2531 | But logging into <code>mod_sftp</code> still prompts me for my password. |
| 2532 | Why?<br> |
| 2533 | <font color=blue>Answer</font>: The most likely culprit is that the format |
| 2534 | of your <code>authorized_keys</code> file is not what <code>mod_sftp</code> |
| 2535 | expects. |
| 2536 | |
| 2537 | Per the <a href="#SFTPAuthorizedUserKeys"><code>SFTPAuthorizedUserKeys</code></a> documentation, <code>mod_sftp</code> expects that the keys be in RFC 4716 |
| 2538 | format. If your <code>authorized_keys</code> file contains data that looks |
| 2539 | like this: |
| 2540 | <pre> |
| 2541 | ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDN1tCK5uHUGl.... |
| 2542 | </pre> |
| 2543 | rather than looking like this: |
| 2544 | <pre> |
| 2545 | ---- BEGIN SSH2 PUBLIC KEY ---- |
| 2546 | AAAAB3NzaC1yc2EAAAADAQABAAABAQDN1tCK5uHUGlpxye+KEmB0EIr9zqvMmgyNdWvJBW |
| 2547 | ... |
| 2548 | PZ1+hOi5QECWQYD0BpiWvj |
| 2549 | ---- END SSH2 PUBLIC KEY ---- |
| 2550 | </pre> |
| 2551 | Then the format of some of the keys in your <code>authorized_keys</code> file |
| 2552 | is wrong. Make sure that you convert your OpenSSH-generated keys to RFC 4716 |
| 2553 | format using <code>ssh-keygen</code>, <em>before</em> adding it to your |
| 2554 | <code>authorized_keys</code> file, using something like this: |
| 2555 | <pre> |
| 2556 | $ ssh-keygen -e -f ~/.ssh/id_rsa.pub -m RFC4716 >> authorized_keys |
| 2557 | </pre> |
| 2558 | See the <a href="#UsageRFC4716Format">Usage</a> documentation for more |
| 2559 | information. |
| 2560 | |
| 2561 | <p><a name="SFTPBrokenMaxFileSize"> |
| 2562 | <font color=red>Question</font>: I'm using the <a href="../modules/mod_xfer.html"><code>MaxStoreFileSize</code></a> directive in my <code>mod_sftp</code> |
| 2563 | configuration, but when I upload a file using <i>e.g.</i> OpenSSH's |
| 2564 | <code>sftp</code> client, I see the file uploaded past my configured limit. Is |
| 2565 | this a bug?<br> |
| 2566 | <font color=blue>Answer</font>: No. The <code>mod_sftp</code> module honors |
| 2567 | a configured <code>MaxStoreFileSize</code> limit properly. <i>However</i>, |
| 2568 | what you see <i>in the SFTP client</i> may not reflect this as you would expect. |
| 2569 | Some SFTP clients, like that from OpenSSH, will only reflect the failure |
| 2570 | <i>after the entire file has been uploaded</i>: |
| 2571 | <pre> |
| 2572 | sftp> put /path/to/file.dat |
| 2573 | Uploading /path/to/file.dat to /file.dat |
| 2574 | /path/to/file.dat 100% 704KB 704.1KB/s 00:00 |
| 2575 | Couldn't write to remote file "/file.dat": Failure |
| 2576 | </pre> |
| 2577 | In the <code>SFTPLog</code> for the above situation, you would most likely |
| 2578 | see log messages about the SFTP <code>WRITE</code> requests being rejected: |
| 2579 | <pre> |
| 2580 | mod_sftp/0.9.9[32297]: error writing 32768 bytes to '/file.dat': File too large (MaxStoreFileSize 204800 exceeded) |
| 2581 | mod_sftp/0.9.9[32297]: error writing 32768 bytes to '/file.dat': File too large (MaxStoreFileSize 204800 exceeded) |
| 2582 | </pre> |
| 2583 | |
| 2584 | <p> |
| 2585 | <b>There is a discrepancy between what the client shows the user, and what the |
| 2586 | server is actually doing.</b> The <code>mod_sftp</code> module, when handling |
| 2587 | SFTP uploads, checks the size of the file on disk, after receiving the buffer |
| 2588 | of data from the network, but <i>before</i> writing that data to disk. If the |
| 2589 | size of the file on disk exceeds the <code>MaxStoreFileSize</code> limit, then |
| 2590 | that SFTP <code>WRITE</code> request is denied. |
| 2591 | |
| 2592 | <p> |
| 2593 | Many SFTP clients will send multiple SFTP <code>WRITE</code> requests |
| 2594 | concurrently, optimistically hoping that they will succeed; this makes for |
| 2595 | faster SFTP uploads. This is why you might see multiple "File too large" |
| 2596 | messages logged by <code>mod_sftp</code>. And it also means that the client |
| 2597 | <i>thinks</i> it has sent more data to the server than has actually been |
| 2598 | written to disk. |
| 2599 | |
| 2600 | <p> |
| 2601 | Now, this may lead you to ask "Due to SFTP protocol itself, there is no way to |
| 2602 | control the file size uploaded by a client, right?" This is not quite correct. |
| 2603 | |
| 2604 | <p> |
| 2605 | There's no way <em>for an SFTP server</em> to control how much data the |
| 2606 | SFTP client will send. But there <em>is</em> a way to control how much data is |
| 2607 | written to disk by the SFTP server; that is what <code>MaxStoreFileSize</code> |
| 2608 | does. But this means that the SFTP client may report how much data it sent |
| 2609 | over the network, which <b>is not the same</b> as how much data was actually |
| 2610 | stored by the SFTP server. Believing what your client shows you, though, is |
| 2611 | always suspect, since what the client shows may not actually reflect the |
| 2612 | reality of things on the server side of things. |
| 2613 | |
| 2614 | <p><a name="SFTPPCBCModeAttacks"> |
| 2615 | <font color=red>Question</font>: Is it true that using CBC mode ciphers in |
| 2616 | SSH is insecure?<br> |
| 2617 | <font color=blue>Answer</font>: It is true that there are a couple of published |
| 2618 | <i>theoretical</i> attacks against the SSH protocol when CBC ciphers are |
| 2619 | used, including Rogaway, Wai, and Bellare (see RFC 4251, Section 9.3.1) and |
| 2620 | <a href="http://www.cpni.gov.uk/Docs/Vulnerability_Advisory_SSH.txt">"Plaintext Recovery Attacks Against SSH"</a> (CPNI-957037). |
| 2621 | |
| 2622 | <p> |
| 2623 | However, these attacks can be mitigated by countermeasures in the SSH |
| 2624 | implementation. The use of <code>SSH_MSG_IGNORE</code> messages for the |
| 2625 | Rogaway attack, and the delayed checking of packet length fields until the MAC |
| 2626 | check has passed (and then reading in a random amount of additional data from |
| 2627 | the network) to migitate CPNI-957037, are both implemented within the |
| 2628 | <code>mod_sftp</code> module as security measures. |
| 2629 | |
| 2630 | <p><a name="SFTPListOptions"> |
| 2631 | <font color=red>Question</font>: I am trying to use <code>ListOptions</code> |
| 2632 | to change what is displayed for files in my SFTP clients, but it is not working. |
| 2633 | Why?<br> |
| 2634 | <font color=blue>Answer</font>: Unlike FTP, in SFTP it is the <i>client</i>, |
| 2635 | <b>not</b> the server, which determines what to display to the end user. |
| 2636 | Thus the <code>ListOptions</code> directive is not honored by |
| 2637 | <code>mod_sftp</code>. |
| 2638 | |
| 2639 | <p><a name="SFTPUploadChmod"> |
| 2640 | <font color=red>Question</font>: If I use a configuration like this: |
| 2641 | <pre> |
| 2642 | <Directory /path/to/upload> |
| 2643 | <Limit WRITE> |
| 2644 | AllowAll |
| 2645 | </Limit> |
| 2646 | |
| 2647 | <Limit SITE_CHMOD> |
| 2648 | DenyAll |
| 2649 | </Limit> |
| 2650 | </Directory> |
| 2651 | </pre> |
| 2652 | then why do my SFTP uploads fail, when the same configuration allows uploads to succeed using FTP?<br> |
| 2653 | <font color=blue>Answer</font>: When a file is uploaded using FTP, the only |
| 2654 | parts of the file uploaded are its <i>contents</i> but <b>not</b> the file |
| 2655 | <i>metadata</i> (<i>e.g.</i> not the file timestamps or permissions). Separate |
| 2656 | FTP commands are used to send the file metadata to the server. |
| 2657 | |
| 2658 | <p> |
| 2659 | However, the SFTP protocol sends the file metadata <i>as part of the normal upload</i>. In the configuration above, the limit on <code>SITE CHMOD</code> |
| 2660 | is being applied to the SFTP upload. If you do not want this, and want |
| 2661 | your SFTP uploads to be more like your FTP uploads, then you should use: |
| 2662 | <pre> |
| 2663 | SFTPOptions IgnoreSFTPUploadPerms |
| 2664 | </pre> |
| 2665 | in your <code>mod_sftp</code> configuration. |
| 2666 | |
| 2667 | <p><a name="SFTPOwner"> |
| 2668 | <font color=red>Question</font>: I use <code>UserOwner</code> and |
| 2669 | <code>GroupOwner</code> in my <code>mod_sftp</code> configuration, but they |
| 2670 | are not being applied properly. Is this a bug?<br> |
| 2671 | <font color=blue>Answer</font>: No. |
| 2672 | |
| 2673 | <p> |
| 2674 | By default, the <code>mod_sftp</code> module drops root privileges as soon |
| 2675 | as it can, which is just after the user has been authenticated. Without |
| 2676 | root privileges, <code>mod_sftp</code> cannot change the ownership of files |
| 2677 | uploaded via SFTP/SCP as per <code>UserOwner</code>/<code>GroupOwner</code> |
| 2678 | settings. |
| 2679 | |
| 2680 | <p> |
| 2681 | In ProFTPD 1.3.4rc1, honoring of the <code>UserOwner</code> and |
| 2682 | <code>GroupOwner</code> directives was added to the <code>mod_sftp</code> |
| 2683 | module. <b>However</b>, you will <i>also</i> need to add the following to your |
| 2684 | <code>mod_sftp</code> configuration to make them work properly: |
| 2685 | <pre> |
| 2686 | RootRevoke off |
| 2687 | </pre> |
| 2688 | This explicitly tells the <code>mod_sftp</code> to <b>not</b> drop root |
| 2689 | privileges after authentication, and instead to keep them for the duration |
| 2690 | of the session. |
| 2691 | |
| 2692 | <p> |
| 2693 | In addition, <b>if</b> you are on a Linux machine, you may <em>also</em> |
| 2694 | need to disable the <a href="../modules/mod_cap.html"><code>mod_cap</code></a> |
| 2695 | module, as that can also restrict what can be done with root privileges: |
| 2696 | <pre> |
| 2697 | <IfModule mod_cap.c> |
| 2698 | CapabilitiesEngine off |
| 2699 | </IfModule> |
| 2700 | </pre> |
| 2701 | |
| 2702 | <p><a name="SFTPShell"> |
| 2703 | <font color=red>Question</font>: Why can't I use <code>ssh</code> to connect |
| 2704 | to my proftpd+mod_sftp server? When I try, I see: |
| 2705 | <pre> |
| 2706 | # ssh <i>user</i>@<i>host</i> |
| 2707 | Enter passphrase for key '/home/<i>user</i>/.ssh/id_rsa': |
| 2708 | PTY allocation request failed on channel 0 |
| 2709 | shell request failed on channel 0 |
| 2710 | </pre> |
| 2711 | <font color=blue>Answer</font>: The <code>mod_sftp</code> module supports |
| 2712 | file transfers via SFTP and SCP. It does <b>not</b> support shell access, |
| 2713 | which is what the <code>ssh</code> command-line client tries to use. The |
| 2714 | above error messages from <code>ssh</code> show that <code>mod_sftp</code> |
| 2715 | refused the shell access requests. |
| 2716 | |
| 2717 | <p><a name="SFTPDirFakeUserGroup"> |
| 2718 | <font color=red>Question</font>: I am using <code>DirFakeUser</code> and |
| 2719 | <code>DirFakeGroup</code> in my <code>mod_sftp</code> configuration, but |
| 2720 | they do not work when I run the <code>ls -lh</code> command in the |
| 2721 | <code>sftp</code> command-line client. Is this a bug?<br><br> |
| 2722 | <font color=blue>Answer</font>: This is unfortunately an issue with OpenSSH's |
| 2723 | <code>sftp</code> command-line client. |
| 2724 | |
| 2725 | <p> |
| 2726 | The <code>mod_sftp</code> module always sends the same information for an |
| 2727 | SFTP directory listing, assuming SFTP protocol version 3 or lower (which is |
| 2728 | what OpenSSH uses); see <a href="https://github.com/proftpd/proftpd/blob/master/contrib/mod_sftp/fxp.c#L2801">here</a>. The <code>DirFakeUser</code> and |
| 2729 | <code>DirFakeGroup</code> directives will affect the user/group names in that |
| 2730 | "longname" string, which is defined for the <code>SSH_FXP_NAME</code> packet |
| 2731 | described in <a href="https://tools.ietf.org/html/draft-ietf-secsh-filexfer-02#section-7">draft-ietf-secsh-filexfer-02</a>. |
| 2732 | |
| 2733 | <p> |
| 2734 | In looking at the OpenSSH 7.9p1 implementation, we can see the issue in its |
| 2735 | code. When <code>ls -l</code> is used, the <code>sftp</code> command-line |
| 2736 | client will display the "longname" sent by mod_sftp as-is. But when |
| 2737 | <code>ls -lh</code> is used, that <code>-h</code> flag causes <code>sftp</code> |
| 2738 | to <b>ignore the "longname"</b>, and try to use only the UID/GID <i>numeric |
| 2739 | values</i> (which are <b>not</b> affected by the |
| 2740 | <code>DirFakeUser/DirFakeGroup</code> directives). |
| 2741 | |
| 2742 | <p><a name="SFTPTectiaHostKey"> |
| 2743 | <font color=red>Question</font>: When I try to start proftpd with |
| 2744 | <code>mod_sftp</code> configured to use my existing host key, it fails with |
| 2745 | one of the following error messages: |
| 2746 | <pre> |
| 2747 | error reading passphrase for SFTPHostKey '<i>hostkey</i>': Invalid argument |
| 2748 | error reading passphrase for SFTPHostKey '<i>hostkey</i>': (unknown) |
| 2749 | </pre> |
| 2750 | The permissions on my hostkey are fine, and it is not passphrase-protected. |
| 2751 | Is this a bug?<br><br> |
| 2752 | <font color=blue>Answer</font>: You are probably trying to use a host key |
| 2753 | generated by Tectia's SSH software (or an older <code>ssh.com</code> host key). |
| 2754 | |
| 2755 | <p> |
| 2756 | The <code>mod_sftp</code> module expects the configured |
| 2757 | <code>SFTPHostKey</code> file to be in the same format as used by OpenSSH. |
| 2758 | To check the format, run this command: |
| 2759 | <pre> |
| 2760 | # grep BEGIN <i>hostkey</i> |
| 2761 | </pre> |
| 2762 | If you see either of the following lines: |
| 2763 | <pre> |
| 2764 | -----BEGIN RSA PRIVATE KEY----- |
| 2765 | -----BEGIN DSA PRIVATE KEY----- |
| 2766 | </pre> |
| 2767 | then the format should be correct. If instead you see: |
| 2768 | <pre> |
| 2769 | ---- BEGIN SSH2 ENCRYPTED PRIVATE KEY ---- |
| 2770 | </pre> |
| 2771 | then the format is incorrect. The above line indicates that your host key |
| 2772 | was generated by Tectia (<i>nee</i> <code>ssh.com</code>), and needs to |
| 2773 | be converted to a different format. |
| 2774 | |
| 2775 | <p> |
| 2776 | To convert the format of your Tectia host key, use OpenSSH's |
| 2777 | <code>ssh-keygen</code> (<b>not</b> Tectia's <code>ssh-keygen</code>) and |
| 2778 | do the following: |
| 2779 | <pre> |
| 2780 | # ssh-keygen -i -f <i>hostkey</i> > /path/to/new-file |
| 2781 | </pre> |
| 2782 | The configure your <code>SFTPHostKey</code> directive with the path to the |
| 2783 | new file. |
| 2784 | |
| 2785 | <p><a name="SFTPOpenSSLVersionMismatch"> |
| 2786 | <font color=red>Question</font>: When I start <code>proftpd</code>, I |
| 2787 | see warnings that look like this: |
| 2788 | <pre> |
| 2789 | - mod_sftp/0.9.7: compiled using OpenSSL version 'OpenSSL 0.9.8n 24 Mar 2010' headers, but linked to OpenSSL version 'OpenSSL 0.9.8q 2 Dec 2010' library |
| 2790 | </pre> |
| 2791 | What does this mean?<br> |
| 2792 | <font color=blue>Answer</font>: That is an informational/warning message. |
| 2793 | |
| 2794 | <p> |
| 2795 | Some systems are badly maintained by their admins (and/or by the packages |
| 2796 | installed on the systems), such that the OpenSSL headers can become quite badly |
| 2797 | out of sync with the OpenSSL libraries. If this discrepancy becomes bad |
| 2798 | enough, you can see strange behavior from OpenSSL, ranging from random behavior |
| 2799 | to segfaults. So <code>mod_sftp</code> tries to let the admin know about the |
| 2800 | system's mismatched OpenSSL header/library versions. |
| 2801 | |
| 2802 | <p> |
| 2803 | Usually a minor OpenSSL version difference like the example above is OK, |
| 2804 | but it really depends on exactly what changed in OpenSSL, and how. |
| 2805 | |
| 2806 | <p> |
| 2807 | If you see the above message, it is not a <i>requirement</i> that you recompile |
| 2808 | <code>proftpd</code> against the OpenSSL headers of the same version as the |
| 2809 | OpenSSL libraries. However, the version discrepancy <em>is</em> a possible |
| 2810 | source of trouble. |
| 2811 | |
| 2812 | <p><a name="SFTPVersionId"> |
| 2813 | <font color=red>Question</font>: When a client first connects to |
| 2814 | <code>mod_sftp</code> and starts the SSH handshake, the client sees that |
| 2815 | <code>mod_sftp</code> provides an SSH version identifier like "SSH-2.0-mod_sftp/0.9.8". Is there any way I can tell <code>mod_sftp</code> to hide/change |
| 2816 | that version?<br> |
| 2817 | <font color=blue>Answer</font>: Yes. As of <code>proftpd-1.3.5rc1</code>, |
| 2818 | the <code>mod_sftp</code> module will honor the <a href="../modules/mod_core.html#ServerIdent"><code>ServerIdent</code></a> directive. |
| 2819 | |
| 2820 | <p> |
| 2821 | For example, to see just "SSH-2.0-mod_sftp", without any <code>mod_sftp</code> |
| 2822 | version suffix, use the following within your <code>mod_sftp</code> <code><VirtualHost></code>: |
| 2823 | <pre> |
| 2824 | # Tell mod_sftp to not reveal its module version in the SSH version |
| 2825 | # identification |
| 2826 | ServerIdent off |
| 2827 | </pre> |
| 2828 | You can also use <code>ServerIdent</code> to make <code>mod_sftp</code> say |
| 2829 | it is something else completely, like this: |
| 2830 | <pre> |
| 2831 | # Tell mod_sftp to advertise itself as an OpenSSH server |
| 2832 | ServerIdent on "OpenSSH_5.6p1" |
| 2833 | </pre> |
| 2834 | |
| 2835 | <p><a name="SFTPTrafficPolicyNetworkPerformance"> |
| 2836 | <font color=red>Question</font>: I notice that when I use some SFTP clients |
| 2837 | (<i>e.g.</i> DreamWeaver) with <code>mod_sftp</code>, the network performance |
| 2838 | is 5-6 times slower than with other SFTP clients. Using the same SFTP client |
| 2839 | against OpenSSH doesn't show the same slowdown. Network tools such as |
| 2840 | Wireshark show that <code>mod_sftp</code> is sending 2 TCP packets for each |
| 2841 | SFTP request, whereas OpenSSH only sends 1 TCP packet for each SFTP request. |
| 2842 | Why is <code>mod_sftp</code> so much slower than OpenSSH, but only for some |
| 2843 | SFTP clients?<br> |
| 2844 | <font color=blue>Answer</font>: Investigations into this <code>mod_sftp</code> |
| 2845 | behavior have shown it to be caused by the |
| 2846 | <a href="#SFTPTrafficPolicy"><code>SFTPTrafficPolicy</code></a> behavior, |
| 2847 | particularly when the SFTP client negotiates the use of a CBC cipher. |
| 2848 | |
| 2849 | <p> |
| 2850 | The recommended action to take is to disable the use of CBC ciphers, |
| 2851 | which will cause the <code>SFTPTrafficPolicy</code> mitigation to not go |
| 2852 | into effect, which keeps the number of SSH messages lower, thus improving |
| 2853 | network latency. Thus the change to make for your <code>mod_sftp</code> |
| 2854 | configuration is: |
| 2855 | <pre> |
| 2856 | # Remove the CBC ciphers from the ciphers we advertise |
| 2857 | SFTPCiphers aes256-ctr aes192-ctr aes128-ctr blowfish-ctr arcfour256 arcfour128 3des-ctr |
| 2858 | </pre> |
| 2859 | |
| 2860 | <p><a name="SFTPLocalisedTimes"> |
| 2861 | <font color=red>Question</font>: When I use <code>mod_sftp</code> and get |
| 2862 | a directory listing, I notice that the timestamps on the files are |
| 2863 | localised (<i>e.g.</i> are in French). When I use OpenSSH, the timestamps |
| 2864 | are always in English. How I get get <code>mod_sftp</code> to behave like |
| 2865 | OpenSSH, and not localise the timestamps?<br> |
| 2866 | <font color=blue>Answer</font>: This happens when your <code>proftpd</code> |
| 2867 | has been built with the <code>--enable-nls</code> configure option. To |
| 2868 | check, use <code>`proftpd -V'</code>: |
| 2869 | <pre> |
| 2870 | ... |
| 2871 | Features: |
| 2872 | ... |
| 2873 | + NLS support |
| 2874 | ... |
| 2875 | </pre> |
| 2876 | This means that <code>proftpd</code> honors any locale-related environment |
| 2877 | variables when it starts up. The reason you see localised timestamps |
| 2878 | in the directory listings is probably because your environment has something |
| 2879 | like <code>LANG=fr_FR.utf8</code>. |
| 2880 | |
| 2881 | <p> |
| 2882 | To tell <code>proftpd</code> to ignore that environment variable, you need |
| 2883 | to use this at the top of your <code>proftpd.conf</code>: |
| 2884 | <pre> |
| 2885 | Unsetenv LANG |
| 2886 | </pre> |
| 2887 | |
| 2888 | <p><a name="SFTPVersion6"> |
| 2889 | <font color=red>Question</font>: My SFTP client wants to use SFTP protocol |
| 2890 | version 6, but <code>mod_sftp</code> only accepts protocol version 3. These |
| 2891 | docs say that protocol versions 1-6 are supported. Is this a bug?<br> |
| 2892 | <font color=blue>Answer</font>: The most likely cause of this behavior is that |
| 2893 | your <code>proftpd</code> installation was not compiled with the |
| 2894 | <code>--enable-nls</code> configure option. The <code>--enable-nls</code> |
| 2895 | configure option is required to enable NLS support, which includes support |
| 2896 | for UTF8. SFTP protocol versions 4-6 require UTF8 support, which is why |
| 2897 | the <code>--enable-nls</code> configure option is needed. |
| 2898 | |
| 2899 | <p><a name="SFTPExtraREADs"> |
| 2900 | <font color=red>Question</font>: Why is my <code>SFTPLog</code> often spammed |
| 2901 | with lots of messages that look like: |
| 2902 | <pre> |
| 2903 | requested read offset (20480 bytes) greater than size of '/some/path/to.file' (20307 bytes) |
| 2904 | </pre> |
| 2905 | Is there something wrong with my SFTP client, or my configuration?<br> |
| 2906 | <font color=blue>Answer</font>: The short answer is that these extraneous |
| 2907 | <code>READ</code> requests <i>are</i> normal, and do <i>not</i> indicate any |
| 2908 | problem or issue. |
| 2909 | |
| 2910 | <p> |
| 2911 | Many SFTP clients try to improve their download speed by issuing many |
| 2912 | concurrent <code>READ</code> requests, each request with a different |
| 2913 | <em>offset</em>. Thus the client can read multiple "chunks" simultaneously, |
| 2914 | and do the reassembly of the "chunks" into the file itself. However, sometimes |
| 2915 | these SFTP clients do not necessarily know how <i>many</i> such |
| 2916 | <code>READ</code> requests are needed before the end-of-file is reached. So |
| 2917 | the SFTP client sends more <code>READ</code>s that might be necessary; the |
| 2918 | server will reply with an error if the requested <em>offset</em> is beyond the |
| 2919 | end of the file. When this "end of file" reply is received by the SFTP client, |
| 2920 | it will know that it is done downloading. On the server side, though, this |
| 2921 | behavior results in the above log messages. |
| 2922 | |
| 2923 | <p><a name="SFTPNotUnderstood"> |
| 2924 | <font color=red>Question</font>: When I use my SFTP client, I see something |
| 2925 | like this when I try to connect to <code>proftpd</code> with |
| 2926 | <code>mod_sftp</code>: |
| 2927 | <pre> |
| 2928 | 500 SSH-2.0-OPENSSH 6.2 not understood |
| 2929 | </pre> |
| 2930 | Why would this happen?<br> |
| 2931 | <font color=blue>Answer</font>: A "500 ... not understood" is an |
| 2932 | <b><i>FTP</i></b> response, not an SFTP response. This usually happens |
| 2933 | when your SFTP client connects to an FTP virtual host/port (versus an SFTP |
| 2934 | virtual host/port). So either <i>a)</i> the SFTP client is connecting to |
| 2935 | the wrong port on your server, or <i>b)</i> perhaps "SFTPEngine on" is not |
| 2936 | set in the virtual host for that port. |
| 2937 | |
| 2938 | <p><a name="SFTPPTYAllocationFailed"> |
| 2939 | <font color=red>Question</font>: I try to connect to <code>proftpd</code> |
| 2940 | with <code>mod_sftp</code> and the connection fails with an error messages |
| 2941 | like "PTY allocation request failed on channel 0" or "Server refused to |
| 2942 | allocate pty". What is going wrong?<br> |
| 2943 | <font color=blue>Answer</font>: This error message happens when you |
| 2944 | try to connect to <code>mod_sftp</code> using an SSH client which wants |
| 2945 | a <em>shell</em> session, rather than an SFTP session or an SCP transfer. |
| 2946 | The <code>mod_sftp</code> module does <b>not</b> support shell sessions |
| 2947 | (unlike OpenSSH). In the <code>SFTPLog</code>, you would see such |
| 2948 | connection attempts logged like so: |
| 2949 | <pre> |
| 2950 | mod_sftp/0.9.9[6304]: unsupported 'pty-req' channel requested, ignoring |
| 2951 | mod_sftp/0.9.9[6304]: unsupported 'shell' channel requested, ignoring |
| 2952 | </pre> |
| 2953 | |
| 2954 | <p><a name="SFTPDirectorySGID"> |
| 2955 | <font color=red>Question</font>: When I create a directory via SFTP, in |
| 2956 | a directory with the SGID bit set, the created directory does <b>not</b> |
| 2957 | have the SGID bit set as expected. How do I fix this?<br> |
| 2958 | <font color=blue>Answer</font>: Preserving the SGID bit for a created directory |
| 2959 | usually require root privs; the <code>mod_sftp</code> module automatically |
| 2960 | drops all root privs. So to get the directory SGID bit functionality, |
| 2961 | you will need to use the following in your <code>mod_sftp</code> |
| 2962 | <code><VirtualHost></code> section: |
| 2963 | <pre> |
| 2964 | RootRevoke off |
| 2965 | </pre> |
| 2966 | In addition, if your <code>proftpd</code> is running on Linux, you may |
| 2967 | need to disable the <a href="../modules/mod_cap.html"><code>mod_cap</code></a> |
| 2968 | module, or configure it to preserve the SGID bit (<i>e.g.</i> via the |
| 2969 | <a href="../modules/mod_cap.html#CapabilitiesSet"><code>CAP_FSETID</code></a> |
| 2970 | capability). |
| 2971 | |
| 2972 | <p><a name="SFTPEd25519"> |
| 2973 | <font color=red>Question</font>: I see that Ed25519 SSH keys are supported |
| 2974 | as of ProFTPD 1.3.7rc3 (see <a href="http://bugs.proftpd.org/show_bug.cgi?id=4221">Bug #4221</a>), but when I try to use one with <code>mod_sftp</code>, my |
| 2975 | login fails. The <code>SFTPLog</code> shows this error; why? |
| 2976 | <pre> |
| 2977 | USER user1 (Login failed): unsupported public key algorithm 'ssh-ed25519' requested |
| 2978 | </pre> |
| 2979 | <font color=blue>Answer</font>: Support for the Ed25519 algorithm requires |
| 2980 | the <a href="https://github.com/jedisct1/libsodium">libsodium</a> library. |
| 2981 | You may need to install this library, and recompile ProFTPD with |
| 2982 | <code>mod_sftp</code> in order for the library to be detected and used. |
| 2983 | |
| 2984 | <p><a name="SFTPWarnings"> |
| 2985 | <font color=red>Question</font>: In my SFTP logs, I see these warnings: |
| 2986 | <pre> |
| 2987 | WARNING: unable to read SFTPDHParamFile '<i>path</i>': Permission denied |
| 2988 | unable to open SFTPKeyBlacklist '<i>path</i>': Permission denied |
| 2989 | </pre> |
| 2990 | What can I do to fix this?<br> |
| 2991 | <font color=blue>Answer</font>: This indicates that the files are not |
| 2992 | readable (usually <i>world</i>-readable) by the users logging in, |
| 2993 | <b>or</b> that the directories containing the files are not readable |
| 2994 | by the users. |
| 2995 | |
| 2996 | <p> |
| 2997 | Fortunately <code>mod_sftp</code> will function without issue if it |
| 2998 | cannot read either the <code>SFTPDHParamFile</code> or the |
| 2999 | <code>SFTPKeyBlacklist</code> files. |
| 3000 | |
| 3001 | <p><a name="SFTPSHA2"> |
| 3002 | <font color=red>Question</font>: I see that many sites are phasing out their |
| 3003 | use of the SHA-1 algorithm as it is felt to be <em>unsafe</em>. How can I |
| 3004 | configure <code>mod_sftp</code> to no longer use SHA-1?<br> |
| 3005 | <font color=blue>Answer</font>: The main uses of SHA-1 in <code>mod_sftp</code> |
| 3006 | are in the algorithms for MACs (the |
| 3007 | <a href="#SFTPDigests"><code>SFTPDigests</code></a> directive) and key exchanges |
| 3008 | (the <a href="#SFTPKeyExchanges"><code>SFTPKeyExchanges</code></a> directive). |
| 3009 | |
| 3010 | <p> |
| 3011 | For <code>SFTPDigests</code>, the algorithms that <em>use</em> SHA-1, and thus |
| 3012 | the ones to <em>avoid</em> are: |
| 3013 | <ul> |
| 3014 | <li>hmac-sha1 |
| 3015 | <li>hmac-sha1-96 |
| 3016 | <li>hmac-md5 |
| 3017 | <li>hmac-md5-96 |
| 3018 | </ul> |
| 3019 | Then you would want to use something like this in your <code>mod_sftp</code> |
| 3020 | configuration: |
| 3021 | <pre> |
| 3022 | SFTPDigests \ |
| 3023 | [email protected] \ |
| 3024 | [email protected] \ |
| 3025 | hmac-sha2-256 \ |
| 3026 | hmac-sha2-512 |
| 3027 | </pre> |
| 3028 | Note that some of the algorithms above may not be supported by your version |
| 3029 | of <code>mod_sftp</code>. |
| 3030 | |
| 3031 | <p> |
| 3032 | Similarly, for key exchanges, the algorithms to avoid because they use SHA-1 |
| 3033 | are: |
| 3034 | <ul> |
| 3035 | <li>diffie-hellman-group-exchange-sha1 |
| 3036 | <li>diffie-hellman-group14-sha1 |
| 3037 | <li>diffie-hellman-group1-sha1 |
| 3038 | </li>rsa1024-sha1 |
| 3039 | </ul> |
| 3040 | And to do this, you might use something like this in your configuration: |
| 3041 | <pre> |
| 3042 | SFTPKeyExchanges \ |
| 3043 | curve448-sha512 \ |
| 3044 | curve25519-sha256 \ |
| 3045 | ecdh-sha2-nistp521 \ |
| 3046 | ecdh-sha2-nistp384 \ |
| 3047 | ecdh-sha2-nistp256 \ |
| 3048 | diffie-hellman-group18-sha512 \ |
| 3049 | diffie-hellman-group16-sha512 \ |
| 3050 | diffie-hellman-group14-sha256 \ |
| 3051 | diffie-hellman-group-exchange-sha256 \ |
| 3052 | </pre> |
| 3053 | |
| 3054 | <p><a name="SFTPOpenSSL1.1.x"> |
| 3055 | <font color=red>Question</font>: I am using ProFTPD 1.3.5, and I am unable to |
| 3056 | use <code>mod_sftp</code>. When I connect, I see these errors in my |
| 3057 | <code>SFTPLog</code>: |
| 3058 | <pre> |
| 3059 | 2017-07-28 22:38:13,904 mod_sftp/0.9.9[24363]: error setting key/IV for aes256-ctr cipher for decryption: |
| 3060 | (1) error:0906D06C:PEM routines:PEM_read_bio:no start line |
| 3061 | (2) error:0607B083:digital envelope routines:EVP_CipherInit_ex:no cipher set |
| 3062 | </pre> |
| 3063 | Is this a bug?<br> |
| 3064 | <font color=blue>Answer</font>: These error messages indicate that you are |
| 3065 | using a newer version of OpenSSL, <i>e.g.</i> OpenSSL 1.1.<i>x</i>, than |
| 3066 | ProFTPD 1.3.5 can support. |
| 3067 | |
| 3068 | <p> |
| 3069 | The OpenSSL APIs <em>changed</em> from OpenSSL 1.0.<i>x</i> to OpenSSL |
| 3070 | 1.1.<i>x</i>, requiring changes in the applications that use OpenSSL (see |
| 3071 | <a href="http://bugs.proftpd.org/show_bug.cgi?id=4240">Bug#4240</a>). To |
| 3072 | deal with this issue, then, you can hopefully upgrade to ProFTPD 1.3.6 or later, |
| 3073 | <i>or</i> downgrade your OpenSSL version to 1.0.<i>x</i>. |
| 3074 | |
| 3075 | <p> |
| 3076 | <hr> |
| 3077 | <font size=2><b><i> |
| 3078 | © Copyright 2008-2024 TJ Saunders<br> |
| 3079 | All Rights Reserved<br> |
| 3080 | </i></b></font> |
| 3081 | <hr> |
| 3082 | |
| 3083 | </body> |
| 3084 | </html> |