-
Notifications
You must be signed in to change notification settings - Fork 8
[RELEASE-1.7][SRVKS-985] Add revision security defaults #186
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
Conversation
|
/hold |
|
Tests passed. Must gather failed: |
2e2cb4c to
c3b229e
Compare
| PodSpecInitContainers: Disabled, | ||
| PodSpecDNSPolicy: Disabled, | ||
| PodSpecDNSConfig: Disabled, | ||
| SecurePodDefaults: Disabled, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
isn't this something we can do upstream?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is done upstream. There is a link in the description. The PR here is a backport of the upstream work.
| if config.FromContextOrDefaults(ctx).Features.SecurePodDefaults == config.Enabled { | ||
| // Allow to opt out of more-secure defaults if SecurePodDefaults is enabled. | ||
| // This aligns with defaultSecurityContext in revision_defaults.go. | ||
| if in.SeccompProfile != nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need it here, since serving is creating/owing those, and not the serverless operator?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes this is for knative services. Eventing might need this for some user workloads too.
|
In serverless operator will the feature be enabled, via code, when a certain platform match was detected, @skonto ? |
Correct here is the PR at the S-O that I am using for testing:openshift-knative/serverless-operator#1862. |
|
/test 49-e2e-aws-ocp-49 |
| CheckK8sClientMinimumVersionOrDie(ctx, logger) | ||
| // HACK: should go away when we move away from < 4.11 releases | ||
| if err := CheckMinimumKubeVersion(kubeclient.Get(ctx).Discovery(), "1.24.0"); err == nil { | ||
| os.Setenv("OCP_SECCOMP_PROFILE_WITHOUT_SCC", "true") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is that our env-var? If so, I'd prefix it slightly different, to not confuse w/ actual OCP bits.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is internal not meant to be exposed.
|
|
||
| // CheckMinimumKubeVersion checks if current K8s version we are on is higher than the one passed. | ||
| // If an error is returned then the version is not higher than the minimum | ||
| func CheckMinimumKubeVersion(versioner discovery.ServerVersionInterface, version string) error { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why adding the func on this file?
the pkg/version has already the normalizeVersion func
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does not do what we want so we adapted it, we also have the same at the S-O side.
| return err | ||
| } | ||
|
|
||
| minimumVersion, err := semver.Make(normalizeVersion(version)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we could (for us) just hard-code here against 1.24, instead of passing in a version?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could but it is not much different.
| updatedSC.AllowPrivilegeEscalation = ptr.Bool(false) | ||
| } | ||
|
|
||
| if _, ok := os.LookupEnv("OCP_SECCOMP_PROFILE_WITHOUT_SCC"); ok && !skipSeccompProfile(ctx) { // Only apply the profile in 4.11+ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@skonto in 4.11 we only get warnings if the SecurityContext values are missing, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes if they are missing you get warnings in audit logs. We also got warnings in the controller logs since we do k8s api calls to create deployments.
|
/test 48-e2e-aws-ocp-48 |
105d6f8 to
b0bfd4d
Compare
|
/assign @ReToCode /hold not sure if we are going to merge it, check discussion on the related jira. |
|
/assign @mgencur |
ReToCode
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
| # Apply persistent volume claim needed, needed for the related e2e test. | ||
| oc apply -f ./test/config/pvc/pvc.yaml | ||
|
|
||
| oc adm policy add-scc-to-user privileged -z default -n serving-tests |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We merge that change, even if we do not merge the whole thing.
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: ReToCode, skonto The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
|
Closing in favour of #194, but we are keeping the changes around in case we need it later. |
We will enable the feature by default at the S-O side on OCP 4.11+ as we did with deprecated apis.
The feature flag is:
secure-pod-defaults."serving.knative.openshift.io/skipSeccompProfile"as a revision annotation that allows to skip setting seccomProfile for a service so it can run with the default image user. Since we support versions < 4.11 SeccompProfile is only set by default in versions > 4.10.