Skip to content

Commit 444fef5

Browse files
authored
If user cannot be mapped to uid, continue as anonymous (#45)
* If user cannot be mapped to uid, continue as anonymous This allows anonymous users to access data via the root protocol. * If user cannot be mapped to uid, and the user was generated, continue as anonymous For names generated from DN or DN hash, treat the client as anonymous if the username cannot be found. If the name came from a grid-mapfile, fail if the username cannot be found. * If client used GSI authentication, but username was generated (DN or DN hash), continue as anonymous
1 parent 994b2e3 commit 444fef5

1 file changed

Lines changed: 22 additions & 0 deletions

File tree

src/UserSentry.hh

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,15 @@ public:
7979
return;
8080
}
8181

82+
// If we used GSI, but user was not mapped by VOMS or gridmap, consider the client anonymous
83+
if (strcmp("gsi", client->prot) == 0) {
84+
if (!IsGsiUserMapped(client)) {
85+
log.Emsg("UserSentry", "Anonymous GSI client; cannot change FS UIDs");
86+
m_is_anonymous = true;
87+
return;
88+
}
89+
}
90+
8291
// If we fail to get the username from the scitokens, then get it from
8392
// the depreciated way, client->name
8493
if (!got_token) {
@@ -97,6 +106,19 @@ public:
97106

98107
static bool IsCmsd() {return m_is_cmsd;}
99108

109+
static bool IsGsiUserMapped(const XrdSecEntity *client) {
110+
// If VOMS was used to map client, return true
111+
if (client->vorg) { return true; }
112+
113+
// If gridmap was used, return true
114+
std::string gridmap_name;
115+
auto gridmap_success = client->eaAPI->Get("gridmap.name", gridmap_name);
116+
if (gridmap_success && gridmap_name == "1") { return true; }
117+
118+
// User is a DN or DN hash, return false
119+
return false;
120+
}
121+
100122
void Init(const std::string username, XrdSysError &log)
101123
{
102124
struct passwd pwd, *result = nullptr;

0 commit comments

Comments
 (0)