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)
175 eDest.
Emsg(epname,
"Required gridmap mapping failed for DN:",
183 TRACEI(
DEBUG,
" Will fallback name to subject hash: " << eechash);
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);
246int XrdHttpProtocol::GetVOMSData(
XrdLink *lp)
262 int r = secxtractor->GetSecData(lp,
SecEntity, ssl);
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)
virtual int dn2user(const char *dn, char *user, int ulen, time_t now=0)
const char * c_str() const
bool Add(XrdSecAttr &attr)
XrdSecEntityAttr * eaAPI
non-const API to attributes
char * name
Entity's name.
char * moninfo
Information for monitoring.
int Emsg(const char *esfx, int ecode, const char *text1, const char *text2=0)
void Say(const char *text1, const char *text2=0, const char *txt3=0, const char *text4=0, const char *text5=0, const char *txt6=0)