Add Kubernetes testing resources

This commit is contained in:
adfoster-r7 2021-10-12 11:14:49 +01:00
parent e4de7ba28f
commit 522bdb592f
No known key found for this signature in database
GPG Key ID: 3BD4FA3818818F04
28 changed files with 797 additions and 0 deletions

1
test/kubernetes/.gitignore vendored Normal file
View File

@ -0,0 +1 @@
charts

View File

@ -0,0 +1,14 @@
FROM alpine:3.14.2
WORKDIR /kubernetes
RUN apk add --no-cache curl make perl openssl openssh-client
RUN curl --output helm.tar.gz https://get.helm.sh/helm-v3.7.1-linux-amd64.tar.gz && \
(echo "6cd6cad4b97e10c33c978ff3ac97bb42b68f79766f1d2284cfd62ec04cd177f4 helm.tar.gz" | sha256sum -c -) && \
tar -zxvf helm.tar.gz linux-amd64/helm --strip-components 1 && \
mv helm /usr/local/bin && \
rm helm.tar.gz
RUN curl -LO "https://dl.k8s.io/release/v1.22.2/bin/linux/amd64/kubectl" && \
chmod +x ./kubectl && \
mv kubectl /usr/local/bin

69
test/kubernetes/Makefile Normal file
View File

@ -0,0 +1,69 @@
#.POSIX:
.PHONY: install thinkphp secrets secret-files forward-% help
.DEFAULT_GOAL: help
default: help
install: secret-files thinkphp secrets ## Install all charts
thinkphp:
helm upgrade --install thinkphp ./thinkphp
secrets: secret-files
helm upgrade --install secrets ./secrets
forward-thinkphp: ## Forward thinkphp to the host machine on port 9001
export POD_NAME=$(kubectl get pods --namespace default -l "app.kubernetes.io/name=thinkphp,app.kubernetes.io/instance=thinkphp" -o jsonpath="{.items[0].metadata.name}")
export CONTAINER_PORT=$(kubectl get pod --namespace default $$POD_NAME -o jsonpath="{.spec.containers[0].ports[0].containerPort}")
echo "Visit http://127.0.0.1:9001 to use your application"
kubectl --namespace default port-forward $$POD_NAME --address='0.0.0.0' 9001:$$CONTAINER_PORT
### Creating a sample collection of extractable secret files to ensure Metasploit can correctly extract/parse them all
SECRETS_DIR = ./secrets/files
ALL_SECRETS = $(addprefix $(SECRETS_DIR)/, \
ssh-auth/ \
ssh-auth/id-rsa-without-passphrase \
ssh-auth/id-rsa-with-passphrase \
ssh-auth/id-ed25519-with-passphrase \
ssh-auth/id-ed25519-without-passphrase \
tls/ \
tls/ca.key \
tls/ca.crt \
)
secret-files: $(ALL_SECRETS) ## Generate all secret files
$(SECRETS_DIR)/ssh-auth:
mkdir $@
$(SECRETS_DIR)/ssh-auth/id-rsa-without-passphrase:
ssh-keygen -t rsa -f $@ -N 'helloworld'
$(SECRETS_DIR)/ssh-auth/id-rsa-with-passphrase:
ssh-keygen -t rsa -f $@ -N ''
$(SECRETS_DIR)/ssh-auth/id-ed25519-with-passphrase:
ssh-keygen -t ed25519 -f $@ -N 'helloworld'
$(SECRETS_DIR)/ssh-auth/id-ed25519-without-passphrase:
ssh-keygen -t ed25519 -f $@ -N ''
$(SECRETS_DIR)/tls:
mkdir $@
$(SECRETS_DIR)/tls/ca.key:
openssl genrsa -out $@ 2048
$(SECRETS_DIR)/tls/ca.crt: $(SECRETS_DIR)/tls/ca.key
openssl req -x509 -new -nodes -days 365 -key $< -out $@ -subj "/CN=example.com"
HELP_FUN = \
%help; \
while(<>) { push @{$$help{$$2 // 'options'}}, [$$1, $$3] if /^(\w+)\s*:.*\#\#(?:@(\w+))?\s(.*)$$/ }; \
print "usage: make [target]\n\n"; \
for (keys %help) { \
print "$$_:\n"; $$sep = " " x (20 - length $$_->[0]); \
print " $$_->[0]$$sep$$_->[1]\n" for @{$$help{$$_}}; \
print "\n"; \
}
help: ##@miscellaneous Show this help.
@perl -e '$(HELP_FUN)' $(MAKEFILE_LIST)

72
test/kubernetes/README.md Normal file
View File

@ -0,0 +1,72 @@
### Kubernetes
A collection of Helm charts have been created to aid both Metasploit developers and pentesters explore Metasploit's
Kubernetes support and exploitation capabilities.
## Available Charts
- `secrets` - Create multiple Kubernetes Secrets to test Metasploit's enumeration capabilities
- `thinkphp` - Run an intentionally vulnerable `thinkphp` application with full cluster access. Exploit with `exploit/unix/webapp/thinkphp_rce` for a Meterpreter session.
- `lucee` - Run an intentionally vulnerable `lucee` application with minimal cluster access. Exploit with `linux/http/lucee_admin_imgprocess_file_write` for a cmd shell session.
## Usage
First ensure that Kubernetes is installed on your host machine with either [kind](https://kind.sigs.k8s.io/docs/user/quick-start/#installation),
[Minikube](https://minikube.sigs.k8s.io/docs/start/), [Docker Desktop](https://docs.docker.com/desktop/kubernetes/), or alternatives.
Next install the vulnerable charts and configuration:
```
docker-compose run setup
```
You can now use Metasploit from your host machine to target the intentionally vulnerable cluster.
To enter into an interactive environment with all of the required Helm/Kubectl tools available:
```
docker-compose run setup /bin/sh
kubectl get all --all-namespaces
helm list
```
### Workflow Example
First configure the Kubernetes environment:
```
docker-compose run configure
```
Now expose the exploitable thinkphp application to your host machine. In the real world this step would not be required
as the application would be most likely already be publicly accessible:
```
docker-compose run forward
```
Open Metasploit and exploit the thinkphp container to open a Metarpreter session:
```
use unix/webapp/thinkphp_rce
run http://target_ip:9001
```
The `auxiliary/cloud/kubernetes/enum_kubernetes` module can now be used to pivot through the compromised container to reach
the previously inaccessible Kubernetes API. In this scenario the container's Kubernetes service token will be read from the
file system, and used to authenticate with the Kubernetes API:
```
use auxiliary/cloud/kubernetes/enum_kubernetes
run session=-1
```
If the compromised service token has the required permissions to create new pods, it is possible to open additional Metasploit sessions and
run one-of tasks with the `exploit/multi/kubernetes/exec` module. This newly created pod will also attempt to mount the Kubernetes Node's
root filesystem to `/host_mnt`, which may lead to additional attack vectors:
```
use exploit/multi/kubernetes/exec
run session=-1
```
See the corresponding documentation for each module for more detail.

View File

@ -0,0 +1,16 @@
version: '3'
services:
setup: &setup
build: .
environment:
- KUBECONFIG=/kube/config
volumes:
- ./:/kubernetes
- ~/.kube:/kube:ro
network_mode: host
command: make install
forward:
<<: *setup
command: make forward

View File

@ -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/

View File

@ -0,0 +1,18 @@
apiVersion: v2
name: secrets
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

View File

@ -0,0 +1,3 @@
*
!.gitkeep
!README.md

View File

@ -0,0 +1 @@
These files should be generate with `make secret-files` in the parent directory

View File

@ -0,0 +1,2 @@
1. View the available secrets:
kubectl --namespace {{ .Release.Namespace }} get secrets

View File

@ -0,0 +1,62 @@
{{/*
Expand the name of the chart.
*/}}
{{- define "secrets.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 "secrets.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 "secrets.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
{{- end }}
{{/*
Common labels
*/}}
{{- define "secrets.labels" -}}
helm.sh/chart: {{ include "secrets.chart" . }}
{{ include "secrets.selectorLabels" . }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end }}
{{/*
Selector labels
*/}}
{{- define "secrets.selectorLabels" -}}
app.kubernetes.io/name: {{ include "secrets.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}
{{/*
Create the name of the service account to use
*/}}
{{- define "secrets.serviceAccountName" -}}
{{- if .Values.serviceAccount.create }}
{{- default (include "secrets.fullname" .) .Values.serviceAccount.name }}
{{- else }}
{{- default "default" .Values.serviceAccount.name }}
{{- end }}
{{- end }}

View File

@ -0,0 +1,8 @@
apiVersion: v1
kind: Secret
metadata:
name: {{ include "secrets.fullname" . }}-basic-auth
type: kubernetes.io/basic-auth
stringData:
username: root
password: password123

View File

@ -0,0 +1,8 @@
apiVersion: v1
kind: Secret
type: kubernetes.io/dockerconfigjson
metadata:
name: {{ include "secrets.fullname" . }}-dockerconfigjson
stringData:
.dockerconfigjson:
'{"auths":{"https://index.docker.io/v1/":{"username":"username","password":"password","email":"admin@example.com","auth":"dXNlcm5hbWU6cGFzc3dvcmQ="}}}'

View File

@ -0,0 +1,16 @@
apiVersion: v1
kind: Secret
type: Opaque
metadata:
name: {{ include "secrets.fullname" . }}-empty
---
apiVersion: v1
kind: Secret
type: Opaque
metadata:
name: {{ include "secrets.fullname" . }}-user-password
stringData:
username: root
password: password123

View File

@ -0,0 +1,14 @@
{{- $fullName := include "secrets.fullname" . -}}
{{- range $path, $bytes := .Files.Glob "files/ssh-auth/*" }}
{{- $name := base $path }}
{{- if not (hasSuffix ".pub" $path) }}
apiVersion: v1
kind: Secret
type: kubernetes.io/ssh-auth
metadata:
name: {{ $fullName }}-{{ $name }}
data:
ssh-privatekey: {{ ($.Files.Get $path) | b64enc | nindent 4 }}
---
{{- end }}
{{- end }}

View File

@ -0,0 +1,10 @@
apiVersion: v1
kind: Secret
type: kubernetes.io/tls
metadata:
name: {{ include "secrets.fullname" . }}-tls
data:
tls.crt:
{{ ($.Files.Get "files/tls/ca.crt") | b64enc | indent 2 }}
tls.key:
{{ ($.Files.Get "files/tls/ca.key") | b64enc | indent 2 }}

View File

@ -0,0 +1,6 @@
# Default values for secrets.
# This is a YAML-formatted file.
# Declare variables to be passed into your templates.
nameOverride: ""
fullnameOverride: ""

View File

@ -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/

View File

@ -0,0 +1,18 @@
apiVersion: v2
name: thinkphp
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

View File

@ -0,0 +1,22 @@
1. Get the application URL by running these commands:
{{- if .Values.ingress.enabled }}
{{- range $host := .Values.ingress.hosts }}
{{- range .paths }}
http{{ if $.Values.ingress.tls }}s{{ end }}://{{ $host.host }}{{ .path }}
{{- end }}
{{- end }}
{{- else if contains "NodePort" .Values.service.type }}
export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "thinkphp.fullname" . }})
export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}")
echo http://$NODE_IP:$NODE_PORT
{{- else if contains "LoadBalancer" .Values.service.type }}
NOTE: It may take a few minutes for the LoadBalancer IP to be available.
You can watch the status of by running 'kubectl get --namespace {{ .Release.Namespace }} svc -w {{ include "thinkphp.fullname" . }}'
export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "thinkphp.fullname" . }} --template "{{"{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}"}}")
echo http://$SERVICE_IP:{{ .Values.service.port }}
{{- else if contains "ClusterIP" .Values.service.type }}
export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ include "thinkphp.name" . }},app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}")
export CONTAINER_PORT=$(kubectl get pod --namespace {{ .Release.Namespace }} $POD_NAME -o jsonpath="{.spec.containers[0].ports[0].containerPort}")
echo "Visit http://127.0.0.1:{{ .Values.notes.hostPort }} to use your application"
kubectl --namespace {{ .Release.Namespace }} port-forward $POD_NAME --address='{{.Values.notes.address}}' {{ .Values.notes.hostPort }}:$CONTAINER_PORT
{{- end }}

View File

@ -0,0 +1,62 @@
{{/*
Expand the name of the chart.
*/}}
{{- define "thinkphp.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 "thinkphp.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 "thinkphp.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
{{- end }}
{{/*
Common labels
*/}}
{{- define "thinkphp.labels" -}}
helm.sh/chart: {{ include "thinkphp.chart" . }}
{{ include "thinkphp.selectorLabels" . }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end }}
{{/*
Selector labels
*/}}
{{- define "thinkphp.selectorLabels" -}}
app.kubernetes.io/name: {{ include "thinkphp.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}
{{/*
Create the name of the service account to use
*/}}
{{- define "thinkphp.serviceAccountName" -}}
{{- if .Values.serviceAccount.create }}
{{- default (include "thinkphp.fullname" .) .Values.serviceAccount.name }}
{{- else }}
{{- default "default" .Values.serviceAccount.name }}
{{- end }}
{{- end }}

View File

@ -0,0 +1,61 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "thinkphp.fullname" . }}
labels:
{{- include "thinkphp.labels" . | nindent 4 }}
spec:
{{- if not .Values.autoscaling.enabled }}
replicas: {{ .Values.replicaCount }}
{{- end }}
selector:
matchLabels:
{{- include "thinkphp.selectorLabels" . | nindent 6 }}
template:
metadata:
{{- with .Values.podAnnotations }}
annotations:
{{- toYaml . | nindent 8 }}
{{- end }}
labels:
{{- include "thinkphp.selectorLabels" . | nindent 8 }}
spec:
{{- with .Values.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
serviceAccountName: {{ include "thinkphp.serviceAccountName" . }}
securityContext:
{{- toYaml .Values.podSecurityContext | nindent 8 }}
containers:
- name: {{ .Chart.Name }}
securityContext:
{{- toYaml .Values.securityContext | nindent 12 }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
ports:
- name: http
containerPort: 80
protocol: TCP
livenessProbe:
httpGet:
path: /
port: http
readinessProbe:
httpGet:
path: /
port: http
resources:
{{- toYaml .Values.resources | nindent 12 }}
{{- with .Values.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.affinity }}
affinity:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.tolerations }}
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}

View File

@ -0,0 +1,28 @@
{{- if .Values.autoscaling.enabled }}
apiVersion: autoscaling/v2beta1
kind: HorizontalPodAutoscaler
metadata:
name: {{ include "thinkphp.fullname" . }}
labels:
{{- include "thinkphp.labels" . | nindent 4 }}
spec:
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
name: {{ include "thinkphp.fullname" . }}
minReplicas: {{ .Values.autoscaling.minReplicas }}
maxReplicas: {{ .Values.autoscaling.maxReplicas }}
metrics:
{{- if .Values.autoscaling.targetCPUUtilizationPercentage }}
- type: Resource
resource:
name: cpu
targetAverageUtilization: {{ .Values.autoscaling.targetCPUUtilizationPercentage }}
{{- end }}
{{- if .Values.autoscaling.targetMemoryUtilizationPercentage }}
- type: Resource
resource:
name: memory
targetAverageUtilization: {{ .Values.autoscaling.targetMemoryUtilizationPercentage }}
{{- end }}
{{- end }}

View File

@ -0,0 +1,61 @@
{{- if .Values.ingress.enabled -}}
{{- $fullName := include "thinkphp.fullname" . -}}
{{- $svcPort := .Values.service.port -}}
{{- if and .Values.ingress.className (not (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion)) }}
{{- if not (hasKey .Values.ingress.annotations "kubernetes.io/ingress.class") }}
{{- $_ := set .Values.ingress.annotations "kubernetes.io/ingress.class" .Values.ingress.className}}
{{- end }}
{{- end }}
{{- if semverCompare ">=1.19-0" .Capabilities.KubeVersion.GitVersion -}}
apiVersion: networking.k8s.io/v1
{{- else if semverCompare ">=1.14-0" .Capabilities.KubeVersion.GitVersion -}}
apiVersion: networking.k8s.io/v1beta1
{{- else -}}
apiVersion: extensions/v1beta1
{{- end }}
kind: Ingress
metadata:
name: {{ $fullName }}
labels:
{{- include "thinkphp.labels" . | nindent 4 }}
{{- with .Values.ingress.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
{{- if and .Values.ingress.className (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion) }}
ingressClassName: {{ .Values.ingress.className }}
{{- end }}
{{- if .Values.ingress.tls }}
tls:
{{- range .Values.ingress.tls }}
- hosts:
{{- range .hosts }}
- {{ . | quote }}
{{- end }}
secretName: {{ .secretName }}
{{- end }}
{{- end }}
rules:
{{- range .Values.ingress.hosts }}
- host: {{ .host | quote }}
http:
paths:
{{- range .paths }}
- path: {{ .path }}
{{- if and .pathType (semverCompare ">=1.18-0" $.Capabilities.KubeVersion.GitVersion) }}
pathType: {{ .pathType }}
{{- end }}
backend:
{{- if semverCompare ">=1.19-0" $.Capabilities.KubeVersion.GitVersion }}
service:
name: {{ $fullName }}
port:
number: {{ $svcPort }}
{{- else }}
serviceName: {{ $fullName }}
servicePort: {{ $svcPort }}
{{- end }}
{{- end }}
{{- end }}
{{- end }}

View File

@ -0,0 +1,42 @@
{{- if .Values.privileges.useServiceAccount -}}
apiVersion: v1
kind: ServiceAccount
metadata:
name: {{ include "thinkphp.serviceAccountName" . }}
labels:
{{- include "thinkphp.labels" . | nindent 4 }}
{{- with .Values.serviceAccount.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
{{- if eq .Values.privileges.bindClusterRoleOverride "" -}}
---
# Grant the service account full access to Kubernetes by default
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: {{ include "thinkphp.fullname" . }}-all-access
rules:
- apiGroups: [""] # "" indicates the core API group
resources: ["*"]
verbs: ["*"]
{{- end -}}
{{- $defaultRoleRefName := printf "%s-all-access" (include "thinkphp.fullname" .) }}
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: {{ include "thinkphp.fullname" . }}-all-access
subjects:
- kind: ServiceAccount
name: {{ include "thinkphp.serviceAccountName" . }}
apiGroup: ""
namespace: {{ .Release.Namespace }}
roleRef:
kind: ClusterRole
name: {{ .Values.privileges.bindClusterRoleOverride | default $defaultRoleRefName }}
apiGroup: ""
{{- end }}

View File

@ -0,0 +1,15 @@
apiVersion: v1
kind: Service
metadata:
name: {{ include "thinkphp.fullname" . }}
labels:
{{- include "thinkphp.labels" . | nindent 4 }}
spec:
type: {{ .Values.service.type }}
ports:
- port: {{ .Values.service.port }}
targetPort: http
protocol: TCP
name: http
selector:
{{- include "thinkphp.selectorLabels" . | nindent 4 }}

View File

@ -0,0 +1,15 @@
apiVersion: v1
kind: Pod
metadata:
name: "{{ include "thinkphp.fullname" . }}-test-connection"
labels:
{{- include "thinkphp.labels" . | nindent 4 }}
annotations:
"helm.sh/hook": test
spec:
containers:
- name: wget
image: busybox
command: ['wget']
args: ['{{ include "thinkphp.fullname" . }}:{{ .Values.service.port }}']
restartPolicy: Never

View File

@ -0,0 +1,107 @@
# Default values for thinkphp.
# This is a YAML-formatted file.
# Declare variables to be passed into your templates.
replicaCount: 1
image:
repository: vulhub/thinkphp
pullPolicy: IfNotPresent
tag: 5.0.23
notes:
hostPort: 9001
address: 0.0.0.0
imagePullSecrets: []
nameOverride: ""
fullnameOverride: ""
serviceAccount:
# Annotations to add to the service account
annotations: {}
# The name of the service account to use.
# If not set and create is true, a name is generated using the fullname template
name: ""
privileges:
useServiceAccount: true
# Override the default cluster role (useServiceAccount must be true for this setting to be effective)
bindClusterRoleOverride: ""
#
# Priviliges related to node hosting metasploit Pod
# See: https://kubernetes.io/docs/tasks/configure-pod-container/security-context/
podSecurityContext: {}
# fsGroup: 2000
# Metasploit container security context
securityContext: {}
#allowPrivilegeEscalation: false
# capabilities:
# add:
# - NET_BIND_SERVICE
# drop:
# - all
#runAsNonRoot: true
#runAsUser: 1000
#runAsGroup: 1000
podAnnotations: {}
podSecurityContext: {}
# fsGroup: 2000
securityContext: {}
# capabilities:
# drop:
# - ALL
# readOnlyRootFilesystem: true
# runAsNonRoot: true
# runAsUser: 1000
service:
type: ClusterIP
port: 80
ingress:
enabled: false
className: ""
annotations: {}
# kubernetes.io/ingress.class: nginx
# kubernetes.io/tls-acme: "true"
hosts:
- host: thinkphp.local
paths:
- path: /
pathType: ImplementationSpecific
tls: []
# - secretName: chart-example-tls
# hosts:
# - chart-example.local
resources: {}
# We usually recommend not to specify default resources and to leave this as a conscious
# choice for the user. This also increases chances charts run on environments with little
# resources, such as Minikube. If you do want to specify resources, uncomment the following
# lines, adjust them as necessary, and remove the curly braces after 'resources:'.
# limits:
# cpu: 100m
# memory: 128Mi
# requests:
# cpu: 100m
# memory: 128Mi
autoscaling:
enabled: false
minReplicas: 1
maxReplicas: 100
targetCPUUtilizationPercentage: 80
# targetMemoryUtilizationPercentage: 80
nodeSelector: {}
tolerations: []
affinity: {}