Skip to content

Commit

Permalink
Merge pull request #7675 from andresailer/80_fixHome
Browse files Browse the repository at this point in the history
[8.0] HTCondorCE: fix HOME for useSSL
  • Loading branch information
fstagni authored Jun 18, 2024
2 parents 2af7871 + bb1210b commit 34d5e05
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 11 deletions.
12 changes: 6 additions & 6 deletions src/DIRAC/Core/Security/Locations.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,9 +140,9 @@ def getCertificateAndKeyLocation():
if "X509_USER_CERT" in os.environ:
if os.path.exists(os.environ["X509_USER_CERT"]):
certfile = os.environ["X509_USER_CERT"]
if not certfile:
if os.path.exists(os.environ["HOME"] + "/.globus/usercert.pem"):
certfile = os.environ["HOME"] + "/.globus/usercert.pem"
if not certfile and (home := os.environ.get("HOME")):
if os.path.exists(home + "/.globus/usercert.pem"):
certfile = home + "/.globus/usercert.pem"

if not certfile:
return False
Expand All @@ -151,9 +151,9 @@ def getCertificateAndKeyLocation():
if "X509_USER_KEY" in os.environ:
if os.path.exists(os.environ["X509_USER_KEY"]):
keyfile = os.environ["X509_USER_KEY"]
if not keyfile:
if os.path.exists(os.environ["HOME"] + "/.globus/userkey.pem"):
keyfile = os.environ["HOME"] + "/.globus/userkey.pem"
if not keyfile and (home := os.environ.get("HOME")):
if os.path.exists(home + "/.globus/userkey.pem"):
keyfile = home + "/.globus/userkey.pem"

if not keyfile:
return False
Expand Down
14 changes: 9 additions & 5 deletions src/DIRAC/Resources/Computing/HTCondorCEComputingElement.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
from DIRAC.WorkloadManagementSystem.Client import PilotStatus
from DIRAC.WorkloadManagementSystem.Client.PilotManagerClient import PilotManagerClient
from DIRAC.FrameworkSystem.private.authorization.utils.Tokens import writeToTokenFile
from DIRAC.Core.Security.Locations import getCAsLocation, getCertificateAndKeyLocation
from DIRAC.Core.Security.Locations import getCAsLocation
from DIRAC.Resources.Computing.BatchSystems.Condor import HOLD_REASON_SUBCODE, subTemplate, parseCondorStatus

MANDATORY_PARAMETERS = ["Queue"]
Expand Down Expand Up @@ -250,14 +250,18 @@ def _executeCondorCommand(self, cmd, keepTokenFile=False):
}

if self.useSSLSubmission:
if not (certAndKey := getCertificateAndKeyLocation()):
return S_ERROR("You want to use SSL Submission, but no certificate and key are present")
certFile = "/home/dirac/.globus/usercert.pem"
keyFile = "/home/dirac/.globus/userkey.pem"
if not (os.path.exists(certFile) and os.path.exists(keyFile)):
return S_ERROR(
"You want to use SSL Submission, but certificate and key are not present in /home/dirac/.globus/"
)
if not (caFiles := getCAsLocation()):
return S_ERROR("You want to use SSL Submission, but no CA files are present")
htcEnv = {
"_condor_SEC_CLIENT_AUTHENTICATION_METHODS": "SSL",
"_condor_AUTH_SSL_CLIENT_CERTFILE": certAndKey[0],
"_condor_AUTH_SSL_CLIENT_KEYFILE": certAndKey[1],
"_condor_AUTH_SSL_CLIENT_CERTFILE": certFile,
"_condor_AUTH_SSL_CLIENT_KEYFILE": keyFile,
"_condor_AUTH_SSL_CLIENT_CADIR": caFiles,
"_condor_AUTH_SSL_SERVER_CADIR": caFiles,
"_condor_AUTH_SSL_USE_CLIENT_PROXY_ENV_VAR": "false",
Expand Down

0 comments on commit 34d5e05

Please sign in to comment.