-
Notifications
You must be signed in to change notification settings - Fork 255
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Create an ACM policy set for Advanced Cluster Security Secured Clusters
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 <[email protected]>
- Loading branch information
1 parent
a912880
commit 88e602a
Showing
8 changed files
with
242 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
49 changes: 49 additions & 0 deletions
49
policygenerator/policy-sets/community/acs-secure/README.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
# Advanced Cluster Security PolicySet for Secured Clusters | ||
|
||
## Prerequisites | ||
|
||
To install Advanced Cluster Security Secured Clusters using this PolicySet, | ||
you must have already installed your Advanced Cluster Security Central Server. | ||
The policies make the following assumptions: | ||
|
||
- RHACS is installed on the RHACM hub and the ACS init bundle secrets are created | ||
in the `stackrox` namespace. | ||
- RHACS is installed on the RHACM hub and the ACS Central Server `Route` resource | ||
exists in the `stackrox` namespace. | ||
- An install of Red Hat Advanced Cluster Management for Kubernetes version 2.8 | ||
or newer is required. | ||
|
||
|
||
## Installation | ||
|
||
The ACS PolicySet for Secured Clusters contains two `PolicySets` that will be deployed. | ||
The `PolicySets` install RHACS Secured Clusters onto all OpenShift clusters that are | ||
managed by RHACM except for the RHACM hub cluster. If you want to install the RHACS | ||
Secured Cluster component to the RHACM hub, that must be done separately. | ||
|
||
Prior to applying the `PolicySet`, perform these steps: | ||
|
||
1. 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+. | ||
2. Policies are installed to the `policies` namespace. | ||
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. | ||
|
||
```yaml | ||
apiVersion: cluster.open-cluster-management.io/v1beta2 | ||
kind: ManagedClusterSetBinding | ||
metadata: | ||
name: default | ||
namespace: policies | ||
spec: | ||
clusterSet: default | ||
``` | ||
```bash | ||
oc apply -f managed-cluster.yaml | ||
``` | ||
|
||
Apply the policies using the kustomize command or subscribing to a fork of the repository and pointing to this directory. See the details for using the Policy Generator for [more information](https://github.com/stolostron/policy-collection/tree/main/policygenerator). The command to run is `kustomize build --enable-alpha-plugins | oc apply -f -` | ||
|
||
**Note**: If the RHACS `Route` or certificate bundles are not available on the RHACM | ||
hub cluster, you must edit the policy resources to make sure these resources are | ||
available in the `policies` namespace. | ||
|
10 changes: 10 additions & 0 deletions
10
policygenerator/policy-sets/community/acs-secure/input-sensor/acs-check-certificates.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
apiVersion: policy.open-cluster-management.io/v1 | ||
kind: CertificatePolicy | ||
metadata: | ||
name: acs-bundle-certificates | ||
spec: | ||
namespaceSelector: | ||
include: ["policies"] | ||
remediationAction: inform | ||
severity: high | ||
minimumDuration: 720h |
37 changes: 37 additions & 0 deletions
37
policygenerator/policy-sets/community/acs-secure/input-sensor/policy-acs-sync-resources.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
apiVersion: v1 | ||
data: '{{ copySecretData "stackrox" "admission-control-tls" }}' | ||
kind: Secret | ||
metadata: | ||
labels: | ||
certificate_key_name: admission-control-cert.pem | ||
name: admission-control-tls | ||
namespace: policies | ||
type: Opaque | ||
--- | ||
apiVersion: v1 | ||
data: '{{ copySecretData "stackrox" "collector-tls" }}' | ||
kind: Secret | ||
metadata: | ||
labels: | ||
certificate_key_name: collector-cert.pem | ||
name: collector-tls | ||
namespace: policies | ||
type: Opaque | ||
--- | ||
apiVersion: v1 | ||
data: '{{ copySecretData "stackrox" "sensor-tls" }}' | ||
kind: Secret | ||
metadata: | ||
labels: | ||
certificate_key_name: sensor-cert.pem | ||
name: sensor-tls | ||
namespace: policies | ||
type: Opaque | ||
--- | ||
apiVersion: v1 | ||
data: | ||
acs-host: '{{ (lookup "route.openshift.io/v1" "Route" "stackrox" "central").spec.host }}:443' | ||
kind: ConfigMap | ||
metadata: | ||
name: acs-config | ||
namespace: policies |
72 changes: 72 additions & 0 deletions
72
...licy-sets/community/acs-secure/input-sensor/policy-advanced-managed-cluster-security.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
apiVersion: v1 | ||
kind: Namespace | ||
metadata: | ||
name: stackrox | ||
--- | ||
apiVersion: v1 | ||
kind: Namespace | ||
metadata: | ||
name: rhacs-operator | ||
--- | ||
apiVersion: operators.coreos.com/v1 | ||
kind: OperatorGroup | ||
metadata: | ||
name: rhacs-operator-group | ||
namespace: rhacs-operator | ||
spec: {} | ||
--- | ||
apiVersion: operators.coreos.com/v1alpha1 | ||
kind: Subscription | ||
metadata: | ||
name: rhacs-operator | ||
namespace: rhacs-operator | ||
spec: | ||
channel: stable | ||
installPlanApproval: Automatic | ||
name: rhacs-operator | ||
source: redhat-operators | ||
sourceNamespace: openshift-marketplace | ||
--- | ||
apiVersion: v1 | ||
data: '{{hub copySecretData "policies" "admission-control-tls" hub}}' | ||
kind: Secret | ||
metadata: | ||
name: admission-control-tls | ||
namespace: stackrox | ||
type: Opaque | ||
--- | ||
apiVersion: v1 | ||
data: '{{hub copySecretData "policies" "collector-tls" hub}}' | ||
kind: Secret | ||
metadata: | ||
name: collector-tls | ||
namespace: stackrox | ||
type: Opaque | ||
--- | ||
apiVersion: v1 | ||
data: '{{hub copySecretData "policies" "sensor-tls" hub}}' | ||
kind: Secret | ||
metadata: | ||
name: sensor-tls | ||
namespace: stackrox | ||
type: Opaque | ||
--- | ||
apiVersion: platform.stackrox.io/v1alpha1 | ||
kind: SecuredCluster | ||
metadata: | ||
namespace: stackrox | ||
name: stackrox-secured-cluster-services | ||
spec: | ||
clusterName: '{{hub .ManagedClusterName hub}}' | ||
auditLogs: | ||
collection: Auto | ||
centralEndpoint: '{{hub fromConfigMap "" "acs-config" "acs-host" hub}}' | ||
admissionControl: | ||
listenOnCreates: false | ||
listenOnEvents: true | ||
listenOnUpdates: false | ||
perNode: | ||
collector: | ||
collection: EBPF | ||
imageFlavor: Regular | ||
taintToleration: TolerateTaints |
17 changes: 17 additions & 0 deletions
17
...policy-sets/community/acs-secure/input-sensor/policy-advanced-managed-cluster-status.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: sensor | ||
namespace: stackrox | ||
status: | ||
conditions: | ||
- status: "True" | ||
type: Available | ||
--- | ||
apiVersion: apps/v1 | ||
kind: DaemonSet | ||
metadata: | ||
name: collector | ||
namespace: stackrox | ||
status: | ||
numberMisscheduled: 0 |
4 changes: 4 additions & 0 deletions
4
policygenerator/policy-sets/community/acs-secure/kustomization.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
generators: | ||
- ./policyGenerator.yaml | ||
commonLabels: | ||
open-cluster-management.io/policy-set: acs-sensors |
52 changes: 52 additions & 0 deletions
52
policygenerator/policy-sets/community/acs-secure/policyGenerator.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
apiVersion: policy.open-cluster-management.io/v1 | ||
kind: PolicyGenerator | ||
metadata: | ||
name: policy-acs-sensors | ||
placementBindingDefaults: | ||
name: binding-secured-clusters | ||
policyDefaults: | ||
categories: | ||
- SI System and Information Integrity | ||
controls: | ||
- SI-5 Security Alerts Advisories and Directives | ||
namespace: policies | ||
policySets: | ||
- acs-sensors-hub-info | ||
remediationAction: enforce | ||
severity: medium | ||
standards: | ||
- NIST SP 800-53 | ||
policies: | ||
- name: policy-acs-sync-resources | ||
consolidateManifests: false | ||
manifests: | ||
- path: input-sensor/policy-acs-sync-resources.yaml | ||
- name: policy-acs-monitor-certs | ||
dependencies: | ||
- name: policy-acs-sync-resources | ||
manifests: | ||
- path: input-sensor/acs-check-certificates.yaml | ||
- name: policy-advanced-managed-cluster-security | ||
consolidateManifests: false | ||
manifests: | ||
- path: input-sensor/policy-advanced-managed-cluster-security.yaml | ||
- path: input-sensor/policy-advanced-managed-cluster-status.yaml | ||
remediationAction: informOnly | ||
policySets: | ||
- acs-sensor-clusters | ||
policySets: | ||
- description: The Advanced Cluster Security components to setup the hub for securing | ||
each managed cluster. | ||
name: acs-sensors-hub-info | ||
placement: | ||
labelSelector: | ||
matchExpressions: | ||
- {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 | ||
placement: | ||
labelSelector: | ||
matchExpressions: | ||
- {key: vendor, operator: In, values: ["OpenShift"]} | ||
- {key: name, operator: NotIn, values: ["local-cluster"]} |