Skip to content

[docker-sflow] limit privileged flag for sflow container#16973

Merged
qiluo-msft merged 1 commit intosonic-net:masterfrom
maipbui:sflow_priv
Oct 27, 2023
Merged

[docker-sflow] limit privileged flag for sflow container#16973
qiluo-msft merged 1 commit intosonic-net:masterfrom
maipbui:sflow_priv

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)

@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

@dgsudharsan dgsudharsan requested a review from jeff-yin October 23, 2023 22:54
@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

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