I've scenario where ftp client and server are separe with a proxy server. I want to insert ip source address into ftp client payload so that the ftp server can retrieve it. The problem is that i don't know how to proceed. Help me out please. With regards.
Asked
Active
Viewed 372 times
0
-
What do you mean by *"FTP packet"*? FTP does not have "packets". It's text-based protocol. You should better describe the functionality, that you want to achieve, rather than asking such technicality. It looks like [XY problem](http://xyproblem.info/). – Martin Prikryl Apr 27 '17 at 13:15
-
Your edit didn't improve anything. I'm downvoting your question, until you explain us, what you want. – Martin Prikryl Apr 27 '17 at 13:28
-
Sorry for the mistake. My goal is to insert Ip adress inside ftp client payload so that the ftp server can extract that – ABM Apr 27 '17 at 13:33
-
FTP server knows where (what IP) the connection comes from. That's a basic principle of whole Internet! – Martin Prikryl Apr 27 '17 at 13:35
-
OK, and all that information should have been in your question from the very first moment! + Do you have a control over both the server and the client? Can you change/re-implement both? – Martin Prikryl Apr 27 '17 at 13:40
-
Yes but when NAT is applied, the ftp server does not know the source not necessarily the original ip – ABM Apr 27 '17 at 13:44
-
We understand your problem now. So edit your question so say all that! – Martin Prikryl Apr 27 '17 at 13:48
-
Yes the goal is to re-implement both – ABM Apr 27 '17 at 13:48
-
There are also approaches such as the [`PROXY` protocol](https://www.haproxy.org/download/1.8/doc/proxy-protocol.txt), assuming your client and server could understand it. The benefit of using `PROXY` is that it's not quite home-grown... – Castaglia Apr 27 '17 at 17:47
1 Answers
2
FTP is text-based protocol.
If you can re-implement both the client and the server, just make them understand a new command for your purpose.
E.g. you can have the client send a XIP
command just after authentication (or even before, if you need):
XIP 203.0.113.0
The server will just parse the IP and respond something like this (to follow the FTP specification):
200 OK
And then carry on as in a normal FTP session.

Martin Prikryl
- 188,800
- 56
- 490
- 992