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

add NV policy chart and values configs #5

Open
wants to merge 10 commits into
base: hunter/fix/helm-duplicates
Choose a base branch
from
11 changes: 10 additions & 1 deletion helm/gen3/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,6 @@ dependencies:
repository: "file://../spark"
condition: spark.enabled


- name: elasticsearch
version: 7.10.2
repository: "https://helm.elastic.co"
Expand All @@ -115,6 +114,16 @@ dependencies:
repository: "https://charts.bitnami.com/bitnami"
condition: global.dev

# (optional) NeuVector Kubernetes Security Policy templates to protect Gen3
# NeuVector must be installed separately.
# Reference: https://open-docs.neuvector.com/basics/overview
# Reference: https://github.com/neuvector/neuvector-helm
# For more information, please use the Gen3 community Slack.
- name: neuvector
version: "0.1.0"
repository: "file://../neuvector"
condition: neuvector.enabled

# 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
Expand Down
24 changes: 24 additions & 0 deletions helm/gen3/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -399,3 +399,27 @@ elasticsearch:
esConfig:
elasticsearch.yml: |
# Here we can add elasticsearch config

# (optional) NeuVector Kubernetes Security Policy templates to protect Gen3
# NeuVector must be installed separately.
# Reference: https://open-docs.neuvector.com/basics/overview
# Reference: https://github.com/neuvector/neuvector-helm
# For more information, please use the Gen3 community Slack.
neuvector:
# install Neuvector
enabled: false
policies:
# deploy predefined Neuvector policies for Gen3
include: false
# Discover, Monitor, or Protect
policyMode: Monitor
# Configure your ingress controller information for enabling ingress to containers
ingress:
# service name of your ingress controller
controller: nginx-ingress-controller
# installation namespace of your ingress controller
namespace: nginx
# classname of your ingress
class: nginx
# Required to allow egress to in-cluster database or external, managed database
DB_HOST: development-gen3-postgresql
23 changes: 23 additions & 0 deletions helm/neuvector/.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/
34 changes: 34 additions & 0 deletions helm/neuvector/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
apiVersion: v2
name: neuvector
description: NeuVector Kubernetes Security Policy templates to protect Gen3

# NeuVector must be installed separately.
# Reference: https://open-docs.neuvector.com/basics/overview
# Reference: https://github.com/neuvector/neuvector-helm
# For more information, please use the Gen3 community Slack.
# 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"

# Todo: Evaluate inclusion of NeuVector installation
# dependencies:
# - name: neuvector
# version: "5.2.2-s1"
# repository: "https://neuvector.github.io/neuvector-helm/core"
62 changes: 62 additions & 0 deletions helm/neuvector/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.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.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.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
{{- end }}

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

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

{{/*
Create the name of the service account to use
*/}}
{{- define "neuvector.serviceAccountName" -}}
{{- if .Values.serviceAccount.create }}
{{- default (include "neuvector.fullname" .) .Values.serviceAccount.name }}
{{- else }}
{{- default "default" .Values.serviceAccount.name }}
{{- end }}
{{- end }}
212 changes: 212 additions & 0 deletions helm/neuvector/templates/ambassador-nvsecurityrule.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,212 @@
{{- if .Values.policies.include }}
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.policies.policyMode }}
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
{{- end }}
Loading
Loading