Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
1 change: 1 addition & 0 deletions environment-py3.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ dependencies:
- numpy
- pexpect >=4.0.1
- pillow
- prompt-toolkit >=3,<4
- psutil >=4.2.0
- pyasn1 >0.4.1
- pyasn1-modules
Expand Down
1 change: 1 addition & 0 deletions environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ dependencies:
- numpy >=1.10.1,<1.16 # Limit to 1.15 as Python 2 pylint has bugs with numpy 1.16
- pexpect >=4.0.1
- pillow
- prompt_toolkit
- psutil >=4.2.0
- pyasn1 >0.4.1
- pyasn1-modules
Expand Down
8 changes: 5 additions & 3 deletions src/DIRAC/FrameworkSystem/Client/ProxyGeneration.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from __future__ import print_function

import sys
import getpass
from prompt_toolkit import prompt
from DIRAC import S_OK, S_ERROR, gLogger
from DIRAC.Core.Base import Script
from DIRAC.Core.Utilities.NTP import getClockDeviation
Expand Down Expand Up @@ -297,11 +297,13 @@ def generateProxy(params):
# First try reading the key from the file
retVal = testChain.loadKeyFromFile(params.keyLoc, password=params.userPasswd) # XXX why so commented?
if not retVal['OK']:
passwdPrompt = "Enter Certificate password:"
if params.stdinPasswd:
userPasswd = sys.stdin.readline().strip("\n")
else:
userPasswd = getpass.getpass(passwdPrompt)
try:
userPasswd = prompt(u"Enter Certificate password: ", is_password=True)
except KeyboardInterrupt:
return S_ERROR("Caught KeyboardInterrupt, exiting...")
params.userPasswd = userPasswd

# Find location
Expand Down
8 changes: 5 additions & 3 deletions src/DIRAC/FrameworkSystem/Client/ProxyUpload.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from __future__ import absolute_import
from __future__ import division
import sys
import getpass
from prompt_toolkit import prompt
import DIRAC

from DIRAC import gLogger
Expand Down Expand Up @@ -129,11 +129,13 @@ def uploadProxy(params):
testChain = X509Chain()
retVal = testChain.loadKeyFromFile(keyLoc, password=params.userPasswd)
if not retVal['OK']:
passwdPrompt = "Enter Certificate password:"
if params.stdinPasswd:
userPasswd = sys.stdin.readline().strip("\n")
else:
userPasswd = getpass.getpass(passwdPrompt)
try:
userPasswd = prompt(u"Enter Certificate password: ", is_password=True)
except KeyboardInterrupt:
return S_ERROR("Caught KeyboardInterrupt, exiting...")
params.userPasswd = userPasswd

DIRAC.gLogger.info("Loading cert and key")
Expand Down