Open ljkiraly opened 2 years ago
Based on latest test result the example security settings applied in forwarder-vpp image and test manifest file works with SR-IOV configuration also: https://github.com/networkservicemesh/integration-k8s-packet/actions/runs/2705228841
@ljkiraly Is this still actual?
Capability settings for binaries added to Dockerfiles used to build NSM images: cmd-forwarder-vpp/681 cmd-nsmgr/547
Example manifests (forwarder-vpp, nsmgr) extended with security context settings to run as non-root user, with minimal set of privileges and capabilities: deployments-k8s/7526
The latest PR depends on first two that's why in draft state. One more step is missing to completion: changing any example manifest in deployments-k8s/apps to test with restricted privileges. /Laszlo
During the implementation of security hardening we found some settings which should be recommended for NSM users and maybe implemented by NSM.
The aim was to run containers and pods with least privileges. When deploying NSM images the containers should run as non root user and with minimal set of capabilities. It is also preferred to prevent writing the root file system (readOnlyRootFilesystem: true).
Most of the elements does not need any extra capability. In some cases it is hard to find the minimum set of capabilities.
Using this example Dockerfile an image can be built based on forwarder-vpp. In this new image a user is created and set as default. Also a minimum set of capability was added to the binaries:
In example manifest files the security context properties should specify the user and the capabilities. If no default user is set in the image the user and/or group can be configured by runAsUser/runAsGroup. If the default user is specified in the container image this setting can be overridden with runAsUser/runAsGroup properties.
Note that these capabilities set in forwarder-vpp image were not fully tested with SR-IOV configuration (some help needed in this area to figure out if additional capabilities are required).
-- Laszlo