gplv3/python-keyring/python-keyring/no_keyring_password.patch

71 lines
3.3 KiB
Diff

Index: keyring-3.2/keyring/backends/file.py
===================================================================
--- keyring-3.2.orig/keyring/backends/file.py
+++ keyring-3.2/keyring/backends/file.py
@@ -114,7 +114,7 @@ class BaseKeyring(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):
@@ -188,12 +188,19 @@ class EncryptedKeyring(BaseKeyring):
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")
@@ -233,8 +240,15 @@ class EncryptedKeyring(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'
Index: keyring-3.2/keyring/util/platform_.py
===================================================================
--- keyring-3.2.orig/keyring/util/platform_.py
+++ keyring-3.2/keyring/util/platform_.py
@@ -16,7 +16,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')