Skip to content

Commit b1cbf7c

Browse files
mgr/smb: filter out password fields in sqlite store
Currently, all of ceph orchestration stores sensitive data in the mon config-key store. Keep doing that by eliding passwords in the sqlite store but retaining them in the mon based store. Perhaps, in the future we can even use a 'vault' type store for even better sensitive info retention. Signed-off-by: John Mulligan <[email protected]>
1 parent 30ed498 commit b1cbf7c

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

src/pybind/mgr/smb/sqlite_store.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -479,13 +479,30 @@ class MirrorJoinAuths(Mirror):
479479
def __init__(self, store: ConfigStore) -> None:
480480
super().__init__('join_auths', store)
481481

482+
def filter_object(self, obj: Simplified) -> Simplified:
483+
"""Filter join auth data for sqlite3 store."""
484+
filtered = copy.deepcopy(obj)
485+
if 'auth' in filtered:
486+
filtered['auth'].pop('password', None)
487+
return filtered
488+
482489

483490
class MirrorUsersAndGroups(Mirror):
484491
"""Mirroring configuration for objects in the users_and_groups namespace."""
485492

486493
def __init__(self, store: ConfigStore) -> None:
487494
super().__init__('users_and_groups', store)
488495

496+
def filter_object(self, obj: Simplified) -> Simplified:
497+
"""Filter join users and groups data for sqlite3 store."""
498+
filtered = copy.deepcopy(obj)
499+
for user in filtered.get('values', {}).get('users', []):
500+
# retain the key, to have the capability of knowing it was part of
501+
# this row, but remove the value from this object
502+
if 'password' in user:
503+
user['password'] = ''
504+
return filtered
505+
489506

490507
def _tables(
491508
*,

0 commit comments

Comments
 (0)