| 1 | <!DOCTYPE html> |
| 2 | <html> |
| 3 | <head> |
| 4 | <title>ProFTPD: FXP (Site-to-Site Transfers)</title> |
| 5 | </head> |
| 6 | |
| 7 | <body bgcolor=white> |
| 8 | |
| 9 | <hr> |
| 10 | <center><h2><b>ProFTPD: FXP (Site-to-Site Transfers)</b></h2></center> |
| 11 | <hr> |
| 12 | |
| 13 | <p> |
| 14 | <b>FXP</b><br> |
| 15 | What is FXP? FXP is part of the name of a popular Windows FTP client: |
| 16 | <pre> |
| 17 | <a href="http://www.flashfxp.com">http://www.flashfxp.com</a> |
| 18 | </pre> |
| 19 | This client has made the name "FXP" commonly used as a synonym |
| 20 | for site-to-site FTP transfers, for transferring a file between two |
| 21 | remote FTP servers without the transfer going through the client's host. |
| 22 | Sometimes "FXP" is referred to as a protocol; in fact, it is not. |
| 23 | The site-to-site transfer capability was deliberately designed into FTP. |
| 24 | |
| 25 | <p> |
| 26 | <b>Site-to-Site Transfers</b><br> |
| 27 | In a site-to-site transfer, the client logs in to two servers (server A and |
| 28 | server B). It then arranges for a file transfer, telling one server (server A) |
| 29 | that it will be a passive transfer, and the other server (server B) that it |
| 30 | will be an active transfer. For a passive transfer, server A will return an |
| 31 | address/port (via response to the <code>PASV</code> command) to which the |
| 32 | client is to connect. The client then passes that address/port in a |
| 33 | <code>PORT</code> command to server B. Then, the client sends a |
| 34 | <code>RETR</code> to one of the servers and a <code>STOR</code> to the |
| 35 | other, thus starting the transfer. The data does not pass to the client |
| 36 | machine at all. |
| 37 | |
| 38 | <p> |
| 39 | Any firewalls protecting either (or both) servers involved may need to allow |
| 40 | active and passive FTP data transfers, depending on which server is told to be |
| 41 | active, which is told to be passive. |
| 42 | |
| 43 | <p> |
| 44 | <b>Example Site-to-Site Transfer</b><br> |
| 45 | In the example below, italicized represent responses to the given FTP commands. |
| 46 | Lines in blue show communications to <font color=blue>server A</font>, while |
| 47 | those in red are to <font color=red>server B</font>. Black lines are |
| 48 | informational messages displayed by the FXP client. |
| 49 | <pre> |
| 50 | <font color=blue>TYPE I |
| 51 | <i>200 Type set to I.</i></font> |
| 52 | <font color=red>TYPE I |
| 53 | <i>200 Type set to I.</i></font> |
| 54 | <font color=blue>PASV |
| 55 | <i>227 Entering Passive Mode (1,2,3,4,130,161).</i></font> |
| 56 | <font color=red>PORT 1,2,3,4,130,161 |
| 57 | <i>200 PORT command successful</i></font> |
| 58 | <font color=blue>STOR file.mp3 |
| 59 | <i>150 Opening BINARY mode data connection for file.mp3</i></font> |
| 60 | <font color=red>RETR file.mp3 |
| 61 | <i>150 Opening BINARY mode data connection for file.mp3 (15000000 bytes)</i></font> |
| 62 | <font color=blue><i>226 Transfer complete.</i></font> |
| 63 | <font color=red><i>226 Transfer complete.</i></font> |
| 64 | Transferred: file.mp3 14.31 MB in 2.38 (6,147.06 KBps) |
| 65 | <font color=blue>TYPE A |
| 66 | <i>200 Type set to A.</i> |
| 67 | PASV |
| 68 | <i>227 Entering Passive Mode (5,6,7,8,168,183).</i> |
| 69 | LIST |
| 70 | <i>150 Opening ASCII mode data connection for file list</i> |
| 71 | <i>226 Transfer complete.</i></font> |
| 72 | <font color=red>TYPE A |
| 73 | <i>200 Type set to A.</i> |
| 74 | PASV |
| 75 | <i>227 Entering Passive Mode (1,2,3,4,130,162).</i> |
| 76 | LIST |
| 77 | <i>150 Opening ASCII mode data connection for file list</i> |
| 78 | <i>226 Transfer complete.</i></font> |
| 79 | Transfer queue completed |
| 80 | Transferred 1 file totaling 14.31 MB in 3.42 (6,147.06 KBps) |
| 81 | </pre> |
| 82 | The client instructs <font color=blue>server A</font> to expect a passive |
| 83 | data transfer, and <font color=red>server B</font> to initiate an active |
| 84 | data transfer. The address and port returned in |
| 85 | <font color=blue>server A</font>'s response to the <code>PASV</code> command |
| 86 | is passed to <font color=red>server B</font> as arguments in the |
| 87 | <code>PORT</code> command. The transfer is then started by telling |
| 88 | <font color=blue>server A</font> to expect a file to be uploaded, and |
| 89 | <font color=red>server B</font> to download the file. The following |
| 90 | <code>PASV/LIST</code> sequences are the client confirming that the file |
| 91 | was transferred successfully. |
| 92 | |
| 93 | <p> |
| 94 | This example also illustrates that site-to-site transfers use both active |
| 95 | and passive data transfers; for sites that operate behind firewalls and |
| 96 | NAT, passive transfers may require extra configuration to operate properly |
| 97 | (<i>i.e.</i> use of the <a href="../modules/mod_core.html#MasqueradeAddress"><code>MasqueradeAddress</code></a> and |
| 98 | <a href="../modules/mod_core.html#PassivePorts"><code>PassivePorts</code></a> |
| 99 | configuration directives). |
| 100 | |
| 101 | <p> |
| 102 | <b>"FTP Bounce" Attacks and <code>AllowForeignAddress</code></b><br> |
| 103 | So, what does this mean for ProFTPD? By default, ProFTPD <b>does not allow</b> |
| 104 | site-to-site transfers, for by allowing them, the server also allows |
| 105 | a type of attack known as the "FTP bounce" attack: |
| 106 | <pre> |
| 107 | <a href="http://www.cert.org/advisories/CA-1997-27.html">http://www.cert.org/advisories/CA-1997-27.html</a> |
| 108 | </pre> |
| 109 | The protection against this attack is to enforce the requirement that, |
| 110 | from the server's point of view, the remote address of a control connection |
| 111 | matches the remote address of a data connection. If the addresses do not |
| 112 | match, the data connection is treated as from a foreign client, and thus |
| 113 | rejected. |
| 114 | |
| 115 | <p> |
| 116 | However, some site administrators do want to allow their servers to support |
| 117 | site-to-site transfers. ProFTPD must be explicitly configured to allow these |
| 118 | by using the <a href="../modules/mod_core.html#AllowForeignAddress"><code>AllowForeignAddress</code></a> configuration directive. |
| 119 | |
| 120 | <p> |
| 121 | Note that even if <code>AllowForeignAddress</code> is enabled, you may still |
| 122 | encounter trouble with site-to-site transfers involving your server. |
| 123 | These issues usually arise from firewall configurations, or with upstream |
| 124 | ISPs performing filtering on the FTP port. |
| 125 | |
| 126 | <p> |
| 127 | <hr> |
| 128 | <font size=2><b><i> |
| 129 | © Copyright 2017 The ProFTPD Project<br> |
| 130 | All Rights Reserved<br> |
| 131 | </i></b></font> |
| 132 | <hr> |
| 133 | |
| 134 | </body> |
| 135 | </html> |