Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Net::FTPSSL and encrypted data connection

by neilwatson (Curate)
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 = "ftps.example.com"; 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
watson-wilson.ca

Comment on Net::FTPSSL and encrypted data connection
Select or Download Code
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 (Chaplain) 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('ftp.yoursecureserver.com', Port => 21, Encryption => 'E', Debug => 1) or die "Can't open ftp.yoursecureserver.com";
    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.
    ----------
    kral
    (I apologise for my english!)

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://596788]
Approved by Paladin
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (12)
As of 2015-07-29 18:25 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (267 votes), past polls