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-sflow] limit privileged flag for sflow container #16973

Merged
merged 1 commit into from
Oct 27, 2023

Conversation

maipbui
Copy link
Contributor

@maipbui maipbui commented Oct 23, 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 sflow sonic-mgmt tests
Check container's settings: Privileged is false and container only has default Linux caps, does not have extended caps.

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


admin@vlab-01:~$ docker exec -it sflow 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
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)

  • master.0-de01f2d00

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>
@qiluo-msft
Copy link
Collaborator

@padmanarayana @mint570 Could you help review?

@vivekrnv
Copy link
Contributor

@maipbui Did you test the change with sflow community tests? or make sure if the pipelines run the sflow tests

@jeff-yin
Copy link
Collaborator

Asked @padmanarayana and @Gokulnath-Raja to help review.

@maipbui
Copy link
Contributor Author

maipbui commented Oct 24, 2023

@maipbui Did you test the change with sflow community tests? or make sure if the pipelines run the sflow tests

@vivekrnv Do you mean sflow sonic-mgmt tests? If so, yes

@padmanarayana
Copy link
Contributor

Change looks good.

@Gokulnath-Raja
Copy link
Contributor

Asked @padmanarayana and @Gokulnath-Raja to help review.

I am fine with the changes

@qiluo-msft qiluo-msft merged commit 753fa0d into sonic-net:master Oct 27, 2023
17 checks passed
@maipbui maipbui deleted the sflow_priv branch October 27, 2023 18:53
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.

7 participants