jaa has asked for the wisdom of the Perl Monks concerning the following question:

Folks,

I am trying to help a non-technical user behind a corporate firewall to reliably send files via FTP.

I have Net::FTP doing sleep/retry for transient errors fine here, but we are not behind an FTP proxy. I have a copy of a working transfer from them, from which I can infer that they have a FirewallType of 4. However they do not have Net::Config properly configured - corporate standards et al.

I cannot find a way to tell Net::FTP the fwuser and fwpass except via the Net::Config files. Having looked at the Net::FTP source, am I correct in assuming therefore that there is no Net::FTP interface for passing these values as args anywhere? Does this mean that I will have to use something like:

logDebug "opening connection to $arg{firewall}..."; my $ftp = Net::FTP->new( $arg{firewall}, Debug => $DEBUG ) or logError "failed connection: $arg{firewall}: $@" and return 0; logDebug "logging into $arg{firewall} as $arg{fwuser}..."; $ftp->login($arg{fwuser},$arg{fwpass}) or logError "failed login: $arg{fwuser}\@$arg{firewall} " . $ftp-> +message() and return 0; logDebug "connecting to $arg{host}..."; $ftp->quot('OPEN',$arg{host}) or logError "failed OPEN: $arg{host} " . $ftp->message() and return 0; logDebug "logging in on $arg{host}..."; $ftp->login($arg{user},$arg{password}) or logError "failed login: $arg{user}\@$arg{host} " . $ftp->messag +e() and return 0;

Apologies for having to ask this, but I don't have a test environment, and the non-techie user is, well, rather non-technical, and in another country/timezone.

Regards & thanks,
Jeff

Replies are listed 'Best First'.
Re: Net::FTP firewall fwuser fwpass
by Roger (Parson) on Nov 28, 2003 at 05:26 UTC
    You need to set your Net::FTP in passive mode when tunneling through a firewall.

    my $ftp = Net::FTP->new( $arg{host}, Firewall => 'firewall_host:port_no', FirewallType => 4, Passive => 1 );
    Then for firewall type 4, do the sequence as said in the Net::Config manual.
    USER fwuser PASS fwpass OPEN remote.site USER user PASS pass