-
Notifications
You must be signed in to change notification settings - Fork 304
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
HPCC-31574 Add option in Dali LDAP support to ignore default file user #18503
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -54,6 +54,7 @@ class CDaliLdapConnection: implements IDaliLdapConnection, public CInterface | |
Owned<ISecManager> ldapsecurity; | ||
StringAttr filesdefaultuser; | ||
StringAttr filesdefaultpassword; | ||
bool disableFilesDefaultUser; | ||
unsigned ldapflags; | ||
IDigitalSignatureManager * pDSM = nullptr; | ||
|
||
|
@@ -82,6 +83,7 @@ class CDaliLdapConnection: implements IDaliLdapConnection, public CInterface | |
{ | ||
filesdefaultuser.set(ldapprops->queryProp("@filesDefaultUser")); | ||
filesdefaultpassword.set(ldapprops->queryProp("@filesDefaultPassword")); | ||
disableFilesDefaultUser = ldapprops->getPropBool("@disableDefaultUser", false); | ||
|
||
try { | ||
ignoreSigPipe(); // LDAP can generate | ||
|
@@ -115,29 +117,36 @@ class CDaliLdapConnection: implements IDaliLdapConnection, public CInterface | |
return SecAccess_Full; | ||
|
||
|
||
Owned<ISecUser> user; | ||
StringBuffer username; | ||
StringBuffer password; | ||
if (udesc) | ||
{ | ||
udesc->getUserName(username); | ||
udesc->getPassword(password); | ||
user.setown(ldapsecurity->createUser(username)); | ||
user->setAuthenticateStatus(AS_AUTHENTICATED); // treat caller passing user as trusted | ||
} | ||
else | ||
{ | ||
DBGLOG("NULL UserDescriptor in daldap.cpp getPermissions('%s')", key); | ||
} | ||
logNullUser(nullptr); | ||
|
||
// If no user was provided, try to use the default user | ||
if (disableFilesDefaultUser || filesdefaultuser.isEmpty()) | ||
{ | ||
OWARNLOG("Default user missing or disabled, access denied for request %s %s", key, nullText(obj)); | ||
return SecAccess_None; // no access if no default user or disabled | ||
} | ||
|
||
if (0 == username.length()) | ||
{ | ||
username.append(filesdefaultuser); | ||
decrypt(password, filesdefaultpassword); | ||
OWARNLOG("Missing credentials, injecting deprecated filesdefaultuser for request %s %s", key, nullText(obj)); | ||
logNullUser(nullptr); | ||
OWARNLOG("Missing credentials, injecting deprecated filesdefaultuser (%s) for request %s %s", filesdefaultuser.str(), key, | ||
nullText(obj)); | ||
user.setown(ldapsecurity->createUser(username)); | ||
user->credentials().setPassword(password); // Force authentication of default user when used | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this really needed? What is it protecting against? The downside of using it is that the password needs to be included in the helm configuration - which is not secure. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The default files user is not currently included in our helm charts, so both the username and password are empty. |
||
} | ||
|
||
Owned<ISecUser> user = ldapsecurity->createUser(username); | ||
user->setAuthenticateStatus(AS_AUTHENTICATED); | ||
|
||
SecAccessFlags perm = SecAccess_None; | ||
unsigned start = msTick(); | ||
if (filescope) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
minor: password is not used by the rest of the function.