mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2025-02-25 18:55:31 -06:00
Ensure the crypt key is retrieved correctly on backend server restart. #8065
This commit is contained in:
parent
032583e280
commit
026c0d2389
@ -142,6 +142,12 @@ Override the default file path for the preferences customization at the containe
|
|||||||
/pgadmin4/preferences.json mapped file below for more information. See the format
|
/pgadmin4/preferences.json mapped file below for more information. See the format
|
||||||
of the `Preferences JSON file <https://www.pgadmin.org/docs/pgadmin4/latest/preferences.html#json-format>`_.
|
of the `Preferences JSON file <https://www.pgadmin.org/docs/pgadmin4/latest/preferences.html#json-format>`_.
|
||||||
|
|
||||||
|
**PGPASS_FILE**
|
||||||
|
|
||||||
|
*Default: <null>*
|
||||||
|
This varible should be set to if you want to pass password using pgpass
|
||||||
|
file for the servers added in pgadmin.
|
||||||
|
|
||||||
**GUNICORN_ACCESS_LOGFILE**
|
**GUNICORN_ACCESS_LOGFILE**
|
||||||
|
|
||||||
*Default: -* (stdout)
|
*Default: -* (stdout)
|
||||||
|
@ -242,7 +242,8 @@ WHERE db.oid = {0}""".format(did))
|
|||||||
"Could not find the specified database."
|
"Could not find the specified database."
|
||||||
))
|
))
|
||||||
|
|
||||||
if not get_crypt_key()[0]:
|
if not get_crypt_key()[0] and (
|
||||||
|
config.SERVER_MODE or not config.USE_OS_SECRET_STORAGE):
|
||||||
# the reason its not connected might be missing key
|
# the reason its not connected might be missing key
|
||||||
raise CryptKeyMissing()
|
raise CryptKeyMissing()
|
||||||
|
|
||||||
|
@ -28,13 +28,14 @@ def get_crypt_key():
|
|||||||
:return: the key
|
:return: the key
|
||||||
"""
|
"""
|
||||||
enc_key = current_app.keyManager.get()
|
enc_key = current_app.keyManager.get()
|
||||||
# if desktop mode and master pass disabled then use the password hash
|
# if desktop mode and master pass and local os secret is
|
||||||
|
# disabled then use the password hash
|
||||||
if not config.MASTER_PASSWORD_REQUIRED and\
|
if not config.MASTER_PASSWORD_REQUIRED and\
|
||||||
not config.USE_OS_SECRET_STORAGE and not config.SERVER_MODE:
|
not config.USE_OS_SECRET_STORAGE and not config.SERVER_MODE:
|
||||||
return True, current_user.password
|
return True, current_user.password
|
||||||
# if desktop mode and master pass enabled
|
# if desktop mode and master pass enabled
|
||||||
elif config.MASTER_PASSWORD_REQUIRED and \
|
elif (config.MASTER_PASSWORD_REQUIRED or config.USE_OS_SECRET_STORAGE) \
|
||||||
enc_key is None:
|
and enc_key is None:
|
||||||
return False, None
|
return False, None
|
||||||
elif not config.MASTER_PASSWORD_REQUIRED and config.SERVER_MODE and \
|
elif not config.MASTER_PASSWORD_REQUIRED and config.SERVER_MODE and \
|
||||||
'pass_enc_key' in session:
|
'pass_enc_key' in session:
|
||||||
|
@ -112,9 +112,11 @@ class PGUtilitiesMaintenanceFeatureTest(BaseFeatureTest):
|
|||||||
(By.CSS_SELECTOR,
|
(By.CSS_SELECTOR,
|
||||||
NavMenuLocators.tools_menu_css),
|
NavMenuLocators.tools_menu_css),
|
||||||
(By.CSS_SELECTOR, NavMenuLocators.maintenance_obj_css))
|
(By.CSS_SELECTOR, NavMenuLocators.maintenance_obj_css))
|
||||||
maintenance_obj = self.wait.until(EC.visibility_of_element_located(
|
self.wait.until(EC.visibility_of_element_located(
|
||||||
(By.CSS_SELECTOR, NavMenuLocators.maintenance_obj_css)))
|
(By.CSS_SELECTOR, NavMenuLocators.maintenance_obj_css)))
|
||||||
maintenance_obj.click()
|
self.page.retry_click(
|
||||||
|
(By.CSS_SELECTOR, NavMenuLocators.maintenance_obj_css),
|
||||||
|
(By.XPATH, NavMenuLocators.maintenance_operation))
|
||||||
|
|
||||||
self.assertFalse(self.page.check_utility_error(),
|
self.assertFalse(self.page.check_utility_error(),
|
||||||
'Binary path is not configured.')
|
'Binary path is not configured.')
|
||||||
|
Loading…
Reference in New Issue
Block a user