-
Notifications
You must be signed in to change notification settings - Fork 0
/
policy-network-denyall.yaml
94 lines (84 loc) · 2.71 KB
/
policy-network-denyall.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
# Make sure all namespaces created within the targeted cluster have a DENY ALL ingress networkpolicy.
# This will deploy:
# Policy: openshift-acm-policies:policy-standard-ns-default-networkpolicy
# That policy will ensure musthave of:
# NetworkPolicy: deny-by-default
# In all namespace execpt:
# - "kube-*"
# - "default"
# - "open-cluster-management-*"
# - "openshift-"
apiVersion: policy.open-cluster-management.io/v1
kind: Policy
metadata:
name: policy-standard-ns-default-networkpolicy
namespace: openshift-acm-policies
annotations:
policy.open-cluster-management.io/standards: Tenants Security
policy.open-cluster-management.io/categories: Network Security
policy.open-cluster-management.io/controls: New Tenant Baseline Configuration
spec:
remediationAction: enforce
disabled: false
policy-templates:
- objectDefinition:
apiVersion: policy.open-cluster-management.io/v1
kind: ConfigurationPolicy
metadata:
name: policy-default-ns-np
spec:
remediationAction: enforce
severity: high
namespaceSelector:
exclude:
- "kube-*"
- "default"
- "open-cluster-management-*"
- "openshift-*"
- "rhacs-operator"
include:
- "*"
object-templates:
- complianceType: musthave
objectDefinition:
kind: NetworkPolicy
apiVersion: networking.k8s.io/v1
metadata:
name: deny-by-default
labels:
rulename: deny-by-default
spec:
podSelector: {}
ingress: []
# - objectDefinition:
# apiVersion: policy.open-cluster-management.io/v1
# kind: ConfigurationPolicy
# metadata:
# name: demo-networkpolicy-alltenant
# spec:
# remediationAction: inform
# severity: low
# namespaceSelector:
# exclude:
# - "openshift-"
# include:
# - "tenant*"
# object-templates:
# - complianceType: mustnothave
# objectDefinition:
# apiVersion: networking.k8s.io/v1
# kind: NetworkPolicy
# metadata:
# name: all-tenant-default
# spec:
# podSelector:
# matchLabels:
# app: xyz
# ingress:
# - from:
# - podSelector:
# matchLabels:
# role: abc
# ports:
# - protocol: TCP
# port: 8000