Forum Discussion

LeanderV_365921's avatar
Mar 07, 2019

FTP Proxy : pwd problem

Hello,

 

Im currently using following code snippet for FTP proxy.

 

https://devcentral.f5.com/codeshare/ftp-proxy-lite

 

    when CLIENT_ACCEPTED {
    TCP::respond "220 Welcome to the F5 FTP Proxy\r\n"
    log local0. "client accepted"
    TCP::collect
}

when CLIENT_DATA {
    set ftplogin [TCP::payload]
    if { $ftplogin starts_with "USER" } {
        set cuser [TCP::payload]
        scan $cuser {%[^@]@%s} garbage remote_ftp_site_addr
        scan $garbage %s%s cmd uid
        TCP::payload replace 0 [string length $cuser ] "USER $uid\r\n"
        node $remote_ftp_site_addr [TCP::local_port]
    }
    TCP::release
}
`

But it looks like the passwd doesnt get passed when connecting to the ftp server.
I get this behavior with WINSCP and Filezilla

Answer : 530 Please login with USER and PASS.

Server Log:

> 
`Thu Mar  7 10:13:12 2019 [pid 17174] FTP command: Client "::ffff:130.0.0.150", "USER ictst"
Thu Mar  7 10:13:12 2019 [pid 17174] [ictst] FTP response: Client "::ffff:130.0.0.150", "331 Please specify the password."
Thu Mar  7 10:13:12 2019 [pid 17174] [ictst] FTP command: Client "::ffff:130.0.0.150", "SYST"
Thu Mar  7 10:13:12 2019 [pid 17174] [ictst] FTP response: Client "::ffff:130.0.0.150", "530 Please login with USER and PASS."
Thu Mar  7 10:13:12 2019 [pid 17174] [ictst] FTP command: Client "::ffff:130.0.0.150", "FEAT"
Thu Mar  7 10:13:12 2019 [pid 17174] [ictst] FTP response: Client "::ffff:130.0.0.150", "211-Features:"
Thu Mar  7 10:13:12 2019 [pid 17174] [ictst] FTP response: Client "::ffff:130.0.0.150", " EPRT??"
Thu Mar  7 10:13:12 2019 [pid 17174] [ictst] FTP response: Client "::ffff:130.0.0.150", " EPSV??"
Thu Mar  7 10:13:12 2019 [pid 17174] [ictst] FTP response: Client "::ffff:130.0.0.150", " MDTM??"
Thu Mar  7 10:13:12 2019 [pid 17174] [ictst] FTP response: Client "::ffff:130.0.0.150", " PASV??"
Thu Mar  7 10:13:12 2019 [pid 17174] [ictst] FTP response: Client "::ffff:130.0.0.150", " REST STREAM??"
Thu Mar  7 10:13:12 2019 [pid 17174] [ictst] FTP response: Client "::ffff:130.0.0.150", " SIZE??"
Thu Mar  7 10:13:12 2019 [pid 17174] [ictst] FTP response: Client "::ffff:130.0.0.150", " TVFS??"
Thu Mar  7 10:13:12 2019 [pid 17174] [ictst] FTP response: Client "::ffff:130.0.0.150", "211 End"
Thu Mar  7 10:13:12 2019 [pid 17174] [ictst] FTP command: Client "::ffff:130.0.0.150", "PWD"
Thu Mar  7 10:13:12 2019 [pid 17174] [ictst] FTP response: Client "::ffff:130.0.0.150", "530 Please login with USER an

The Virtual server has a FTP-Profile on it.

 

Anybody have an idea why this could be the case ?

 

Leander

 

  • Because your user does not have an FTP server included maybe?

     

    FTP command: Client "::ffff:130.0.0.150", "USER ictst"

    But the code requires the user to be of the type username@ip address:

     

    scan $cuser {%[^@]@%s} garbage remote_ftp_site_addr
    scan $garbage %s%s cmd uid
    TCP::payload replace 0 [string length $cuser ] "USER $uid\r\n"
    node $remote_ftp_site_addr [TCP::local_port]
  • Hi,

    Sorry i wansn't clear enough. The logs u see there are from the backend FTP-Server.

    `FTP command: Client "::ffff:130.0.0.150", "USER ictst"`
    

    So the ftp-connection gets setup with right server based on the username. The irule does what it needs to do. Only we can't complete the connection because it always fails when trying to give the password.

    Leander