|
|
52eea9 |
diff -Naurp lftp-4.4.8.orig/doc/lftp.1 lftp-4.4.8/doc/lftp.1
|
|
|
52eea9 |
--- lftp-4.4.8.orig/doc/lftp.1 2015-05-13 11:31:55.000000000 +0200
|
|
|
52eea9 |
+++ lftp-4.4.8/doc/lftp.1 2015-05-13 16:34:46.648020240 +0200
|
|
|
52eea9 |
@@ -1865,6 +1865,14 @@ when true, use Server Name Indication (S
|
|
|
52eea9 |
if set to yes, then verify server's certificate to be signed by a known
|
|
|
52eea9 |
Certificate Authority and not be on Certificate Revocation List.
|
|
|
52eea9 |
.TP
|
|
|
52eea9 |
+.BR ssl:priority " (string)"
|
|
|
52eea9 |
+free form priority string for GnuTLS. If built with OpenSSL the understood
|
|
|
52eea9 |
+values are \fI+\fP or \fI-\fP followed by SSL3.0, TLS1.0, TLS1.1 or TLS1.2,
|
|
|
52eea9 |
+separated by \fI:\fP. Example:
|
|
|
52eea9 |
+.Ds
|
|
|
52eea9 |
+set ssl:priority "NORMAL:-SSL3.0:-TLS1.0:-TLS1.1:+TLS1.2"
|
|
|
52eea9 |
+.De
|
|
|
52eea9 |
+.TP
|
|
|
52eea9 |
.BR torrent:ip " (ipv4 address)"
|
|
|
52eea9 |
IP address to send to the tracker. Specify it if you are using an HTTP proxy.
|
|
|
52eea9 |
.TP
|
|
|
52eea9 |
diff -Naurp lftp-4.4.8.orig/src/lftp_ssl.cc lftp-4.4.8/src/lftp_ssl.cc
|
|
|
52eea9 |
--- lftp-4.4.8.orig/src/lftp_ssl.cc 2013-03-19 13:55:58.000000000 +0100
|
|
|
52eea9 |
+++ lftp-4.4.8/src/lftp_ssl.cc 2015-05-13 17:41:43.752418022 +0200
|
|
|
52eea9 |
@@ -270,10 +270,20 @@ lftp_ssl_gnutls::lftp_ssl_gnutls(int fd1
|
|
|
52eea9 |
|
|
|
52eea9 |
gnutls_transport_set_ptr(session,(gnutls_transport_ptr_t)fd);
|
|
|
52eea9 |
|
|
|
52eea9 |
- // hack for some ftp servers
|
|
|
52eea9 |
- const char *auth=ResMgr::Query("ftp:ssl-auth", hostname);
|
|
|
52eea9 |
- if(auth && !strncmp(auth, "SSL", 3))
|
|
|
52eea9 |
- gnutls_priority_set_direct(session, "NORMAL:+SSL3.0:-TLS1.0:-TLS1.1:-TLS1.2",0);
|
|
|
52eea9 |
+ const char *priority=ResMgr::Query("ssl:priority", 0);
|
|
|
52eea9 |
+ if(priority && *priority)
|
|
|
52eea9 |
+ {
|
|
|
52eea9 |
+ int res = gnutls_priority_set_direct(session, priority, 0);
|
|
|
52eea9 |
+ if(res != GNUTLS_E_SUCCESS)
|
|
|
52eea9 |
+ Log::global->Format(0,"gnutls_priority_set_direct(`%s'): %s\n",priority,gnutls_strerror(res));
|
|
|
52eea9 |
+ }
|
|
|
52eea9 |
+ else
|
|
|
52eea9 |
+ {
|
|
|
52eea9 |
+ // hack for some ftp servers
|
|
|
52eea9 |
+ const char *auth=ResMgr::Query("ftp:ssl-auth", hostname);
|
|
|
52eea9 |
+ if(auth && !strncmp(auth, "SSL", 3))
|
|
|
52eea9 |
+ gnutls_priority_set_direct(session, "NORMAL:+SSL3.0:-TLS1.0:-TLS1.1:-TLS1.2",0);
|
|
|
52eea9 |
+ }
|
|
|
52eea9 |
|
|
|
52eea9 |
if(h && ResMgr::QueryBool("ssl:use-sni",h)) {
|
|
|
52eea9 |
if(gnutls_server_name_set(session, GNUTLS_NAME_DNS, h, xstrlen(h)) < 0)
|
|
|
52eea9 |
@@ -771,7 +781,32 @@ lftp_ssl_openssl_instance::lftp_ssl_open
|
|
|
52eea9 |
#else
|
|
|
52eea9 |
SSLeay_add_ssl_algorithms();
|
|
|
52eea9 |
ssl_ctx=SSL_CTX_new(SSLv23_client_method());
|
|
|
52eea9 |
- SSL_CTX_set_options(ssl_ctx, SSL_OP_ALL|SSL_OP_NO_TICKET|SSL_OP_NO_SSLv2);
|
|
|
52eea9 |
+ long options=SSL_OP_ALL|SSL_OP_NO_TICKET|SSL_OP_NO_SSLv2;
|
|
|
52eea9 |
+ const char *priority=ResMgr::Query("ssl:priority", 0);
|
|
|
52eea9 |
+ if(priority && *priority)
|
|
|
52eea9 |
+ {
|
|
|
52eea9 |
+ static const struct ssl_option {
|
|
|
52eea9 |
+ const char name[8];
|
|
|
52eea9 |
+ long option;
|
|
|
52eea9 |
+ } opt_table[] ={
|
|
|
52eea9 |
+ {"-SSL3.0",SSL_OP_NO_SSLv3},
|
|
|
52eea9 |
+ {"-TLS1.0",SSL_OP_NO_TLSv1},
|
|
|
52eea9 |
+ {"-TLS1.1",SSL_OP_NO_TLSv1_1},
|
|
|
52eea9 |
+ {"-TLS1.2",SSL_OP_NO_TLSv1_2},
|
|
|
52eea9 |
+ {"",0}
|
|
|
52eea9 |
+ };
|
|
|
52eea9 |
+ char *to_parse=alloca_strdup(priority);
|
|
|
52eea9 |
+ for(char *ptr=strtok(to_parse,":"); ptr; ptr=strtok(NULL,":")) {
|
|
|
52eea9 |
+ for(const ssl_option *opt=opt_table; opt->name[0]; opt++) {
|
|
|
52eea9 |
+ if(!strcmp(ptr,opt->name)) {
|
|
|
52eea9 |
+ options|=opt->option;
|
|
|
52eea9 |
+ Log::global->Format(9,"ssl: applied %s option\n",ptr);
|
|
|
52eea9 |
+ break;
|
|
|
52eea9 |
+ }
|
|
|
52eea9 |
+ }
|
|
|
52eea9 |
+ }
|
|
|
52eea9 |
+ }
|
|
|
52eea9 |
+ SSL_CTX_set_options(ssl_ctx, options);
|
|
|
52eea9 |
SSL_CTX_set_cipher_list(ssl_ctx, "ALL:!aNULL:!eNULL:!SSLv2:!LOW:!EXP:!MD5:@STRENGTH");
|
|
|
52eea9 |
SSL_CTX_set_verify(ssl_ctx,SSL_VERIFY_PEER,lftp_ssl_openssl::verify_callback);
|
|
|
52eea9 |
// SSL_CTX_set_default_passwd_cb(ssl_ctx,lftp_ssl_passwd_callback);
|
|
|
52eea9 |
diff -Naurp lftp-4.4.8.orig/src/resource.cc lftp-4.4.8/src/resource.cc
|
|
|
52eea9 |
--- lftp-4.4.8.orig/src/resource.cc 2013-03-19 14:00:36.000000000 +0100
|
|
|
52eea9 |
+++ lftp-4.4.8/src/resource.cc 2015-05-13 17:57:40.885954120 +0200
|
|
|
52eea9 |
@@ -354,6 +354,7 @@ static ResType lftp_vars[] = {
|
|
|
52eea9 |
{"ssl:check-hostname", "yes", ResMgr::BoolValidate,0},
|
|
|
52eea9 |
{"ssl:verify-certificate", "yes", ResMgr::BoolValidate,0},
|
|
|
52eea9 |
{"ssl:use-sni", "yes", ResMgr::BoolValidate,0},
|
|
|
52eea9 |
+ {"ssl:priority", "", 0,0},
|
|
|
52eea9 |
# if USE_OPENSSL
|
|
|
52eea9 |
{"ssl:ca-path", "", ResMgr::DirReadable,ResMgr::NoClosure},
|
|
|
52eea9 |
{"ssl:crl-path", "", ResMgr::DirReadable,ResMgr::NoClosure},
|