Skip to content

Commit

Permalink
add NV policy chart and values configs
Browse files Browse the repository at this point in the history
  • Loading branch information
hadams95 committed Feb 7, 2024
1 parent 6450d69 commit 73af71f
Show file tree
Hide file tree
Showing 28 changed files with 3,365 additions and 1 deletion.
4 changes: 4 additions & 0 deletions helm/gen3/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,10 @@ dependencies:
version: "0.1.4"
repository: "file://../spark"
condition: spark.enabled
- name: neuvectorPolicies
version: "0.1.0"
repository: "file://../neuvector-policies"
condition: neuvectorPolicies.enabled


- name: elasticsearch
Expand Down
4 changes: 4 additions & 0 deletions helm/gen3/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -399,3 +399,7 @@ elasticsearch:
esConfig:
elasticsearch.yml: |
# Here we can add elasticsearch config
neuvectorPolicies:
enabled: false

Check failure on line 405 in helm/gen3/values.yaml

View workflow job for this annotation

GitHub Actions / lint-test

405:17 [new-line-at-end-of-file] no new line character at the end of file
23 changes: 23 additions & 0 deletions helm/neuvector-policies/.helmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Patterns to ignore when building packages.
# This supports shell glob matching, relative path matching, and
# negation (prefixed with !). Only one pattern per line.
.DS_Store
# Common VCS dirs
.git/
.gitignore
.bzr/
.bzrignore
.hg/
.hgignore
.svn/
# Common backup files
*.swp
*.bak
*.tmp
*.orig
*~
# Various IDEs
.project
.idea/
*.tmproj
.vscode/
24 changes: 24 additions & 0 deletions helm/neuvector-policies/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
apiVersion: v2
name: neuvector-policies
description: A Helm chart for Kubernetes

# A chart can be either an 'application' or a 'library' chart.
#
# Application charts are a collection of templates that can be packaged into versioned archives
# to be deployed.
#
# Library charts provide useful utilities or functions for the chart developer. They're included as
# a dependency of application charts to inject those utilities and functions into the rendering
# pipeline. Library charts do not define any templates and therefore cannot be deployed.
type: application

# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 0.1.0

# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
# follow Semantic Versioning. They should reflect the version the application is using.
# It is recommended to use it with quotes.
appVersion: "1.16.0"
62 changes: 62 additions & 0 deletions helm/neuvector-policies/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
{{/*
Expand the name of the chart.
*/}}
{{- define "neuvector-policies.name" -}}
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
{{- end }}

{{/*
Create a default fully qualified app name.
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
If release name contains chart name it will be used as a full name.
*/}}
{{- define "neuvector-policies.fullname" -}}
{{- if .Values.fullnameOverride }}
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }}
{{- else }}
{{- $name := default .Chart.Name .Values.nameOverride }}
{{- if contains $name .Release.Name }}
{{- .Release.Name | trunc 63 | trimSuffix "-" }}
{{- else }}
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }}
{{- end }}
{{- end }}
{{- end }}

