36 extern XrdTlsContext *
xrdctx;
47const char *TraceID =
"Security";
56bool XrdHttpProtocol::InitSecurity() {
60 eDest.Say(
"Error instantiating crypto factory ssl",
"");
94XrdHttpProtocol::HandleAuthentication(
XrdLink* lp)
96 EPNAME(
"HandleAuthentication");
97 int rc_ssl = SSL_get_verify_result(ssl);
100 TRACEI(
DEBUG,
" SSL_get_verify_result returned :" << rc_ssl);
104 XrdTlsPeerCerts pc(SSL_get_peer_certificate(ssl),SSL_get_peer_cert_chain(ssl));
105 XrdCryptoX509Chain chain;
107 if ((!pc.hasCert()) ||
108 (myCryptoFactory && !myCryptoFactory->X509ParseStack()(&pc, &chain))) {
109 TRACEI(
DEBUG,
"No certificate found in peer chain.");
116 const char * dn = chain.
EECname();
117 const char * eechash = chain.
EEChash();
119 if (!dn || !eechash) {
122 TRACEI(
DEBUG,
"Failed to extract DN information.");
136 if (GetVOMSData(lp)) {
139 if (isRequiredXtractor) {
140 eDest.Emsg(epname,
"Failed extracting required VOMS info for DN: ",
147 auto retval = HandleGridMap(lp, eechash);
158XrdHttpProtocol::HandleGridMap(
XrdLink* lp,
const char * eechash)
169 SecEntity.eaAPI->Add(
"gridmap.name",
"1",
true);
172 TRACEI(ALL,
" Mapping name: " <<
SecEntity.moninfo <<
" Failed. err: " << mape);
175 eDest.Emsg(epname,
"Required gridmap mapping failed for DN:",
183 TRACEI(
DEBUG,
" Will fallback name to subject hash: " << eechash);
194 char *lnpos = strstr(
SecEntity.moninfo,
"/CN=");
200 char *lnpos2 = index(lnpos,
'/');
202 int l = ( lnpos2-lnpos < (int)
sizeof(bufname) ? lnpos2-lnpos : (int)
sizeof(bufname)-1 );
203 strncpy(bufname, lnpos, l);
208 strcpy(bufname2,
"unknown-");
209 for (
int i = (
int)strlen(bufname)-1; i >= 0; i--) {
210 if (isalnum(bufname[i])) {
212 bufname2[j] = bufname[i];
219 TRACEI(
DEBUG,
" Setting link name: '" << bufname2+j <<
"'");
220 lp->
setID(bufname2+j, 0);
229 for (
int i = (
int)strlen(
SecEntity.moninfo)-1; i >= 0; i--) {
246int XrdHttpProtocol::GetVOMSData(
XrdLink *lp)
262 int r = secxtractor->GetSecData(lp,
SecEntity, ssl);
270 TRACEI(ALL,
" Certificate data extraction failed: " <<
SecEntity.moninfo
271 <<
" Failed. err: " << r);
XrdSysTrace XrdHttpTrace("http")
A pragmatic implementation of the HTTP/DAV protocol for the Xrd framework.
XrdOucGMap * XrdOucgetGMap(XrdOucGMapArgs)
static XrdCryptoFactory * GetCryptoFactory(const char *factoryname)
void Cleanup(bool keepCA=0)
static char * gridmap
Gridmap file location. The same used by XrdSecGsi.
static XrdOucGMap * servGMap
The instance of the DN mapper. Created only when a valid path is given.
static bool compatNameGeneration
static bool isRequiredGridmap
XrdSecEntity SecEntity
Authentication area.
void setID(const char *userid, int procid)
const char * c_str() const