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-dhcp-relay] limit privileged flag for dhcp_relay container #16817

Merged
merged 1 commit into from
Oct 13, 2023

Conversation

maipbui
Copy link
Contributor

@maipbui maipbui commented Oct 9, 2023

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

Run dhcprelay sonic-mgmt tests
Check container's settings: Privileged is false and container only has default Linux caps, does not have extended caps.

admin@vlab-05:~$ docker inspect dhcp_relay | grep Privilege
            "Privileged": false,
admin@vlab-05:~$ docker exec -it dhcp_relay bash
root@vlab-05:/# 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
Bounding set =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

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)

Signed-off-by: Mai Bui <maibui@microsoft.com>
@maipbui maipbui marked this pull request as ready for review October 10, 2023 14:21
@qiluo-msft
Copy link
Collaborator

In PR description "How to verify it" section, could you also check the container's privilege setting and paste the result?

@maipbui
Copy link
Contributor Author

maipbui commented Oct 10, 2023

In PR description "How to verify it" section, could you also check the container's privilege setting and paste the result?

Updated

@maipbui maipbui requested a review from kellyyeh October 12, 2023 21:26
@Blueve
Copy link
Contributor

Blueve commented Oct 13, 2023

@yaqiangz FYI

@qiluo-msft qiluo-msft merged commit 23badd6 into sonic-net:master Oct 13, 2023
16 checks passed
@maipbui maipbui deleted the dhcprelay_priv branch October 13, 2023 17:11
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.

5 participants