Day 7: mTLS without a mesh – both show each other their badge
Goal: connect two services on different nodes over mutually verified TLS, with X.509-SVIDs from SPIRE and an allow list of SPIFFE IDs – without a service mesh, without a certificate in a file · Duration: about 90 min · Prerequisite: Day 6 completed
Where we start
# on id1
sudo -u spire /opt/spire/bin/spire-server entry count -socketPath /run/spire-server/api.sockExpected:
3 registration entries
# on id1
kubectl exec -n laden werkstatt -- /opt/spire/bin/spire-agent api fetch x509 -socketPath /run/spire/sockets/agent.sockExpected: Received 1 svid with
spiffe://gebaeude.test/laden/werkstatt.
Introduction
Yesterday you saw that an X.509-SVID is a chip card, built for TLS. Today you use it for that. A warehouse service hands out the stock only to services that identify themselves with the right SPIFFE ID. And the requesting service talks only to a warehouse that identifies itself as well. That is mTLS – mutual TLS, TLS verified on both sides.
A service mesh such as Istio or Linkerd does this automatically for every pod, but it brings a lot of technology with it. Today you build it by hand and small: with ghostunnel, a TLS proxy that fetches its SVID itself via the Workload API and renews it every hour. The applications themselves know nothing about TLS.
Today you will learn:
- how a sidecar proxy secures a service that knows nothing about TLS with mTLS,
- why the backend may listen only on
127.0.0.1, - how to allow (
--allow-uri) and verify (--verify-uri) peers by SPIFFE ID, - how server and client reject foreign, missing and wrong badges – and what the logs say,
- how to read the certificate of a running service from the outside.
Background
The picture for today: two front offices
The warehouse has a front office. The door from the corridor leads into the front office, not into the warehouse. The door from the front office into the warehouse has no handle on the corridor side – it only opens from the inside. In the front office sits someone who asks every visitor for their chip card, checks the chip and then looks at a list: “Purchasing may come in.” If the visitor is not on the list, the door stays closed.
Purchasing also has a front office – for the way out. Anyone in purchasing who wants something from the warehouse hands the request to the front office. The front office goes to the warehouse, first has the warehouse show its card, and checks: “Is this really the warehouse?” Only then does it show its own card.
Both show each other their badge. The staff in the warehouse and in purchasing notice none of this.
The terms
| Term | Meaning | in the picture |
|---|---|---|
| TLS | encrypted connection; the server identifies itself with a certificate | one side shows its card |
| mTLS | TLS in which the client must also show a certificate | both show their card |
| Sidecar | second container in the same pod, shares the network with the application | the front office |
| ghostunnel | TLS proxy with server and client mode, can use the Workload API | the person in the front office |
--allow-uri |
server: admit only clients with this SPIFFE ID | list “may come in” |
--verify-uri |
client: talk only to a server with this SPIFFE ID | “Is this really the warehouse?” |
| Service mesh | infrastructure that automatically gives every pod such a proxy | a front office in every office, set up by the caretaker |
Remember: With mTLS both sides check. The server asks “Who are you, and are you on my list?”, the client asks “Are you really the one I wanted to reach?”
What talks to what in the lab
| Pod | Node | Container | listens on | SPIFFE ID |
|---|---|---|---|---|
lager-api |
id2 | bestand (http-echo) |
127.0.0.1:8080, only inside the pod |
– |
tunnel (ghostunnel server) |
0.0.0.0:8443 |
spiffe://gebaeude.test/laden/lager-api |
||
einkauf |
id1 | shell (curl) |
– | – |
tunnel (ghostunnel client) |
127.0.0.1:8080, only inside the pod |
spiffe://gebaeude.test/laden/einkauf |
The path of a request: curl in purchasing →
127.0.0.1:8080 (purchasing’s front office) → mTLS over the
network → lager-api:8443 (warehouse front office) →
127.0.0.1:8080 (warehouse).
Drill 1: Personnel files for warehouse and purchasing
Where you are: on id1.
What you have afterwards: two registration entries, one per service.
Step 1 – working folder.
# on id1
mkdir -p ~/kurs/07Step 2 – the warehouse.
# on id1
sudo -u spire /opt/spire/bin/spire-server entry create -parentID spiffe://gebaeude.test/knoten/labor -spiffeID spiffe://gebaeude.test/laden/lager-api -selector k8s:ns:laden -selector k8s:sa:lager-api -socketPath /run/spire-server/api.sockExpected (excerpt):
SPIFFE ID : spiffe://gebaeude.test/laden/lager-api
Parent ID : spiffe://gebaeude.test/knoten/labor
Selector : k8s:ns:laden
Selector : k8s:sa:lager-api
Step 3 – purchasing.
# on id1
sudo -u spire /opt/spire/bin/spire-server entry create -parentID spiffe://gebaeude.test/knoten/labor -spiffeID spiffe://gebaeude.test/laden/einkauf -selector k8s:ns:laden -selector k8s:sa:einkauf -socketPath /run/spire-server/api.sockExpected (excerpt):
SPIFFE ID : spiffe://gebaeude.test/laden/einkauf
Parent ID : spiffe://gebaeude.test/knoten/labor
Selector : k8s:ns:laden
Selector : k8s:sa:einkauf
You create the entries before the pods exist. That is on purpose: when a pod starts, its badge is already waiting.
Remember: One service, one ServiceAccount, one entry. Then every SPIFFE ID belongs to exactly one service.
Save your progress? Sign up for free
Drill 2: The warehouse with a front office
Where you are: on id1.
What you have afterwards: the pod
lager-apion id2, which accepts requests only over mTLS and only from purchasing.
Step 1 – the manifest.
# on id1
nano ~/kurs/07/lager-api.yamlapiVersion: v1
kind: ServiceAccount
metadata:
name: lager-api
namespace: laden
---
apiVersion: v1
kind: Pod
metadata:
name: lager-api
namespace: laden
labels:
app: lager-api
spec:
serviceAccountName: lager-api
automountServiceAccountToken: false
nodeName: id2
containers:
- name: bestand
image: hashicorp/http-echo:1.0
args: ["-listen=127.0.0.1:8080", "-text=Lagerbestand: 42 Kisten"]
- name: tunnel
image: ghostunnel/ghostunnel:v1.11.5
command: ["ghostunnel"]
args:
- server
- --use-workload-api-addr=unix:///run/spire/sockets/agent.sock
- --listen=0.0.0.0:8443
- --target=127.0.0.1:8080
- --allow-uri=spiffe://gebaeude.test/laden/einkauf
ports:
- containerPort: 8443
volumeMounts:
- name: spire-sockel
mountPath: /run/spire/sockets
readOnly: true
volumes:
- name: spire-sockel
hostPath:
path: /run/spire/agent-sockets
type: Directory
---
apiVersion: v1
kind: Service
metadata:
name: lager-api
namespace: laden
spec:
selector:
app: lager-api
ports:
- port: 8443
targetPort: 8443| Option | Meaning |
|---|---|
bestand, -listen=127.0.0.1:8080 |
the warehouse; reachable only inside the pod – the door without a handle on the corridor side |
command: ["ghostunnel"] |
without this the image starts nothing; the program must be named |
server |
ghostunnel accepts TLS and forwards it as plain text |
--use-workload-api-addr=unix://… |
certificate, key and bundle come from the SPIRE agent and are renewed continuously |
--listen=0.0.0.0:8443 |
the front office can be reached from the corridor |
--target=127.0.0.1:8080 |
behind it lies the warehouse |
--allow-uri=…/laden/einkauf |
only this client may pass |
Step 2 – start it.
# on id1
kubectl apply -f ~/kurs/07/lager-api.yamlExpected:
serviceaccount/lager-api created
pod/lager-api created
service/lager-api created
# on id1
kubectl wait --for=condition=Ready pod/lager-api -n laden --timeout=90sExpected:
pod/lager-api condition met
Step 3 – what the front office reports. The pod has
two containers; -c selects one:
# on id1
kubectl logs -n laden lager-api -c tunnelExpected:
[1] 2026/12/01 11:12:17.538136 starting ghostunnel in server mode
[1] 2026/12/01 11:12:17.538260 setting up landlock rules to limit process privileges
[1] 2026/12/01 11:12:17.540642 using SPIFFE Workload API as certificate source
[1] 2026/12/01 11:12:17.541940 using target address 127.0.0.1:8080
[1] 2026/12/01 11:12:17.542995 spiffe/debug: Watching X.509 contexts
[1] 2026/12/01 11:12:17.663016 listening for connections on 0.0.0.0:8443
What you see: ghostunnel has registered with the
agent and waits for updates (“Watching X.509 contexts”). Between
“Watching” and “listening” there are 120 milliseconds – that is how long
it took for the first SVID to arrive. landlock is a Linux
feature that ghostunnel uses to forbid itself access to everything it
does not need.
If it does not work
If the log says
ghostunnel: error: unknown long flag '--unsafe-listen', try --help,
you have used a client-mode flag in server mode. As a precaution,
ghostunnel restricts one side each to localhost: in server
mode the target (--unsafe-target lifts that), in client
mode the listener (--unsafe-listen). You need neither
here.
Remember: The warehouse listens only on
127.0.0.1. Anyone who wants to reach it must go through the front office – otherwise the whole check would be a door next to the open door.
Save your progress? Sign up for free
Drill 3: Purchasing fetches the stock
Where you are: on id1.
What you have afterwards: a pod
einkaufon id1 that talks to the warehouse on id2 over mTLS.
Step 1 – the manifest.
# on id1
nano ~/kurs/07/einkauf.yamlapiVersion: v1
kind: ServiceAccount
metadata:
name: einkauf
namespace: laden
---
apiVersion: v1
kind: Pod
metadata:
name: einkauf
namespace: laden
spec:
serviceAccountName: einkauf
automountServiceAccountToken: false
nodeName: id1
containers:
- name: shell
image: curlimages/curl:8.17.0
command: ["sleep", "infinity"]
- name: tunnel
image: ghostunnel/ghostunnel:v1.11.5
command: ["ghostunnel"]
args:
- client
- --use-workload-api-addr=unix:///run/spire/sockets/agent.sock
- --listen=127.0.0.1:8080
- --target=lager-api.laden.svc.cluster.local:8443
- --verify-uri=spiffe://gebaeude.test/laden/lager-api
volumeMounts:
- name: spire-sockel
mountPath: /run/spire/sockets
readOnly: true
volumes:
- name: spire-sockel
hostPath:
path: /run/spire/agent-sockets
type: Directory| Option | Meaning |
|---|---|
client |
ghostunnel accepts plain text and builds TLS to the outside |
--listen=127.0.0.1:8080 |
purchasing’s front office, reachable only inside the pod |
--target=lager-api.laden.svc.cluster.local:8443 |
the warehouse’s Service |
--verify-uri=…/laden/lager-api |
talk only if the server shows this SPIFFE ID |
With SPIFFE the client does not check the host name in the
certificate; it checks the chain up to the bundle and the SPIFFE ID.
That is why the warehouse’s certificate does not need the name
lager-api.laden.svc….
# on id1
kubectl apply -f ~/kurs/07/einkauf.yaml# on id1
kubectl wait --for=condition=Ready pod/einkauf -n laden --timeout=90sExpected:
pod/einkauf condition met
Step 2 – the request. curl speaks only
plain HTTP with its own front office:
# on id1
kubectl exec -n laden einkauf -c shell -- curl -s http://127.0.0.1:8080/Expected:
Lagerbestand: 42 Kisten
Step 3 – what both front offices saw.
# on id1
kubectl logs -n laden einkauf -c tunnel --tail=2Expected:
[1] 2026/12/01 11:12:28.373032 opening pipe: tcp:127.0.0.1:39544 [no tls] <-> tcp:10.43.185.221:8443 [O=SPIRE,C=US]
[1] 2026/12/01 11:12:28.386107 closed pipe: tcp:127.0.0.1:39544 [no tls] <-> tcp:10.43.185.221:8443 [O=SPIRE,C=US] [forwarded 78 bytes, returned 186 bytes, open 13ms]
# on id1
kubectl logs -n laden lager-api -c tunnel --tail=2Expected:
[1] 2026/12/01 11:12:28.391416 opening pipe: tcp:10.42.0.14:46182 [O=SPIRE,C=US] <-> tcp:127.0.0.1:8080 [no tls]
[1] 2026/12/01 11:12:28.400225 closed pipe: tcp:10.42.0.14:46182 [O=SPIRE,C=US] <-> tcp:127.0.0.1:8080 [no tls] [forwarded 78 bytes, returned 186 bytes, open 9ms]
| Part | Meaning |
|---|---|
[no tls] |
this side of the connection is plain text – inside the pod, via
127.0.0.1 |
[O=SPIRE,C=US] |
this side is TLS, with a SPIRE certificate (the Subject
from Day 6) |
10.42.0.14 |
purchasing’s pod IP; purchasing runs on id1, the warehouse on id2 |
forwarded 78 bytes, returned 186 bytes |
the HTTP request there, the response back |
What you see: Two nodes, one encrypted connection verified on both sides. No certificate sits in a file, no key in a Secret. Both sides get their cards from the gatekeeper of their node and receive new ones in an hour.
Remember: The applications speak plain text with
127.0.0.1. TLS, badges and the allow list are handled by the front offices.
Save your progress? Sign up for free
Drill 4: Who does not get through
Where you are: on id1.
What you have afterwards: three rejected attempts with their traces in the logs and a look at the warehouse’s card.
Step 1 – a genuine badge, but not on the list. A pod
like purchasing, only with the ServiceAccount werkstatt –
that is, with the identity
spiffe://gebaeude.test/laden/werkstatt:
# on id1
nano ~/kurs/07/fremd.yamlapiVersion: v1
kind: Pod
metadata:
name: fremd
namespace: laden
spec:
serviceAccountName: werkstatt
automountServiceAccountToken: false
nodeName: id1
containers:
- name: shell
image: curlimages/curl:8.17.0
command: ["sleep", "infinity"]
- name: tunnel
image: ghostunnel/ghostunnel:v1.11.5
command: ["ghostunnel"]
args:
- client
- --use-workload-api-addr=unix:///run/spire/sockets/agent.sock
- --listen=127.0.0.1:8080
- --target=lager-api.laden.svc.cluster.local:8443
- --verify-uri=spiffe://gebaeude.test/laden/lager-api
volumeMounts:
- name: spire-sockel
mountPath: /run/spire/sockets
readOnly: true
volumes:
- name: spire-sockel
hostPath:
path: /run/spire/agent-sockets
type: Directory# on id1
kubectl apply -f ~/kurs/07/fremd.yaml# on id1
kubectl wait --for=condition=Ready pod/fremd -n laden --timeout=90s# on id1
kubectl exec -n laden fremd -c shell -- curl -sS http://127.0.0.1:8080/Expected:
curl: (52) Empty reply from server
command terminated with exit code 52
# on id1
kubectl logs -n laden lager-api -c tunnel --tail=1Expected:
[1] 2026/12/01 11:12:44.775651 error on TLS handshake from 10.42.0.15:58982: unauthorized: invalid principal, or principal not allowed
What you see: The card was genuine – after all, the
workshop got its SVID from SPIRE. But laden/werkstatt is
not on the list. A “principal” is the verified identity of the
client.
Step 2 – no card at all. The till has
curl, but no front office and no SVID. It tries directly
via HTTPS; -k turns off verification of the server
certificate so that only the client certificate matters:
# on id1
kubectl exec -n laden kasse -- curl -sSk https://lager-api.laden.svc.cluster.local:8443/Expected:
curl: (56) SSL certificate OpenSSL verify result: unable to get local issuer certificate (20)
command terminated with exit code 56
# on id1
kubectl logs -n laden lager-api -c tunnel --tail=1Expected:
[1] 2026/12/01 11:12:47.355733 error on TLS handshake from 10.42.0.8:34762: tls: client didn't provide a certificate
What you see: The curl message is
misleading – it mentions server verification even though -k
turned it off. The truth is on the server side: the client did not show
a card. With TLS errors, always read both sides.
Step 3 – at the door without a handle. And what if someone wants to bypass the front office and go straight to the warehouse? Get the pod IP:
# on id1
kubectl get pod lager-api -n laden -o wideExpected (your IP will be different):
NAME READY STATUS RESTARTS AGE IP NODE NOMINATED NODE READINESS GATES
lager-api 2/2 Running 0 32s 10.42.1.15 id2 <none> <none>
# on id1
kubectl exec -n laden kasse -- curl -sS http://10.42.1.15:8080/Expected:
curl: (7) Failed to connect to 10.42.1.15 port 8080 after 2 ms: Could not connect to server
What you see: The warehouse listens only on
127.0.0.1 in its own pod. From the outside, port 8080 does
not exist.
Step 4 – look at the warehouse’s card. From id1 you
can reach the pod IP directly. step fetches the certificate
that ghostunnel shows in the TLS handshake:
# on id1
step certificate inspect --short --insecure https://10.42.1.15:8443--short– only the most important details,--insecure– show the certificate even ifstepdoes not trust it.
Expected:
X.509v3 TLS Certificate (ECDSA P-256) [Serial: 3307...1442]
Subject: spiffe://gebaeude.test/laden/lager-api
Issuer:
Valid from: 2026-12-01T11:11:41Z
to: 2026-12-01T12:11:51Z
What you see: The warehouse’s card with its SPIFFE
ID and a lifetime of one hour. In the short form, step
lists the names from the SAN under Subject – here the URI.
With step certificate inspect without --short
you would see the actual Subject C=US,O=SPIRE
as on Day 6.
Remember: Rejection happens on three levels: wrong identity (not on the list), no identity (no client certificate), detour (backend not reachable). Each leaves its own trace.
Save your progress? Sign up for free
Diagnosis task
A colleague builds a second purchasing pod einkauf-neu
modeled on einkauf.yaml. They get no response:
# on id1
kubectl exec -n laden einkauf-neu -c shell -- curl -sS http://127.0.0.1:8080/Expected:
curl: (56) Recv failure: Connection reset by peer
command terminated with exit code 56
What is going on?
Solution path:
First your own front office:
# on id1 kubectl logs -n laden einkauf-neu -c tunnel --tail=2Expected:
[1] 2026/12/01 11:13:09.072131 listening for connections on 127.0.0.1:8080 [1] 2026/12/01 11:13:10.255306 error on dial: unauthorized: invalid principal, or principal not allowederror on dial– the error happens while connecting to the outside. “principal not allowed” means here: the server is not on the client’s list.The other side:
# on id1 kubectl logs -n laden lager-api -c tunnel --tail=1Expected:
[1] 2026/12/01 11:13:10.270885 error on TLS handshake from 10.42.0.16:35504: remote error: tls: bad certificateThe warehouse did not reject anything – it heard from the client that the client does not like the certificate.
So look at the check in the client – in the file the pod was created from:
# on id1 grep -n verify-uri ~/kurs/07/einkauf-neu.yamlExpected:
22: - --verify-uri=spiffe://gebaeude.test/laden/lager-apiis missing. The warehouse shows…/laden/lager-api, the client expects…/laden/lager.Solution: Enter
--verify-uri=spiffe://gebaeude.test/laden/lager-apiin the file, delete the pod and create it again. Afterwards remove the pod again so it does not confuse you in the coming days:# on id1 kubectl delete pod einkauf-neu -n laden
The lesson: “principal not allowed” can come from either side.
error on dial in the client means “I don’t like the
server”, error on TLS handshake in the server means “I
don’t like the client”.
Challenge
From now on, the workshop should also be allowed to query the stock.
Make sure the pod fremd from Drill 4 gets through without
taking anything away from purchasing. Write down the change before you
read the solution.
Solution: A second --allow-uri line in
the server. You work on a copy:
# on id1
cp ~/kurs/07/lager-api.yaml ~/kurs/07/lager-api-v2.yaml# on id1
nano ~/kurs/07/lager-api-v2.yamlapiVersion: v1
kind: ServiceAccount
metadata:
name: lager-api
namespace: laden
---
apiVersion: v1
kind: Pod
metadata:
name: lager-api
namespace: laden
labels:
app: lager-api
spec:
serviceAccountName: lager-api
automountServiceAccountToken: false
nodeName: id2
containers:
- name: bestand
image: hashicorp/http-echo:1.0
args: ["-listen=127.0.0.1:8080", "-text=Lagerbestand: 42 Kisten"]
- name: tunnel
image: ghostunnel/ghostunnel:v1.11.5
command: ["ghostunnel"]
args:
- server
- --use-workload-api-addr=unix:///run/spire/sockets/agent.sock
- --listen=0.0.0.0:8443
- --target=127.0.0.1:8080
- --allow-uri=spiffe://gebaeude.test/laden/einkauf
- --allow-uri=spiffe://gebaeude.test/laden/werkstatt
ports:
- containerPort: 8443
volumeMounts:
- name: spire-sockel
mountPath: /run/spire/sockets
readOnly: true
volumes:
- name: spire-sockel
hostPath:
path: /run/spire/agent-sockets
type: Directory
---
apiVersion: v1
kind: Service
metadata:
name: lager-api
namespace: laden
spec:
selector:
app: lager-api
ports:
- port: 8443
targetPort: 8443The arguments of a running container cannot be changed, so replace the pod:
# on id1
kubectl delete pod lager-api -n laden# on id1
kubectl apply -f ~/kurs/07/lager-api-v2.yaml# on id1
kubectl wait --for=condition=Ready pod/lager-api -n laden --timeout=90s# on id1
kubectl exec -n laden fremd -c shell -- curl -sS http://127.0.0.1:8080/Expected:
Lagerbestand: 42 Kisten
# on id1
kubectl exec -n laden einkauf -c shell -- curl -sS http://127.0.0.1:8080/Expected:
Lagerbestand: 42 Kisten
The list grants access per identity, not per pod: every pod with the
ServiceAccount werkstatt – including the two from Day 5 –
now gets through as soon as it has a front office.
Save your progress? Sign up for free
Checkpoint
# on id1
sudo -u spire /opt/spire/bin/spire-server entry count -socketPath /run/spire-server/api.sockExpected:
5 registration entries
# on id1
kubectl get pods -n laden -o wideExpected (excerpt): einkauf and
fremd with 2/2 Running on id1,
lager-api with 2/2 Running on id2.
# on id1
kubectl exec -n laden einkauf -c shell -- curl -sS http://127.0.0.1:8080/Expected:
Lagerbestand: 42 Kisten
Test yourself
- What distinguishes mTLS from normal TLS?
- Why does the warehouse listen on
127.0.0.1and not on0.0.0.0? - The client does not check whether the warehouse’s certificate
contains
lager-api.laden.svc.cluster.local. Is that a gap? - The server log says
principal not allowed, the client log sayserror on dial: … principal not allowed. Who rejected whom in each case? - In one hour the SVIDs of warehouse and purchasing expire. What do you have to do?
- What does a service mesh offer compared with what you built today – and what does it cost?
Answers:
- With TLS only the server shows a certificate. With mTLS the server also demands one from the client and verifies it; this way the server knows the client’s identity.
- Otherwise anyone in the cluster could reach the warehouse directly over HTTP, bypassing the front office (Drill 4, step 3). The check would be worthless.
- No. With SPIFFE the SPIFFE ID replaces the host name: the client
checks the chain up to the bundle and, with
--verify-uri, the server’s identity. That is stricter than a host name, because an attacker who redirects DNS still gets no SVID forladen/lager-api. - In the server log: the server rejected the client. In the client log
with
error on dial: the client rejected the server. - Nothing – at least that is what the ghostunnel docs promise: it watches the Workload API (“Watching X.509 contexts”) and picks up new SVIDs on its own. You check on Day 8 whether that is true.
- A mesh automatically gives every pod such a front office, with policies as Kubernetes resources, metrics and retries. It costs complexity, resources per pod and one more component you have to trust. For two services ghostunnel is enough; for two hundred you use a mesh.
Interview note
“How do you secure service-to-service traffic without a service
mesh?” – Good answer: with mTLS and workload identities. Every service
fetches its X.509-SVID via the SPIFFE Workload API – directly with a
library such as go-spiffe or through a sidecar proxy such as ghostunnel
or Envoy with SDS. The server admits clients by SPIFFE ID, the client
verifies the server’s SPIFFE ID instead of the host name. The backend
listens only on localhost. Certificates rotate automatically, no key
sits in a Secret. If they dig deeper: authorization by SPIFFE ID is
coarse – for anything finer, put a policy engine such as OPA behind it,
which ghostunnel supports directly with --allow-policy.
Enterprise note
Allow lists as start arguments do not scale: every change replaces
the pod. In production you put the rules into a policy (OPA/Rego) that
ghostunnel reloads at runtime, or you use a mesh that manages rules as
Kubernetes resources – Istio AuthorizationPolicy, Linkerd
AuthorizationPolicy or Cilium with SPIFFE support. Istio
can use SPIRE as its identity source; then the same SPIFFE IDs apply
inside the mesh and outside.
The hostPath socket is convenient, but it gives every pod that is allowed to mount it access to the agent. In production an admission policy forbids hostPath volumes for normal pods, and the socket comes via the SPIFFE CSI driver.
Summary
- ghostunnel fetches its SVID via the Workload API and renews it itself; certificates are never stored as files.
- Server mode: TLS in, plain text to
127.0.0.1, access granted with--allow-uri. - Client mode: plain text from
127.0.0.1, TLS out, verification with--verify-uri. - The backend listens only on
127.0.0.1; from the outside there is only the TLS port. - A foreign identity, a missing client certificate and a wrong server identity are rejected; the logs of both sides show who rejected whom.
- Access is granted per SPIFFE ID, so for all pods with the same ServiceAccount.
Commands at a glance
| Command | What for |
|---|---|
ghostunnel server --use-workload-api-addr=unix://<sock> --listen=… --target=… --allow-uri=<id> |
mTLS server in front of a plain-text service |
ghostunnel client --use-workload-api-addr=unix://<sock> --listen=… --target=… --verify-uri=<id> |
mTLS client for a plain-text caller |
kubectl logs <pod> -c <container> |
logs of a specific container |
kubectl exec <pod> -c <container> -- … |
command in a specific container |
curl -sSk https://… |
HTTPS without verifying the server certificate, with error message |
step certificate inspect --short --insecure https://<ip>:<port> |
read the certificate of a running service |