Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow clients without certificates to downgrade to non-TLS connection #2031

Merged
merged 2 commits into from
Jun 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/XrdCl/XrdClTls.cc
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ namespace XrdCl
//----------------------------------------------------------------------
// we only need one instance of TLS
//----------------------------------------------------------------------
std::string emsg;
std::string emsg = "Failed to initialize TLS context";
static XrdTlsContext tlsContext( 0, 0, GetCaDir(), 0, 0, &emsg );

//----------------------------------------------------------------------
Expand Down
13 changes: 11 additions & 2 deletions src/XrdCl/XrdClXRootDTransport.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1758,6 +1758,13 @@ namespace XrdCl
XRootDChannelInfo *info = 0;
channelData.Get( info );

XrdCl::Env *env = XrdCl::DefaultEnv::GetEnv();
int notlsok = DefaultNoTlsOK;
env->GetInt( "NoTlsOK", notlsok );

if( notlsok )
return info->encrypted;

// Did the server instructed us to switch to TLS right away?
if( info->serverFlags & kXR_gotoTLS )
{
Expand Down Expand Up @@ -1894,8 +1901,10 @@ namespace XrdCl
request->requestid = htons(kXR_protocol);
request->clientpv = htonl(kXR_PROTOCOLVERSION);
request->flags = ClientProtocolRequest::kXR_secreqs |
ClientProtocolRequest::kXR_bifreqs |
ClientProtocolRequest::kXR_ableTLS;
ClientProtocolRequest::kXR_bifreqs;

if (info->encrypted)
request->flags |= ClientProtocolRequest::kXR_ableTLS;

bool nodata = false;
if( expect & ClientProtocolRequest::kXR_ExpBind )
Expand Down