Skip to content

Change DBConnector to connect redis with unix socket.#21345

Merged
qiluo-msft merged 8 commits intosonic-net:masterfrom
liuh-80:dev/liuh/redis_unix_connection
Jan 10, 2025
Merged

Change DBConnector to connect redis with unix socket.#21345
qiluo-msft merged 8 commits intosonic-net:masterfrom
liuh-80:dev/liuh/redis_unix_connection

Conversation

@liuh-80
Copy link
Contributor

@liuh-80 liuh-80 commented Jan 7, 2025

Change DBConnector to connect redis with unix socket.

Why I did it

Improve SONiC Redis security by switch to unix socket connection.

Work item tracking
  • Microsoft ADO: 30329015

How I did it

Change DBConnector parameter to connect redis with unix socket:
DBConnector(const std::string &dbName, unsigned int timeout_ms, bool isTcpConn = false);

How to verify it

Pass all UT.

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

  • 201811
  • 201911
  • 202006
  • 202012
  • 202106
  • 202111
  • 202205
  • 202211
  • 202305

Tested branch (Please provide the tested image version)

  • []

Description for the changelog

Change DBConnector to connect redis with unix socket.

Link to config_db schema for YANG module changes

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

@mssonicbld
Copy link
Collaborator

/azp run Azure.sonic-buildimage

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@liuh-80 liuh-80 marked this pull request as ready for review January 8, 2025 02:07
@liuh-80 liuh-80 requested a review from qiluo-msft January 8, 2025 02:07
from swsscommon import swsscommon
self.state_db = swsscommon.DBConnector("STATE_DB",
REDIS_TIMEOUT_USECS,
True)
Copy link
Collaborator

@qiluo-msft qiluo-msft Jan 10, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

True

since this file is vendor owned. please have a smaller PR and ask vendor to review. #Closed

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

@mssonicbld
Copy link
Collaborator

/azp run Azure.sonic-buildimage

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@qiluo-msft qiluo-msft merged commit 25b0732 into sonic-net:master Jan 10, 2025
VladimirKuk pushed a commit to Marvell-switching/sonic-buildimage that referenced this pull request Jan 21, 2025
Change DBConnector to connect redis with unix socket.

Why I did it
Improve SONiC Redis security by switch to unix socket connection.

How I did it
Change DBConnector parameter to connect redis with unix socket:
DBConnector(const std::string &dbName, unsigned int timeout_ms, bool isTcpConn = false);

How to verify it
Pass all UT.

Description for the changelog
Change DBConnector to connect redis with unix socket.
@tjchadaga tjchadaga mentioned this pull request Feb 4, 2025
11 tasks
qiluo-msft pushed a commit that referenced this pull request Feb 24, 2025
Why I did it
Reverting part of #21345, since Chassis DB connection from remote host (linecard) cannot use unix socket

How I did it
Continue to use TCP socket for chassis DB connection

How to verify it
Bring up BGP on chassis, which currently fails after change in #21345
miatttao pushed a commit to miatttao/sonic-buildimage that referenced this pull request Mar 5, 2025
Why I did it
Reverting part of sonic-net#21345, since Chassis DB connection from remote host (linecard) cannot use unix socket

How I did it
Continue to use TCP socket for chassis DB connection

How to verify it
Bring up BGP on chassis, which currently fails after change in sonic-net#21345
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.

4 participants