File: ftps-starttls.pl

package info (click to toggle)
libnet-sslglue-perl 1.058-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 212 kB
  • sloc: perl: 825; makefile: 2
file content (21 lines) | stat: -rw-r--r-- 371 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
use strict;
use warnings;
use Net::SSLGlue::FTP;

my $ftp = Net::FTP->new( 'ftp.example.com', 
    Passive => 1,
    Debug => 1,
);
$ftp->starttls( SSL_ca_path => '/etc/ssl/certs' )
    or die "tls upgrade failed";
$ftp->login('foo','bar');
print $ftp->ls;

# change protection to clear
$ftp->prot('C');
$ftp->ls;

# stop TLS on control channel
$ftp->stoptls;
$ftp->ls;