{{/*
Create chart name and version as used by the chart label.
*/}}
{{- define "neuvector-policies.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
{{- end }}

{{/*
Common labels
*/}}
{{- define "neuvector-policies.labels" -}}
helm.sh/chart: {{ include "neuvector-policies.chart" . }}
{{ include "neuvector-policies.selectorLabels" . }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end }}

{{/*
Selector labels
*/}}
{{- define "neuvector-policies.selectorLabels" -}}
app.kubernetes.io/name: {{ include "neuvector-policies.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}

{{/*
Create the name of the service account to use
*/}}
{{- define "neuvector-policies.serviceAccountName" -}}
{{- if .Values.serviceAccount.create }}
{{- default (include "neuvector-policies.fullname" .) .Values.serviceAccount.name }}
{{- else }}
{{- default "default" .Values.serviceAccount.name }}
{{- end }}
{{- end }}
210 changes: 210 additions & 0 deletions helm/neuvector-policies/templates/ambassador-nvsecurityrule.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,210 @@
apiVersion: neuvector.com/v1
kind: NvSecurityRule
metadata:
name: nv.ambassador-deployment.{{ .Release.Namespace }}
spec:
dlp:
settings: []
status: true
egress:
- action: allow
applications:
- DNS
name: nv.kube-dns.kube-system-egress-0
ports: any
priority: 0
selector:
comment: ""
criteria:
- key: service
op: =
value: kube-dns.kube-system
- key: domain
op: =
value: kube-system
name: nv.kube-dns.kube-system
original_name: ""
- action: allow
applications:
- SSL
name: external-egress-1
ports: any
priority: 0
selector:
comment: ""
criteria: []
name: external
original_name: ""
file: []
ingress:
- action: allow
applications:
- HTTP
name: nv.ambassador-deployment.{{ .Release.Namespace }}-ingress-6
ports: any
priority: 0
selector:
comment: ""
name: Workload:ingress
original_name: ""
- action: allow
applications:
- SSL
name: nv.ambassador-deployment.{{ .Release.Namespace }}-ingress-7
ports: any
priority: 0
selector:
comment: ""
criteria:
- key: service
op: =
value: hatchery-deployment.{{ .Release.Namespace }}
- key: domain
op: =
value: {{ .Release.Namespace }}
name: nv.hatchery-deployment.{{ .Release.Namespace }}
original_name: ""
- action: allow
applications:
- SSL
name: nv.ambassador-deployment.{{ .Release.Namespace }}-ingress-8
ports: any
priority: 0
selector:
comment: ""
criteria: []
name: external
original_name: ""
- action: allow
applications:
- HTTP
name: nv.ambassador-deployment.{{ .Release.Namespace }}-ingress-9
ports: any
priority: 0
selector:
comment: ""
criteria:
- key: service
op: =
value: revproxy-deployment.{{ .Release.Namespace }}
- key: domain
op: =
value: {{ .Release.Namespace }}
name: nv.revproxy-deployment.{{ .Release.Namespace }}
original_name: ""
- action: allow
applications:
- any
name: nv.ambassador-deployment.{{ .Release.Namespace }}-ingress-10
ports: tcp/8080
priority: 0
selector:
comment: ""
criteria:
- key: service
op: =
value: revproxy-deployment.{{ .Release.Namespace }}
- key: domain
op: =
value: {{ .Release.Namespace }}
name: nv.revproxy-deployment.{{ .Release.Namespace }}
original_name: ""
process:
- action: allow
allow_update: false
name: ambex
path: /opt/ambassador/bin/ambassador
- action: allow
allow_update: false
name: bash
path: /bin/bash
- action: allow
allow_update: false
name: busybox
path: /bin/busybox
- action: allow
allow_update: false
name: curl
path: /usr/bin/curl
- action: allow
allow_update: false
name: date
path: /bin/busybox
- action: allow
allow_update: false
name: diagd
path: /usr/bin/python3.7
- action: allow
allow_update: false
name: env
path: /bin/busybox
- action: allow
allow_update: false
name: envoy
path: /usr/local/bin/envoy
- action: allow
allow_update: false
name: find
path: /bin/busybox
- action: allow
allow_update: false
name: grep
path: /bin/busybox
- action: allow
allow_update: false
name: mkdir
path: /bin/busybox
- action: allow
allow_update: false
name: pause
path: /pause
- action: allow
allow_update: false
name: python
path: /usr/bin/python3.7
- action: allow
allow_update: false
name: python3
path: /usr/bin/python3.7
- action: allow
allow_update: false
name: sh
path: /bin/busybox
- action: allow
allow_update: false
name: sleep
path: /bin/busybox
- action: allow
allow_update: false
name: sort
path: /bin/busybox
- action: allow
allow_update: false
name: uname
path: /bin/busybox
- action: allow
allow_update: false
name: watt
path: /opt/ambassador/bin/ambassador
- action: allow
allow_update: false
name: wc
path: /bin/busybox
process_profile:
baseline: zero-drift
target:
policymode: {{ .Values.POLICY_MODE }}
selector:
comment: ""
criteria:
- key: service
op: =
value: ambassador-deployment.{{ .Release.Namespace }}
- key: domain
op: =
value: {{ .Release.Namespace }}
name: nv.ambassador-deployment.{{ .Release.Namespace }}
original_name: ""
waf:
settings: []
status: true
Loading

0 comments on commit 73af71f

Please sign in to comment.