Skip to content

Commit

Permalink
Merge pull request #120 from abdosi/sudo_access
Browse files Browse the repository at this point in the history
What I did:
Changes to Use Redis Unix Socket if the user is root else default to TCP

Why I did:
With the changes in PR:sonic-net/sonic-buildimage#5289 access to redis unix socket is given to the redis group members or to the root. Many of sonic-util commands (especially in multi-asic) case use redis unix socket to connect to DB and thus those comamnd fails without providing sudo. This PR is continuation of PR: sonic-net/sonic-buildimage#7002 where we default to use TCP for Redis if user is not root in sonic-cfggen.

This should fix: sonic-net/sonic-buildimage#8501
  • Loading branch information
abdosi committed Apr 1, 2022
2 parents 96c0590 + 78f167e commit 653bdba
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/swsssdk/dbconnector.py
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ def __init__(self, use_unix_socket_path=False, namespace=None, decode_responses=
kwargs['decode_responses'] = True

self.dbintf = DBInterface(**kwargs)
self.use_unix_socket_path = use_unix_socket_path
self.use_unix_socket_path = True if use_unix_socket_path and os.getuid() == 0 else False

"""If the user don't give the namespace as input, it refers to the local namespace
where this application is run. (It could be a network namespace or linux host namesapce)
Expand Down

0 comments on commit 653bdba

Please sign in to comment.