Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Control usage of unix socket on DB read. #7002

Merged
merged 1 commit into from
Mar 10, 2021

Conversation

judyjoseph
Copy link
Contributor

Why I did it

Closes issue #6982.
The issue was root caused as we were using the unix_socket for reading from DB as a default mechanism (#5250). The redis unix socket is created as follows.

admin@str--acs-1:~$ ls -lrt /var/run/redis/redis.sock 
srwxrw---- 1 root redis 0 Mar  6 01:57 /var/run/redis/redis.sock

So it used to work fine for the user "root" or if user is part of redis group ( admin was made part of redis group by default )

How I did it

Check if the user is with sudo permissions then use the redis unix socket, else fallback to tcp socket.

How to verify it

Checked "show running all" command from a user which is not part of redis group.

Which release branch to backport (provide reason below if selected)

  • 201811
  • [ x] 201911
  • [ x] 202006
  • [x ] 202012

Description for the changelog

A picture of a cute animal (not mandatory but encouraged)

@lguohan lguohan merged commit a09a85b into sonic-net:master Mar 10, 2021
lguohan pushed a commit that referenced this pull request Mar 10, 2021
…sing sudo. (#7002)

Closes issue #6982.
The issue was root caused as we were using the unix_socket for reading from DB as a default mechanism (#5250). The redis unix socket is created as follows.

admin@str--acs-1:~$ ls -lrt /var/run/redis/redis.sock 
srwxrw---- 1 root redis 0 Mar  6 01:57 /var/run/redis/redis.sock
So it used to work fine for the user "root" or if user is part of redis group ( admin was made part of redis group by default )

Check if the user is with sudo permissions then use the redis unix socket, else fallback to tcp socket.
abdosi pushed a commit that referenced this pull request Mar 10, 2021
…sing sudo. (#7002)

Closes issue #6982.
The issue was root caused as we were using the unix_socket for reading from DB as a default mechanism (#5250). The redis unix socket is created as follows.

admin@str--acs-1:~$ ls -lrt /var/run/redis/redis.sock 
srwxrw---- 1 root redis 0 Mar  6 01:57 /var/run/redis/redis.sock
So it used to work fine for the user "root" or if user is part of redis group ( admin was made part of redis group by default )

Check if the user is with sudo permissions then use the redis unix socket, else fallback to tcp socket.
@judyjoseph judyjoseph deleted the fix_show_run branch March 10, 2021 21:30
yxieca added a commit that referenced this pull request Mar 11, 2021
raphaelt-nvidia pushed a commit to raphaelt-nvidia/sonic-buildimage that referenced this pull request May 23, 2021
…sing sudo. (sonic-net#7002)

Closes issue sonic-net#6982.
The issue was root caused as we were using the unix_socket for reading from DB as a default mechanism (sonic-net#5250). The redis unix socket is created as follows.

admin@str--acs-1:~$ ls -lrt /var/run/redis/redis.sock 
srwxrw---- 1 root redis 0 Mar  6 01:57 /var/run/redis/redis.sock
So it used to work fine for the user "root" or if user is part of redis group ( admin was made part of redis group by default )

Check if the user is with sudo permissions then use the redis unix socket, else fallback to tcp socket.
carl-nokia pushed a commit to carl-nokia/sonic-buildimage that referenced this pull request Aug 7, 2021
…sing sudo. (sonic-net#7002)

Closes issue sonic-net#6982.
The issue was root caused as we were using the unix_socket for reading from DB as a default mechanism (sonic-net#5250). The redis unix socket is created as follows.

admin@str--acs-1:~$ ls -lrt /var/run/redis/redis.sock 
srwxrw---- 1 root redis 0 Mar  6 01:57 /var/run/redis/redis.sock
So it used to work fine for the user "root" or if user is part of redis group ( admin was made part of redis group by default )

Check if the user is with sudo permissions then use the redis unix socket, else fallback to tcp socket.
abdosi added a commit to abdosi/sonic-py-swsssdk that referenced this pull request Apr 1, 2022
…s unix socket is given to the redis group members.

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

Signed-off-by: Abhishek Dosi <abdosi@microsoft.com>
abdosi added a commit to sonic-net/sonic-py-swsssdk that referenced this pull request Apr 1, 2022
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
abdosi added a commit to sonic-net/sonic-py-swsssdk that referenced this pull request Apr 1, 2022
…s unix socket is given to the redis group members.

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

Signed-off-by: Abhishek Dosi <abdosi@microsoft.com>
abdosi added a commit that referenced this pull request Apr 1, 2022
9ce4d19d5a199cffe2933d80e343a80ded398b4a (HEAD -> 201911, origin/201911) With the changes in PR:#5289 access to redis unix socket is given to the redis group members. 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: #7002 where we default to use TCP for Redis if user is not root

Signed-off-by: Abhishek Dosi <abdosi@microsoft.com>
abdosi added a commit to abdosi/sonic-buildimage that referenced this pull request Apr 1, 2022
78f167e4728f939712b3f3ea550949e2ea675fec With the changes in PR:sonic-net#5289 access to redis unix socket is given to the redis group members. 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#7002 where we default to use TCP for Redis if user is not root

Signed-off-by: Abhishek Dosi <abdosi@microsoft.com>
abdosi added a commit that referenced this pull request Apr 2, 2022
*[Submodule update] sonic-py-swssdk

78f167e4728f939712b3f3ea550949e2ea675fec With the changes in PR:#5289 access to redis unix socket is given to the redis group members. 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: #7002 where we default to use TCP for Redis if user is not root

Signed-off-by: Abhishek Dosi <abdosi@microsoft.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants