Skip to content
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

Create an ACM policy set for Advanced Cluster Security Secured Clusters #438

Merged

Conversation

gparvin
Copy link
Member

@gparvin gparvin commented Dec 8, 2023

This takes part of the OPP Policy Set and organizes a solution that only applies the ACS Secured Clusters to ACM OpenShift managed clusters.

Refs:


## Installation

The ACS PolicySet for Secured Clusters contains two `PolicySets` that will be deployed.i
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
The ACS PolicySet for Secured Clusters contains two `PolicySets` that will be deployed.i
The ACS PolicySet for Secured Clusters contains two `PolicySets` that will be deployed.

Prior to applying the `PolicySet`, perform these steps:

1. To allow for subscriptions to be applied below you must apply and set to enforce the policy [policy-configure-subscription-admin-hub.yaml](https://github.com/open-cluster-management-io/policy-collection/blob/main/community/CM-Configuration-Management/policy-configure-subscription-admin-hub.yaml).
2. Install the Policy generator Kustomize plugin by following the [installation instructions](https://github.com/stolostron/policy-generator-plugin#installation). It is recommended to use Kustomize v4.5+.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
2. Install the Policy generator Kustomize plugin by following the [installation instructions](https://github.com/stolostron/policy-generator-plugin#installation). It is recommended to use Kustomize v4.5+.
2. Install the Policy generator Kustomize plugin by following the [installation instructions](https://github.com/open-cluster-management-io/policy-generator-plugin#installation). It is recommended to use Kustomize v4.5+.


Prior to applying the `PolicySet`, perform these steps:

1. To allow for subscriptions to be applied below you must apply and set to enforce the policy [policy-configure-subscription-admin-hub.yaml](https://github.com/open-cluster-management-io/policy-collection/blob/main/community/CM-Configuration-Management/policy-configure-subscription-admin-hub.yaml).
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This only applies if using App Sub, so maybe this is not a required step.


1. To allow for subscriptions to be applied below you must apply and set to enforce the policy [policy-configure-subscription-admin-hub.yaml](https://github.com/open-cluster-management-io/policy-collection/blob/main/community/CM-Configuration-Management/policy-configure-subscription-admin-hub.yaml).
2. Install the Policy generator Kustomize plugin by following the [installation instructions](https://github.com/stolostron/policy-generator-plugin#installation). It is recommended to use Kustomize v4.5+.
3. Policies are installed to the `policies` namespace. i
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
3. Policies are installed to the `policies` namespace. i
3. Policies are installed to the `policies` namespace.

3. Policies are installed to the `policies` namespace. i
Make sure the placement bindings match this namespace for the hub and other managed clusters.
Example yaml to apply a ManagedClusterSetBinding for the policies namespace.
```apiVersion: cluster.open-cluster-management.io/v1beta2
Copy link
Member

@mprahl mprahl May 16, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
```apiVersion: cluster.open-cluster-management.io/v1beta2
```yaml
apiVersion: cluster.open-cluster-management.io/v1beta2

Comment on lines 60 to 61
clusterName: |
{{ fromSecret "open-cluster-management-agent" "hub-kubeconfig-secret" "cluster-name" | base64dec }}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
clusterName: |
{{ fromSecret "open-cluster-management-agent" "hub-kubeconfig-secret" "cluster-name" | base64dec }}
clusterName: {{hub .ManagedClusterName hub}}

each managed cluster.
name: acs-sensors-hub-info
placement:
placementPath: placement/hub-placement.yaml
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you could now directly define the cluster selector in the Policy Generator file instead of a placement file:
https://github.com/stolostron/policy-generator-plugin/blob/3ef4ab89c4cecd0012792c9ab886d9f7e6eb3da2/docs/policygenerator-reference.yaml#L133-L142

This has the benefit of getting those default tolerations such as cluster unavailable for free in newer Policy Generator versions.

spec: {}
---
apiVersion: operators.coreos.com/v1alpha1
kind: Subscription
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Once ACM 2.11 is out, I recommend changing this to OperatorPolicy so that the status information is much richer.

@gparvin gparvin force-pushed the sensors-policyset branch 2 times, most recently from cbe5fd4 to f427160 Compare May 16, 2024 20:43

## Prerequisites
To install Advanced Cluster Security Secured Clusters using this PolicySet,
you must first have already installed your Advanced Cluster Security Central Server.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
you must first have already installed your Advanced Cluster Security Central Server.
you must have already installed your Advanced Cluster Security Central Server.

manifests:
- path: input-sensor/acs-check-certificates.yaml
- name: policy-advanced-managed-cluster-security
consolidateManifests: false
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Setting this to false means the policy will have a lot of ConfigurationPolicies. I think these could all be in the same ConfigurationPolicy. Perhaps you could have one ConfigurationPolicy for managing the operator installation (to be replaced in 2.11) and the other could be managing the content in the stackrox namespace. Then you could use a policy dependency if you wanted to so that the first policy must be compliant before the second one activates.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I played around with this some yesterday and liked it set to false best. I can play around with some more re-organization too since I would like it to be a bit more streamlined.

- {key: name, operator: In, values: ["local-cluster"]}
- description: The Advanced Cluster Security components distributed to all OpenShift
managed clusters to secure the clusters.
name: acs-sensor-clusters
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it worth having this additional policy set if it's just going to contain one policy?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like having the PolicySet even if there is only one policy.

This takes part of the OPP Policy Set and organizes a solution that
only applies the ACS Secured Clusters to ACM OpenShift managed clusters.

Refs:
 - https://issues.redhat.com/browse/ACM-8934

Signed-off-by: Gus Parvin <gparvin@redhat.com>
@kylape
Copy link

kylape commented May 21, 2024

I tried this PR out again just now, and I can confirm that it no longer requires the other PolicySet as it did before. The instructions were easy to follow as well.

Copy link

openshift-ci bot commented May 22, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: gparvin, mprahl

The full list of commands accepted by this bot can be found here.

The pull request process is described here

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

@openshift-merge-bot openshift-merge-bot bot merged commit 88e602a into open-cluster-management-io:main May 22, 2024
3 checks passed
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.

3 participants