Skip to content

Commit c91fcb5

Browse files
ixxeL2097Frederic Spiers
andauthored
refactor(tunneling): remove HTTPS support for Rtunnel and improve documentation and Helm chart on TLS Rtunnel (#76)
* fix(helm): ingress TLS bad rendering * refactor(helm): remove HTTPS reverse tunneling --------- Co-authored-by: Frederic Spiers <[email protected]>
1 parent f9d3830 commit c91fcb5

File tree

12 files changed

+181
-310
lines changed

12 files changed

+181
-310
lines changed

docs/client-log-fetcher.sh

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#!/bin/bash
2+
3+
TIMESTAMP=$(date +"%Y%m%d_%H%M%S")
4+
mkdir -p "logs_$TIMESTAMP"
5+
6+
for i in 0 1 2; do
7+
for c in nginx ggbridge; do
8+
echo -e "=== INDEX: $i - CONTAINER: $c - $(date) ===\n" > "logs_$TIMESTAMP/index-${i}_${c}.log"
9+
kubectl logs -l "app.kubernetes.io/instance=ggbridge,index=$i" -c "$c" -n ggbridge --tail=1000 2>&1 | sed 's/\x1b\[[0-9;]*[mGKHF]//g' >> "logs_$TIMESTAMP/index-${i}_${c}.log"
10+
done
11+
done
12+
13+
tar -czf "ggbridge_logs_$TIMESTAMP.tgz" "logs_$TIMESTAMP"
14+
rm -rf "logs_$TIMESTAMP"
15+
echo "✅ Archive created: ggbridge_logs_$TIMESTAMP.tgz"

docs/troubleshoot.md

Lines changed: 96 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,25 @@ GGBridge provides two types of images for different use cases:
1212
- **Docker Compose**: Update the image tag in `docker-compose.yaml`
1313
- **Helm**: Update the image tag in `values.yaml`
1414

15+
### Basic checks
16+
17+
Some very basic commands can be executed to check deployment healthiness before going further into debugging.
18+
19+
Check pods status:
20+
```bash
21+
kubectl get pods -n ggbridge -o wide
22+
```
23+
24+
You should be looking for `Running` status, Ready column showing `1/1` (or `2/2`), and low restart count.
25+
26+
Check pods details:
27+
```bash
28+
kubectl describe pod $pod_name -n ggbridge
29+
```
30+
31+
Have a look at the `Events` section for suspicious warnings or errors.
32+
33+
1534
### Connectivity Tests
1635

1736
#### 1. Client-Side Healthcheck
@@ -107,29 +126,93 @@ Expected output: List of Git branches and their commit hashes
107126
> [!TIP]
108127
> Please consider using the `CronJob` probes available [here](../tests/) if you want a permanent check.
109128
110-
### Log Analysis
129+
#### 4. Reverse tunneling
111130
112-
#### Client/Server Health Logs.
113-
Check nginx sidecar logs for connectivity issues:
131+
When reverse tunneling is enabled on client side, you can check if you are able to connect to `api.gitguardian.com`. Execute this command on the customer's cluster:
114132
115133
```bash
116-
# Check specific pod logs
117-
kubectl logs -l tenant=$uid,index=$index -c nginx -n ggbridge
134+
kubectl run debug -it --rm \
135+
--restart=Never \
136+
-n ggbridge \
137+
--image=nicolaka/netshoot \
138+
-- zsh -c "curl -IL --resolve api.gitguardian.com:443:$(kubectl get svc ggbridge-proxy-tls -n ggbridge -o jsonpath='{.spec.clusterIP}') https://api.gitguardian.com"
139+
```
140+
141+
Check that DNS resolution on customer's environment properly resolve to the custom Kubernetes endpoint (implentation specific) instead of the public IP address of `hook.gitguardian.com`/`api.gitguardian.com`. Execute following commands from the customer's VCS server for example:
142+
143+
```bash
144+
dig hook.gitguardian.com
145+
dig api.gitguardian.com
146+
```
118147
119-
# Check all pods for a tenant
120-
kubectl logs -l tenant=$uid -c nginx -n ggbridge --tail=50
148+
```bash
149+
traceroute hook.gitguardian.com
150+
traceroute api.gitguardian.com
121151
```
122-
Healthy connection log example:
152+
153+
### Log Analysis
154+
155+
> [!TIP]
156+
> To collect and package **client side** logs in a `.tgz` archive, you can use the [dedicated script](./client-log-fetcher.sh)
157+
158+
#### 1. Client/Server Healthcheck Logs
159+
Check nginx sidecar logs for connectivity issues :
160+
161+
Server side:
162+
```bash
163+
# Check ggbridge server nginx container logs for a specific tenant and index
164+
kubectl logs -l tenant=$uid,index=$index,app.kubernetes.io/component=server -c nginx -n ggbridge
165+
```
166+
Client side:
167+
```bash
168+
# Check ggbridge client nginx container logs for a specific index
169+
kubectl logs -l index=$index,app.kubernetes.io/instance=ggbridge -c nginx -n ggbridge
170+
```
171+
172+
Healthy connection log example for the Healthcheck probe (nginx container for server/client pod):
123173
```console
124174
health 127.0.0.1 [30/Sep/2025:12:04:38 +0000] 127.0.0.1 "GET /healthz HTTP/1.1" 200 3 "-" "Go-http-client/1.1"
125175
```
126176
No logs = No connectivity from the other tunnel endpoint.
127177
128-
#### Server-Side Proxy Logs
178+
#### 2. Client/Server tunnel Logs
179+
180+
Server side:
181+
```bash
182+
# Check ggbridge server main container logs for a specific tenant and index
183+
kubectl logs -l tenant=$uid,index=$index,app.kubernetes.io/component=server -c ggbridge -n ggbridge
184+
```
185+
Client side:
186+
```bash
187+
# Check ggbridge client main container logs for a specific index
188+
kubectl logs -l index=$index,app.kubernetes.io/instance=ggbridge -c ggbridge -n ggbridge
189+
```
190+
191+
You should see `INFO` logs mentionning opened/closed connections:
192+
```console
193+
2025-10-16T08:21:06.156024Z INFO wstunnel::protocols::tls::server: Doing TLS handshake using SNI DnsName("jpynh30wscp60zs4lbdf4m4p8qe9idgu.ggbridge.gitguardian.com") with the server jpynh30wscp60zs4lbdf4m4p8qe9idgu.ggbridge.gitguardian.com:443
194+
2025-10-16T08:21:06.570872Z INFO tunnel{id="0199ec1b-c14b-7f41-9492-e538c7a90f97" remote="127.0.0.1:8081"}: wstunnel::tunnel::transport::io: Closing local => remote tunnel
195+
2025-10-16T08:21:06.571213Z INFO tunnel{id="0199ec1b-c14b-7f41-9492-e538c7a90f97" remote="127.0.0.1:8081"}: wstunnel::tunnel::transport::io: Closing local <= remote tunnel
196+
2025-10-16T08:21:08.489704Z INFO tunnel{id="0199ec1b-af3c-70e3-8595-cd82aaf74cf4" remote="0.0.0.0:9081"}: wstunnel::tunnel::transport::io: Closing local => remote tunnel
197+
2025-10-16T08:21:08.738773Z INFO wstunnel::protocols::tls::server: Doing TLS handshake using SNI DnsName("jpynh30wscp60zs4lbdf4m4p8qe9idgu.ggbridge.gitguardian.com") with the server jpynh30wscp60zs4lbdf4m4p8qe9idgu.ggbridge.gitguardian.com:443
198+
2025-10-16T08:21:10.693531Z INFO tunnel{id="0199ec1b-b789-7362-b52a-5853e726c484" remote="0.0.0.0:9081"}: wstunnel::tunnel::transport::io: Closing local => remote tunnel
199+
2025-10-16T08:21:10.947501Z INFO wstunnel::protocols::tls::server: Doing TLS handshake using SNI DnsName("jpynh30wscp60zs4lbdf4m4p8qe9idgu.ggbridge.gitguardian.com") with the server jpynh30wscp60zs4lbdf4m4p8qe9idgu.ggbridge.gitguardian.com:443
200+
```
201+
202+
> [!NOTE]
203+
> Any log entries at `WARN` or `ERROR` level are worth highlighting if present.
204+
205+
> [!NOTE]
206+
> You can also increase verbosity if needed, at `DEBUG` or `TRACE` level (default `INFO`):
207+
> ```yaml
208+
> logLevel: INFO # --> set de DEBUG or TRACE on server/client side values.yaml
209+
> ```
210+
211+
#### 3. Server-Side Proxy Logs
129212
130213
Monitor traffic through the SOCKS proxy:
131214
```bash
132-
kubectl logs -l app.kubernetes.io/component=proxy,tenant=$uid -c nginx -n ggbridge --tail=100
215+
kubectl logs -l tenant=$uid,index=$index,app.kubernetes.io/component=proxy -n ggbridge
133216
```
134217
135218
Port meanings:
@@ -154,6 +237,9 @@ Log format explanation:
154237
| 10 | `"150"` | `"$upstream_bytes_received"` | Data received nginx ← backend | Bytes |
155238
| 11 | `"0.000"` | `"$upstream_connect_time"` | Connection time | Seconds |
156239
240+
> [!TIP]
241+
> If `Session duration` reach 5sec for healtcheck (port 8081), it means time out occured
242+
157243
## Client Monitoring/Alerting Guidelines
158244
### Overview
159245

examples/2-way-tunneling/README.md

Lines changed: 53 additions & 83 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@
22

33
By default, the `ggbridge` client does not expose any **client → server** proxies that allow accessing remote resources through the established tunnel.
44

5-
However, `ggbridge` supports two types of client-to-server proxies:
5+
However, `ggbridge` supports client-to-server proxy with **TLS Routing**.
66

7-
- **TLS Routing**: Exposes a TLS port to forward all incoming TLS traffic through a TCP tunnel. This requires DNS redirection, e.g., redirecting `hook.gitguardian.com` requests to the ggbridge client.
8-
- **HTTPS Routing**: Exposes an HTTPS service and allows defining routing rules. For instance, you can expose a hostname like `hook.gitguardian.internal` and route traffic to `hook.gitguardian.com` through the ggbridge tunnel.
7+
**TLS Routing** exposes a TLS port to forward all incoming TLS traffic through a TCP tunnel. This requires **DNS redirection**, e.g., redirecting `hook.gitguardian.com` requests to the ggbridge client.
98

10-
> **Note:** On the server side, only requests to `hook.gitguardian.com` and `api.gitguardian.com` are allowed for client → server traffic.
9+
> [!CAUTION]
10+
> On the server side, only requests to `hook.gitguardian.com` and `api.gitguardian.com` are allowed for client → server traffic.
1111
1212
---
1313

@@ -24,9 +24,12 @@ client:
2424
enabled: true
2525
```
2626
27+
> [!NOTE]
28+
> **TLS Routing** does not work natively with standard `Ingress` objects. Some Ingress controllers offer specific configurations (annotations, custom parameters, etc.) to enable TLS Routing with `Ingress`, but this depends entirely on your controller’s capabilities and is highly implementation-specific. Please refer to your Ingress controller’s documentation for this particular use case.
29+
2730
The TLS port can be exposed using one of the following methods:
2831

29-
1. LoadBalancer Service
32+
### 1. LoadBalancer Service
3033

3134
Helm values file example 👉 [values-tls-service.yaml](./helm/values-tls-service.yaml)
3235

@@ -38,124 +41,91 @@ proxy:
3841
type: LoadBalancer
3942
ports:
4043
tls:
41-
# 443 is the default TLS port
4244
port: 443
4345
```
46+
Ensure that your VCS (and any assets using the GitGuardian hook) resolve `hook.gitguardian.com` and `api.gitguardian.com` to the external IP address of the created LoadBalancer Service (default name `ggbridge-proxy-tls`).
4447

45-
2. Ingress
48+
> [!NOTE]
49+
> `LoadBalancer` Service exposes the Service externally using an external load balancer. Kubernetes does not directly offer a load balancing component; you must provide one, or you can integrate your Kubernetes cluster with a cloud provider. Refer to official [Kubernetes documentation](https://kubernetes.io/docs/concepts/services-networking/service/#loadbalancer) for more information.
4650

47-
Helm values file example 👉 [values-tls-ingress.yaml](./helm/values-tls-ingress.yaml)
51+
### 2. Custom Resource (CRD)
4852

49-
```yaml
50-
proxy:
51-
tunnels:
52-
tls:
53-
ingress:
54-
enabled: true
55-
className: ""
56-
```
53+
Some Ingress controllers provide Custom Resources that enable enhanced capabilities—such as TCP handling, authentication, and other advanced features. This is the case with Traefik, Istio, and other well-known Kubernetes networking solutions.
5754

58-
3. Gateway API
55+
Currently we support Traefik [`IngressRouteTCP`](https://doc.traefik.io/traefik/reference/routing-configuration/kubernetes/crd/tcp/ingressroutetcp/) Custom Resource. Ensure that Traefik ingress controller is installed in your cluster first.
5956

60-
Helm values file example 👉 [values-tls-gateway.yaml](./helm/values-tls-gateway.yaml)
57+
Helm values file example 👉 [values-tls-traefik.yaml](./helm/values-tls-traefik.yaml)
6158

6259
```yaml
6360
proxy:
6461
tunnels:
6562
tls:
66-
gateway:
67-
enabled: true
68-
# This will create the gateway resource, you can disable it if you want to mange it on you own.
69-
create: true
70-
className: ""
71-
```
72-
73-
4. OpenShift Route
74-
75-
Helm values file example 👉 [values-tls-openshift-route.yaml](./helm/values-tls-openshift-route.yaml)
76-
77-
```yaml
78-
proxy:
79-
resolver: dns-default.openshift-dns.svc.cluster.local
80-
tunnels:
81-
tls:
82-
openShiftRoute:
63+
ingress:
8364
enabled: true
65+
controller: "traefik"
8466
```
8567

86-
## HTTPS Routing
87-
88-
![https-routing](../../docs/images/ggbridge-https-routing.drawio.png)
89-
90-
To enable HTTPS Routing, update your Helm values:
91-
92-
```yaml
93-
client:
94-
tunnels:
95-
web:
96-
enabled: true
68+
Ensure that your VCS (and any assets using the GitGuardian hook) resolve `hook.gitguardian.com` and `api.gitguardian.com` to the external IP address of the Traefik LoadBalancer Service.
69+
```console
70+
$ kubectl get service -n traefik
71+
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
72+
traefik LoadBalancer 10.43.65.162 172.31.26.173 80:20572/TCP,443:27014/TCP 29h
9773
```
9874

99-
This service can be exposed via Ingress or Gateway:
75+
### 3. Gateway API
10076

101-
1. Ingress
77+
> [!NOTE]
78+
> [Gateway API](https://gateway-api.sigs.k8s.io/guides/#getting-started-with-gateway-api) must be installed in your cluster first.
10279

103-
Helm values file example 👉 [values-https-ingress.yaml](./helm/values-https-ingress.yaml)
80+
Helm values file example 👉 [values-tls-gateway.yaml](./helm/values-tls-gateway.yaml)
10481

10582
```yaml
10683
proxy:
10784
tunnels:
108-
web:
109-
ingress:
85+
tls:
86+
gateway:
11087
enabled: true
111-
# -- Set the ingress ClassName (leave empty to use default)
112-
className: ""
113-
listeners:
114-
# This listener exposes an HTTPS service with the hostname
115-
# `hook.private.com` and routes traffic to `hook.gitguardian.com`
116-
- hostname: hook.private.com
117-
backend: hook.gitguardian.com
118-
tls:
119-
# Certificate for hook.private.com
120-
secretName: internal-crt
88+
gateway:
89+
# This will create the gateway resource, you can disable it if you want to manage it on your own.
90+
create: true
91+
# This will set the gatewayClass of the Gateway
92+
className: "my-gatewayclass"
12193
```
12294

123-
2. Gateway API
124-
125-
Helm values file example 👉 [values-https-gateway.yaml](./helm/values-https-gateway.yaml)
95+
This will create a [`Gateway`](https://gateway-api.sigs.k8s.io/concepts/api-overview/#gateway) and [`TLSRoute`](https://gateway-api.sigs.k8s.io/concepts/api-overview/#tlsroute) object. You need to deploy first a [`GatewayClass`](https://gateway-api.sigs.k8s.io/concepts/api-overview/#gatewayclass) in your cluster.
12696

97+
If your teams already manage `GatewayClass` and `Gateway` resources, you can reference the `Gateway` in the `TLSRoute` with :
12798
```yaml
12899
proxy:
129100
tunnels:
130-
web:
101+
tls:
131102
gateway:
132103
enabled: true
133-
# -- Set the gateway ClassName (leave empty to use default)
134-
className: ""
135-
listeners:
136-
- hostname: hook.private.com
137-
backend: hook.gitguardian.com
138-
tls:
139-
# Certificate for hook.private.com
140-
secretName: internal-crt
104+
parentRefs:
105+
- name: my-gateway
106+
namespace: my-gateway-namespace
107+
gateway:
108+
create: false
141109
```
142110

143-
3. OpenShift Route
111+
Ensure that your VCS (and any assets using the GitGuardian hook) resolve `hook.gitguardian.com` and `api.gitguardian.com` to the IP address of the `Gateway` Custom Resource.
112+
```console
113+
$ kubectl get gateway
114+
NAME CLASS ADDRESS PROGRAMMED AGE
115+
my-gateway my-gatewayclass 192.168.1.200 True 54h
116+
```
117+
118+
### 4. OpenShift Route
144119

145-
Helm values file example 👉 [values-https-openshift-route.yaml](./helm/values-https-openshift-route.yaml)
120+
Helm values file example 👉 [values-tls-openshift-route.yaml](./helm/values-tls-openshift-route.yaml)
146121

147122
```yaml
148123
proxy:
149124
resolver: dns-default.openshift-dns.svc.cluster.local
150125
tunnels:
151-
web:
152-
openShiftRoute::
126+
tls:
127+
openShiftRoute:
153128
enabled: true
154-
listeners:
155-
- hostname: hook-gitguardian.internal.com
156-
backend: hook.gitguardian.com
157-
tls:
158-
termination: edge
159129
```
160130

161-
With these configurations, your ggbridge client can securely forward traffic through the tunnel from the client side to approved GitGuardian services.
131+
With these configurations, your ggbridge client can securely forward traffic through the tunnel from the client side to approved GitGuardian services.

examples/2-way-tunneling/helm/values-https-gateway.yaml

Lines changed: 0 additions & 28 deletions
This file was deleted.

0 commit comments

Comments
 (0)