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

[9.0] fix: useLegacyAdapter should check the VO #7347

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
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
13 changes: 12 additions & 1 deletion src/DIRAC/ConfigurationSystem/Client/PathFinder.py
Original file line number Diff line number Diff line change
Expand Up @@ -256,9 +256,20 @@ def useLegacyAdapter(system, service=None) -> bool:

:return: bool -- True if DiracX should be used
"""
from DIRAC.Core.Security.ProxyInfo import getProxyInfo

# Check if DiracX is enabled for this service
system, service = divideFullName(system, service)
value = gConfigurationData.extractOptionFromCFG(f"/DiracX/LegacyClientEnabled/{system}/{service}")
return (value or "no").lower() in ("y", "yes", "true", "1")
isServiceEnabled = (value or "no").lower() in ("y", "yes", "true", "1")
aldbr marked this conversation as resolved.
Show resolved Hide resolved
# Check if DiracX is enabled for this VO
result = getProxyInfo()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What happens if we're using a host certificate rather than a proxy?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How does diracx handle requests coming from a host?

if not result["OK"]:
return False
value = gConfigurationData.extractOptionFromCFG(f"/Registry/Groups/{result['Value']['group']}/VO")
isVOEnabled = value not in getDisabledDiracxVOs()

return isServiceEnabled and isVOEnabled


def getServiceURL(system, service=None, setup=False):
Expand Down
2 changes: 1 addition & 1 deletion src/DIRAC/Core/Security/DiracX.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ def DiracXClient() -> _DiracClient:
proxyLocation = getDefaultProxyLocation()
diracxToken = diracxTokenFromPEM(proxyLocation)
if not diracxToken:
raise ValueError(f"No dirax token in the proxy file {proxyLocation}")
raise ValueError(f"No diracx token in the proxy file {proxyLocation}")

with NamedTemporaryFile(mode="wt") as token_file:
token_file.write(json.dumps(diracxToken))
Expand Down
Loading