giampaolo / pyftpdlib

Extremely fast and scalable Python FTP server library
MIT License
1.66k stars 266 forks source link

Adding masquerade_address_map client ip support #572

Open nmweizi opened 2 years ago

nmweizi commented 2 years ago

Signed-off-by: weizi nmweizi@gmail.com

Adding masquerade_address_map client ip masquerade_address_map = {"2.2.2.1":"2.2.2.1","4.4.4.1":"4.4.4.1"}

client-A -> nat device -> ftp server. <- nat device. <- client-B client-A nat device ftp server nat device client-B
1.1.1.1 2.2.2.1 3.3.3.1 4.4.4.1 5.5.5.1
giampaolo commented 2 years ago

What's the story behind this? Why is this needed?

nmweizi commented 2 years ago

What's the story behind this? Why is this needed?

client-A | nat device A | ftp server | nat device B | client-B -- | -- | -- | -- | -- 1.1.1.1 | 2.2.2.1 | 3.3.3.1 | 4.4.4.1 | 5.5.5.1
  1. The nat device only allows pasv mode for clients accessing the ftp server, and does not support alg.
  2. ftp server connects two networks through nat.
  3. The ftp server has a single network card, so the ftp server can only send masquerade_address based on client ip information.