Files
integ/security/python-keyring/python-keyring/no_keyring_password.patch
slin14 3533354c69 de-fuzz python-keyring patch
With rpm version < 4.13, patch cmd will create .orig file for fuzzy
patch in default. And this .orig file may lead to rpmbuild failure
"error: Installed (but unpackaged) file(s) found:"

Please visit below link to get more detail info:
https://bugs.launchpad.net/starlingx/+bug/1794611

Story: 2003917
Task: 26817

Change-Id: I455087544161e38160608b1fba27e00584c61feb
Signed-off-by: slin14 <shuicheng.lin@intel.com>
2018-10-09 23:07:55 +08:00

71 lines
3.2 KiB
Diff

diff --git a/keyring/backends/file.py b/keyring/backends/file.py
index f899880..ef6db1d 100644
--- a/keyring/backends/file.py
+++ b/keyring/backends/file.py
@@ -116,7 +116,7 @@ class BaseKeyring(FileBacked, KeyringBackend):
# create the file without group/world permissions
with open(self.file_path, 'w'):
pass
- user_read_write = 0o600
+ user_read_write = 0o644
os.chmod(self.file_path, user_read_write)
def delete_password(self, service, username):
@@ -172,12 +172,19 @@ class Encrypted(object):
def _get_new_password(self):
while True:
- password = getpass.getpass(
- "Please set a password for your new keyring: ")
- confirm = getpass.getpass('Please confirm the password: ')
- if password != confirm:
- sys.stderr.write("Error: Your passwords didn't match\n")
- continue
+#****************************************************************
+# Forging the Keyring password to allow automation and still keep
+# the password encoded. TODO to be revisited when Barbican keyring
+# Will be used with the complete PKI solution
+#****************************************************************
+# password = getpass.getpass(
+# "Please set a password for your new keyring: ")
+# confirm = getpass.getpass('Please confirm the password: ')
+# if password != confirm:
+# sys.stderr.write("Error: Your passwords didn't match\n")
+# continue
+ password = "Please set a password for your new keyring: "
+
if '' == password.strip():
# forbid the blank password
sys.stderr.write("Error: blank passwords aren't allowed.\n")
@@ -248,8 +255,15 @@ class EncryptedKeyring(Encrypted, BaseKeyring):
Unlock this keyring by getting the password for the keyring from the
user.
"""
- self.keyring_key = getpass.getpass(
- 'Please enter password for encrypted keyring: ')
+#****************************************************************
+# Forging the Keyring password to allow automation and still keep
+# the password encoded. TODO to be revisited when Barbican keyring
+# Will be used with the complete PKI solution
+#****************************************************************
+# self.keyring_key = getpass.getpass(
+# 'Please enter password for encrypted keyring: ')
+ self.keyring_key = "Please set a password for your new keyring: "
+
try:
ref_pw = self.get_password('keyring-setting', 'password reference')
assert ref_pw == 'password reference value'
diff --git a/keyring/util/platform_.py b/keyring/util/platform_.py
index dcdffea..53b9eae 100644
--- a/keyring/util/platform_.py
+++ b/keyring/util/platform_.py
@@ -19,7 +19,7 @@ def _data_root_Linux():
Use freedesktop.org Base Dir Specfication to determine storage
location.
"""
- fallback = os.path.expanduser('~/.local/share')
+ fallback = os.path.expanduser('/opt/platform/.keyring/')
root = os.environ.get('XDG_DATA_HOME', None) or fallback
return os.path.join(root, 'python_keyring')