Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic

Net::FTPSSL and encrypted data connection

by neilwatson (Priest)
on Jan 26, 2007 at 20:50 UTC ( #596788=perlquestion: print w/replies, xml ) Need Help??
neilwatson has asked for the wisdom of the Perl Monks concerning the following question:

I'm developing a program to download some files from a vendor site. The site uses FTP with SSL. I can connect but my data connections are dropped. I think that the module is not allowing encryption on the data channel. I tested with lftp and my data connections (e.g. and ls command) only worked after I enable encryption on the data channel. Yes, the ls returns files and directories.

#!/usr/bin/perl use strict; use warnings; use Net::FTPSSL; my $server = ""; my $username = "*********"; my $passwd = "**********"; my @ret; my $ftps = Net::FTPSSL->new( $server, Debug => 1) or error("Cannot reach $server"); $ftps->login($username, $passwd) or error("Credential error, $ftps->last_message"); @ret = $ftps->list() or error("Command error, $ftps->last_message"); $ftps->pwd(); print @ret;
Sample output:

>>> USER ******** <<< 331 Password required for ********. >>> PASS ******** <<< 230 User ******* logged in. >>> PBSZ 0 <<< 200 PBSZ Command successful. >>> PROT P <<< 200 PROT Command successful. >>> PASV <<< 227 Entering Passive Mode (**************) >>> LIST <<< 150 Opening data connection for '/bin/ls'. <<< 226 Transfer complete. >>> PWD <<< 257 "/home/*******" is current directory.

Neil Watson

Replies are listed 'Best First'.
Re: Net::FTPSSL and encrypted data connection
by Herkum (Parson) on Jan 27, 2007 at 05:12 UTC
    I cannot give you an answer for this specific situation, however LWP::UserAgent says it does support ftp connections and I know it supports SSL. I don't know if it does both but it might be worth a shot...
Re: Net::FTPSSL and encrypted data connection
by sgt (Deacon) on Jan 27, 2007 at 19:57 UTC

    reading the docs for Net::FTPSSL, I see there is an option for explicit encryption called EXP_CRYPT that you pass in new. Maybe you can try to put it "explicitly" although it is supposed to be the default.

    the example in the synopsis does that:

    my $ftps = Net::FTPSSL->new('', Port => 21, Encryption => 'E', Debug => 1) or die "Can't open";
    hth --stephan
Re: Net::FTPSSL and encrypted data connection
by kral (Monk) on Jan 29, 2007 at 13:03 UTC
    I confirm that the module always tries to make a new encrypted connection (using Net::SSLeay module) to the address/port indicated on the passive response.
    (I apologise for my english!)

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://596788]
Approved by Paladin
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (2)
As of 2018-01-17 10:00 GMT
Find Nodes?
    Voting Booth?
    How did you see in the new year?

    Results (198 votes). Check out past polls.