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

[docker-p4rt] limit privileged flag for p4rt container #17796

Merged
merged 1 commit into from
Jan 23, 2024

Conversation

maipbui
Copy link
Contributor

@maipbui maipbui commented Jan 16, 2024

Why I did it

HLD implementation: Container Hardening (sonic-net/SONiC#1364)

Work item tracking
  • Microsoft ADO (number only): 14807420

How I did it

Reduce linux capabilities in privileged flag

How to verify it

Check container's settings: Privileged is false and container only has default Linux caps, does not have extended caps.

admin@vlab-01:~$ docker inspect p4rt | grep Privi
            "Privileged": false,


admin@vlab-01:~$ docker exec -it p4rt bash
root@vlab-01:/# capsh --print
Current: cap_chown,cap_dac_override,cap_fowner,cap_fsetid,cap_kill,cap_setgid,cap_setuid,cap_setpcap,cap_net_bind_service,cap_net_raw,cap_sys_chroot,cap_mknod,cap_audit_write,cap_setfcap=ep

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

Link to config_db schema for YANG module changes

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

@maipbui maipbui changed the title [docker-p4rt limit privileged flag for p4rt container [docker-p4rt] limit privileged flag for p4rt container Jan 18, 2024
@qiluo-msft
Copy link
Collaborator

@bocon13 Could you help review?

@maipbui
Copy link
Contributor Author

maipbui commented Jan 23, 2024

@bocon13 could you help review?

Copy link
Contributor

@bocon13 bocon13 left a comment

Choose a reason for hiding this comment

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

Looks good to me. p4rt doesn’t need privileged mode.

@qiluo-msft qiluo-msft merged commit ff7c993 into sonic-net:master Jan 23, 2024
19 checks passed
@maipbui maipbui deleted the p4rt_priv branch January 23, 2024 19:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants