Deny production runs of example.org trust domains (#229)
This commit is contained in:
@@ -1,3 +1,9 @@
|
|||||||
|
global:
|
||||||
|
spire:
|
||||||
|
clusterName: production
|
||||||
|
trustDomain: production.other
|
||||||
|
jwtIssuer: oidc-discovery.production.other
|
||||||
|
|
||||||
spire-server:
|
spire-server:
|
||||||
controllerManager:
|
controllerManager:
|
||||||
enabled: false
|
enabled: false
|
||||||
|
|||||||
@@ -43,8 +43,8 @@ metadata:
|
|||||||
name: oidc
|
name: oidc
|
||||||
spec:
|
spec:
|
||||||
dnsNames:
|
dnsNames:
|
||||||
- oidc-discovery.example.org
|
- oidc-discovery.production.other
|
||||||
- spire-server-federation.example.org
|
- spire-server-federation.production.other
|
||||||
secretName: tls-cert
|
secretName: tls-cert
|
||||||
issuerRef:
|
issuerRef:
|
||||||
name: demo-ca
|
name: demo-ca
|
||||||
|
|||||||
@@ -98,6 +98,7 @@ Now you can interact with the Spire agent socket from your own application. The
|
|||||||
| `global.spire.trustDomain` | The trust domain for Spire install | `example.org` |
|
| `global.spire.trustDomain` | The trust domain for Spire install | `example.org` |
|
||||||
| `global.spire.upstreamServerAddress` | Set what address to use for the upstream server when using nested spire | `""` |
|
| `global.spire.upstreamServerAddress` | Set what address to use for the upstream server when using nested spire | `""` |
|
||||||
| `global.spire.image.registry` | Override all Spire image registries at once | `""` |
|
| `global.spire.image.registry` | Override all Spire image registries at once | `""` |
|
||||||
|
| `global.spire.strictMode` | Check values, such as trustDomain, are overridden with a suitable value for production. | `false` |
|
||||||
| `global.installAndUpgradeHooks.enabled` | Enable Helm hooks to autofix common install/upgrade issues (should be disabled when using `helm template`) | `true` |
|
| `global.installAndUpgradeHooks.enabled` | Enable Helm hooks to autofix common install/upgrade issues (should be disabled when using `helm template`) | `true` |
|
||||||
| `global.deleteHooks.enabled` | Enable Helm hooks to autofix common delete issues (should be disabled when using `helm template`) | `true` |
|
| `global.deleteHooks.enabled` | Enable Helm hooks to autofix common delete issues (should be disabled when using `helm template`) | `true` |
|
||||||
|
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
{{- include "spire-lib.check-strict-mode" (list . "trustDomain must be set" (eq (include "spire-lib.trust-domain" .) "example.org"))}}
|
||||||
|
{{- include "spire-lib.check-strict-mode" (list . "jwtIssuer must be set" (eq (include "spire-lib.jwt-issuer" .) "https://oidc-discovery.example.org"))}}
|
||||||
{{- $oidcSocket := "/run/spire/oidc-sockets/spire-oidc-server.sock" }}
|
{{- $oidcSocket := "/run/spire/oidc-sockets/spire-oidc-server.sock" }}
|
||||||
{{- define "spiffe-oidc-discovery-provider.yaml-config" -}}
|
{{- define "spiffe-oidc-discovery-provider.yaml-config" -}}
|
||||||
{{- $oidcSocket := .oidcSocket }}
|
{{- $oidcSocket := .oidcSocket }}
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
{{- include "spire-lib.check-strict-mode" (list . "clusterName must be set" (eq (include "spire-lib.cluster-name" .) "example-cluster"))}}
|
||||||
|
{{- include "spire-lib.check-strict-mode" (list . "trustDomain must be set" (eq (include "spire-lib.trust-domain" .) "example.org"))}}
|
||||||
{{- define "spire-agent.yaml-config" -}}
|
{{- define "spire-agent.yaml-config" -}}
|
||||||
agent:
|
agent:
|
||||||
data_dir: "/run/spire"
|
data_dir: "/run/spire"
|
||||||
|
|||||||
@@ -153,7 +153,7 @@ In order to run Tornjak with simple HTTP Connection only, make sure you don't cr
|
|||||||
| `federation.ingress.annotations` | Annotations for the ingress object | `{}` |
|
| `federation.ingress.annotations` | Annotations for the ingress object | `{}` |
|
||||||
| `federation.ingress.hosts` | Host paths for ingress object | `[]` |
|
| `federation.ingress.hosts` | Host paths for ingress object | `[]` |
|
||||||
| `federation.ingress.tls` | Secrets containining TLS certs to enable https on ingress | `[]` |
|
| `federation.ingress.tls` | Secrets containining TLS certs to enable https on ingress | `[]` |
|
||||||
| `ca_subject.country` | Country for Spire server CA | `NL` |
|
| `ca_subject.country` | Country for Spire server CA | `ARPA` |
|
||||||
| `ca_subject.organization` | Organization for Spire server CA | `Example` |
|
| `ca_subject.organization` | Organization for Spire server CA | `Example` |
|
||||||
| `ca_subject.common_name` | Common Name for Spire server CA | `example.org` |
|
| `ca_subject.common_name` | Common Name for Spire server CA | `example.org` |
|
||||||
| `keyManager.disk.enabled` | Flag to enable keyManager on disk | `true` |
|
| `keyManager.disk.enabled` | Flag to enable keyManager on disk | `true` |
|
||||||
|
|||||||
@@ -1,3 +1,9 @@
|
|||||||
|
{{- include "spire-lib.check-strict-mode" (list . "clusterName must be set" (eq (include "spire-lib.cluster-name" .) "example-cluster"))}}
|
||||||
|
{{- include "spire-lib.check-strict-mode" (list . "trustDomain must be set" (eq (include "spire-lib.trust-domain" .) "example.org"))}}
|
||||||
|
{{- include "spire-lib.check-strict-mode" (list . "jwtIssuer must be set" (eq (include "spire-lib.jwt-issuer" .) "https://oidc-discovery.example.org"))}}
|
||||||
|
{{- include "spire-lib.check-strict-mode" (list . "ca_subject.county must be set" (eq .Values.ca_subject.country "ARPA"))}}
|
||||||
|
{{- include "spire-lib.check-strict-mode" (list . "ca_subject.organization must be set" (eq .Values.ca_subject.organization "Example"))}}
|
||||||
|
{{- include "spire-lib.check-strict-mode" (list . "ca_subject.common_name must be set" (eq .Values.ca_subject.common_name "example.org"))}}
|
||||||
{{- range $type, $tvals := .Values.customPlugins }}
|
{{- range $type, $tvals := .Values.customPlugins }}
|
||||||
{{- if not (has $type (list "keyManager" "nodeAttestor" "upstreamAuthority" "notifier")) }}
|
{{- if not (has $type (list "keyManager" "nodeAttestor" "upstreamAuthority" "notifier")) }}
|
||||||
{{- fail (printf "Unknown plugin type specified: %s" $type) }}
|
{{- fail (printf "Unknown plugin type specified: %s" $type) }}
|
||||||
|
|||||||
@@ -225,7 +225,7 @@ federation:
|
|||||||
|
|
||||||
ca_subject:
|
ca_subject:
|
||||||
## @param ca_subject.country Country for Spire server CA
|
## @param ca_subject.country Country for Spire server CA
|
||||||
country: NL
|
country: ARPA
|
||||||
## @param ca_subject.organization Organization for Spire server CA
|
## @param ca_subject.organization Organization for Spire server CA
|
||||||
organization: Example
|
organization: Example
|
||||||
## @param ca_subject.common_name Common Name for Spire server CA
|
## @param ca_subject.common_name Common Name for Spire server CA
|
||||||
|
|||||||
@@ -107,3 +107,18 @@ rules:
|
|||||||
{{- end }}
|
{{- end }}
|
||||||
{{- include "spire-lib.image" $root }}
|
{{- include "spire-lib.image" $root }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
|
|
||||||
|
{{/*
|
||||||
|
Take in an array of, '.', a failure string to display, and boolean to to display it,
|
||||||
|
if strictMode is enabled and the boolean is true
|
||||||
|
*/}}
|
||||||
|
{{- define "spire-lib.check-strict-mode" }}
|
||||||
|
{{ $root := index . 0 }}
|
||||||
|
{{ $message := index . 1 }}
|
||||||
|
{{ $condition := index . 2 }}
|
||||||
|
{{- if (dig "spire" "strictMode" false $root.Values.global) }}
|
||||||
|
{{- if $condition }}
|
||||||
|
{{- fail $message }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
|
|||||||
@@ -24,6 +24,9 @@ global:
|
|||||||
## @param global.spire.image.registry Override all Spire image registries at once
|
## @param global.spire.image.registry Override all Spire image registries at once
|
||||||
registry: ""
|
registry: ""
|
||||||
|
|
||||||
|
## @param global.spire.strictMode Check values, such as trustDomain, are overridden with a suitable value for production.
|
||||||
|
strictMode: false
|
||||||
|
|
||||||
installAndUpgradeHooks:
|
installAndUpgradeHooks:
|
||||||
## @param global.installAndUpgradeHooks.enabled Enable Helm hooks to autofix common install/upgrade issues (should be disabled when using `helm template`)
|
## @param global.installAndUpgradeHooks.enabled Enable Helm hooks to autofix common install/upgrade issues (should be disabled when using `helm template`)
|
||||||
enabled: true
|
enabled: true
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ helm upgrade --install mysql mysql --version "$VERSION_MYSQL" --repo "$HELM_REPO
|
|||||||
--wait
|
--wait
|
||||||
|
|
||||||
helm upgrade --install --namespace "spire-server" \
|
helm upgrade --install --namespace "spire-server" \
|
||||||
--values "${SCRIPTPATH}/values.yaml,${SCRIPTPATH}/../production/values.yaml,${SCRIPTPATH}/../production/values-node-pod-antiaffinity.yaml" \
|
--values "${SCRIPTPATH}/values.yaml,${SCRIPTPATH}/../production/values.yaml,${SCRIPTPATH}/../production/values-node-pod-antiaffinity.yaml,${SCRIPTPATH}/../production/example-your-values.yaml" \
|
||||||
--set 'spire-server.dataStore.sql.password=sp1ff3Test' --wait spire charts/spire
|
--set 'spire-server.dataStore.sql.password=sp1ff3Test' --wait spire charts/spire
|
||||||
helm test --namespace "spire-server" spire
|
helm test --namespace "spire-server" spire
|
||||||
|
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ helm upgrade --install postgresql postgresql --version "$VERSION_POSTGRESQL" --r
|
|||||||
--wait
|
--wait
|
||||||
|
|
||||||
helm upgrade --install --namespace "spire-server" \
|
helm upgrade --install --namespace "spire-server" \
|
||||||
--values "${SCRIPTPATH}/values.yaml,${SCRIPTPATH}/../production/values.yaml,${SCRIPTPATH}/../production/values-node-pod-antiaffinity.yaml" \
|
--values "${SCRIPTPATH}/values.yaml,${SCRIPTPATH}/../production/values.yaml,${SCRIPTPATH}/../production/values-node-pod-antiaffinity.yaml,${SCRIPTPATH}/../production/example-your-values.yaml" \
|
||||||
--set 'spire-server.dataStore.sql.password=sp1ff3Test' --wait spire charts/spire
|
--set 'spire-server.dataStore.sql.password=sp1ff3Test' --wait spire charts/spire
|
||||||
helm test --namespace "spire-server" spire
|
helm test --namespace "spire-server" spire
|
||||||
|
|
||||||
|
|||||||
@@ -34,10 +34,10 @@ helm upgrade --install --create-namespace spire charts/spire \
|
|||||||
--wait
|
--wait
|
||||||
|
|
||||||
kubectl get nodes -o go-template='{{range .items}}{{printf "%s\n" .metadata.uid}}{{end}}' | while read -r line; do
|
kubectl get nodes -o go-template='{{range .items}}{{printf "%s\n" .metadata.uid}}{{end}}' | while read -r line; do
|
||||||
kubectl exec -t spire-server-0 -n "spire-root-server" -- spire-server entry create -spiffeID spiffe://example.org/example-cluster/nested-spire -parentID "spiffe://example.org/spire/agent/k8s_psat/example-cluster/$line" -selector k8s:pod-label:app.kubernetes.io/name:server -downstream
|
kubectl exec -t spire-server-0 -n "spire-root-server" -- spire-server entry create -spiffeID spiffe://production.other/production/nested-spire -parentID "spiffe://production.other/spire/agent/k8s_psat/production/$line" -selector k8s:pod-label:app.kubernetes.io/name:server -downstream
|
||||||
done
|
done
|
||||||
|
|
||||||
helm upgrade --install --create-namespace --namespace spire-server --values "${SCRIPTPATH}/values.yaml,${SCRIPTPATH}/../production/values.yaml" \
|
helm upgrade --install --create-namespace --namespace spire-server --values "${SCRIPTPATH}/values.yaml,${SCRIPTPATH}/../production/values.yaml,${SCRIPTPATH}/../production/values-node-pod-antiaffinity.yaml,${SCRIPTPATH}/../production/example-your-values.yaml" \
|
||||||
--wait spire charts/spire
|
--wait spire charts/spire
|
||||||
helm test --namespace spire-server spire
|
helm test --namespace spire-server spire
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,45 @@
|
|||||||
|
global:
|
||||||
|
spire:
|
||||||
|
clusterName: production
|
||||||
|
trustDomain: production.other
|
||||||
|
jwtIssuer: oidc-discovery.production.other
|
||||||
|
|
||||||
|
spire-server:
|
||||||
|
ca_subject:
|
||||||
|
country: US
|
||||||
|
organization: Production
|
||||||
|
common_name: production.other
|
||||||
|
|
||||||
|
ingress:
|
||||||
|
hosts:
|
||||||
|
- host: spire-server.production.other
|
||||||
|
paths:
|
||||||
|
- path: /
|
||||||
|
pathType: Prefix
|
||||||
|
tls:
|
||||||
|
- hosts:
|
||||||
|
- spire-server.production.other
|
||||||
|
federation:
|
||||||
|
ingress:
|
||||||
|
hosts:
|
||||||
|
- host: spire-server-federation.production.other
|
||||||
|
paths:
|
||||||
|
- path: /
|
||||||
|
pathType: Prefix
|
||||||
|
tls:
|
||||||
|
- hosts:
|
||||||
|
- spire-server-federation.production.other
|
||||||
|
secretName: tls-cert
|
||||||
|
|
||||||
|
spiffe-oidc-discovery-provider:
|
||||||
|
ingress:
|
||||||
|
hosts:
|
||||||
|
- host: oidc-discovery.production.other
|
||||||
|
paths:
|
||||||
|
- path: /
|
||||||
|
pathType: Prefix
|
||||||
|
tls:
|
||||||
|
- secretName: tls-cert
|
||||||
|
hosts:
|
||||||
|
- oidc-discovery.production.other
|
||||||
|
|
||||||
@@ -48,7 +48,7 @@ kubectl apply -f "${DEPS}/testcert.yaml" -n spire-server
|
|||||||
--wait
|
--wait
|
||||||
|
|
||||||
ip=$(kubectl get svc -n ingress-nginx ingress-nginx-controller -o go-template='{{ .spec.clusterIP }}')
|
ip=$(kubectl get svc -n ingress-nginx ingress-nginx-controller -o go-template='{{ .spec.clusterIP }}')
|
||||||
echo "$ip" oidc-discovery.example.org
|
echo "$ip" oidc-discovery.production.other
|
||||||
|
|
||||||
cat > /tmp/dummydns <<EOF
|
cat > /tmp/dummydns <<EOF
|
||||||
spiffe-oidc-discovery-provider:
|
spiffe-oidc-discovery-provider:
|
||||||
@@ -56,24 +56,18 @@ spiffe-oidc-discovery-provider:
|
|||||||
hostAliases:
|
hostAliases:
|
||||||
- ip: "$ip"
|
- ip: "$ip"
|
||||||
hostnames:
|
hostnames:
|
||||||
- "oidc-discovery.example.org"
|
- "oidc-discovery.production.other"
|
||||||
spire-agent:
|
spire-agent:
|
||||||
hostAliases:
|
hostAliases:
|
||||||
- ip: "$ip"
|
- ip: "$ip"
|
||||||
hostnames:
|
hostnames:
|
||||||
- "spire-server.example.org"
|
- "spire-server.production.other"
|
||||||
spire-server:
|
spire-server:
|
||||||
tests:
|
tests:
|
||||||
hostAliases:
|
hostAliases:
|
||||||
- ip: "$ip"
|
- ip: "$ip"
|
||||||
hostnames:
|
hostnames:
|
||||||
- "spire-server-federation.example.org"
|
- "spire-server-federation.production.other"
|
||||||
federation:
|
|
||||||
ingress:
|
|
||||||
tls:
|
|
||||||
- hosts:
|
|
||||||
- spire-server-federation.example.org
|
|
||||||
secretName: tls-cert
|
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
"${helm_install[@]}" spire charts/spire \
|
"${helm_install[@]}" spire charts/spire \
|
||||||
@@ -84,11 +78,17 @@ EOF
|
|||||||
--values "${SCRIPTPATH}/values-export-federation-https-web-ingress-nginx.yaml" \
|
--values "${SCRIPTPATH}/values-export-federation-https-web-ingress-nginx.yaml" \
|
||||||
--values /tmp/dummydns \
|
--values /tmp/dummydns \
|
||||||
--set spiffe-oidc-discovery-provider.tests.tls.customCA=tls-cert,spire-server.tests.tls.customCA=tls-cert \
|
--set spiffe-oidc-discovery-provider.tests.tls.customCA=tls-cert,spire-server.tests.tls.customCA=tls-cert \
|
||||||
--set spire-agent.server.address=spire-server.example.org,spire-agent.server.port=443 \
|
--set spire-agent.server.address=spire-server.production.other,spire-agent.server.port=443 \
|
||||||
|
--values "${SCRIPTPATH}/example-your-values.yaml" \
|
||||||
--wait
|
--wait
|
||||||
|
|
||||||
helm test --namespace "${ns}" spire
|
helm test --namespace "${ns}" spire
|
||||||
|
|
||||||
|
if helm get manifest -n spire-server spire | grep -i example; then
|
||||||
|
echo Global settings did not work. Please fix.
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
print_helm_releases
|
print_helm_releases
|
||||||
print_spire_workload_status "${ns}"
|
print_spire_workload_status "${ns}"
|
||||||
|
|
||||||
|
|||||||
@@ -2,6 +2,8 @@ global:
|
|||||||
telemetry:
|
telemetry:
|
||||||
prometheus:
|
prometheus:
|
||||||
enabled: true
|
enabled: true
|
||||||
|
spire:
|
||||||
|
strictMode: true
|
||||||
|
|
||||||
spire-server:
|
spire-server:
|
||||||
nodeAttestor:
|
nodeAttestor:
|
||||||
|
|||||||
Reference in New Issue
Block a user