Skip to content

Conversation

@skonto
Copy link

@skonto skonto commented Feb 28, 2023

oc adm must-gather -- /usr/bin/gather_audit_logs
cd must-gather.local....
gunzip -r *
find ./ -type f -exec grep -l "violation" {} \; | xargs cat | grep violation
  • Introduces "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.

@openshift-ci openshift-ci bot requested review from alanfx and mgencur February 28, 2023 08:30
@skonto
Copy link
Author

skonto commented Feb 28, 2023

/hold

@skonto
Copy link
Author

skonto commented Feb 28, 2023

Tests passed. Must gather failed:

  * could not run steps: step e2e-aws-ocp-411 failed: "e2e-aws-ocp-411" post steps failed: "e2e-aws-ocp-411" pod "e2e-aws-ocp-411-gather-audit-logs" failed: the pod ci-op-ctmrhy2b/e2e-aws-ocp-411-gather-audit-logs failed after 5s (failed containers: place-entrypoint): ContainerFailed one or more containers exited
  * ```

@skonto skonto force-pushed the add_sec_default_1.7 branch from 2e2cb4c to c3b229e Compare February 28, 2023 12:03
PodSpecInitContainers: Disabled,
PodSpecDNSPolicy: Disabled,
PodSpecDNSConfig: Disabled,
SecurePodDefaults: Disabled,
Copy link
Member

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?

Copy link
Author

@skonto skonto Feb 28, 2023

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 {
Copy link
Member

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?

Copy link
Author

@skonto skonto Feb 28, 2023

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.

@matzew
Copy link
Member

matzew commented Feb 28, 2023

In serverless operator will the feature be enabled, via code, when a certain platform match was detected, @skonto ?

@skonto
Copy link
Author

skonto commented Feb 28, 2023

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.

@skonto
Copy link
Author

skonto commented Feb 28, 2023

/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")
Copy link
Member

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.

Copy link
Author

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 {
Copy link
Member

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

Copy link
Author

@skonto skonto Feb 28, 2023

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))
Copy link
Member

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?

Copy link
Author

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+
Copy link
Member

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?

Copy link
Author

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.

@skonto
Copy link
Author

skonto commented Mar 2, 2023

/test 48-e2e-aws-ocp-48
/test 412-e2e-aws-ocp-412

@skonto skonto force-pushed the add_sec_default_1.7 branch from 105d6f8 to b0bfd4d Compare March 2, 2023 12:16
@skonto
Copy link
Author

skonto commented Mar 2, 2023

/assign @ReToCode

/hold not sure if we are going to merge it, check discussion on the related jira.

@skonto
Copy link
Author

skonto commented Mar 2, 2023

/assign @mgencur

Copy link

@ReToCode ReToCode left a 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
Copy link

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.

@openshift-ci
Copy link

openshift-ci bot commented Mar 2, 2023

[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

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@ReToCode
Copy link

ReToCode commented Mar 6, 2023

Closing in favour of #194, but we are keeping the changes around in case we need it later.

@ReToCode ReToCode closed this Mar 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants