Skip to content

Commit

Permalink
Do not allow arbitary hostPath mounts via spec.extraMounts
Browse files Browse the repository at this point in the history
We are not using hostmount-anyuid scc, but having
it added in neutron rbac role was allowing
arbitary hostPath volume mounts via spec.extraMounts.

Removing hostmount-anyuid scc in order to not allow
arbitary hostPath volume mounts and avoid unnecessary
security hole[1].

[1] https://kubernetes.io/docs/concepts/storage/volumes/#hostpath
Related-Issue: OSPRH-10288
Closes-Issue: OSPRH-4297
  • Loading branch information
karelyatin committed Oct 8, 2024
1 parent 1a2449d commit 41b5ae7
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
1 change: 0 additions & 1 deletion config/rbac/role.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,6 @@ rules:
- security.openshift.io
resourceNames:
- anyuid
- hostmount-anyuid
resources:
- securitycontextconstraints
verbs:
Expand Down
4 changes: 2 additions & 2 deletions controllers/neutronapi_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ type NeutronAPIReconciler struct {
// +kubebuilder:rbac:groups="rbac.authorization.k8s.io",resources=roles,verbs=get;list;watch;create;update;patch
// +kubebuilder:rbac:groups="rbac.authorization.k8s.io",resources=rolebindings,verbs=get;list;watch;create;update;patch
// service account permissions that are needed to grant permission to the above
// +kubebuilder:rbac:groups="security.openshift.io",resourceNames=anyuid;hostmount-anyuid,resources=securitycontextconstraints,verbs=use
// +kubebuilder:rbac:groups="security.openshift.io",resourceNames=anyuid,resources=securitycontextconstraints,verbs=use
// +kubebuilder:rbac:groups="",resources=pods,verbs=create;delete;get;list;patch;update;watch;patch

// Reconcile - neutron api
Expand Down Expand Up @@ -763,7 +763,7 @@ func (r *NeutronAPIReconciler) reconcileNormal(ctx context.Context, instance *ne
rbacRules := []rbacv1.PolicyRule{
{
APIGroups: []string{"security.openshift.io"},
ResourceNames: []string{"anyuid", "hostmount-anyuid"},
ResourceNames: []string{"anyuid"},
Resources: []string{"securitycontextconstraints"},
Verbs: []string{"use"},
},
Expand Down

0 comments on commit 41b5ae7

Please sign in to comment.