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

TransportServer SNI #6605

Merged
merged 38 commits into from
Oct 22, 2024
Merged
Show file tree
Hide file tree
Changes from 27 commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
4c623b3
commit poc
j1m-ryan Sep 24, 2024
bd1a6ac
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Sep 24, 2024
9234db3
remove build errors
j1m-ryan Sep 24, 2024
6f6dd49
fix go tests
j1m-ryan Sep 25, 2024
88f24b6
fix example readme linting
j1m-ryan Sep 25, 2024
9af72cf
fix tests
j1m-ryan Sep 25, 2024
4c3c49c
remove unnessary changes
j1m-ryan Sep 25, 2024
c812f7d
update snaps
j1m-ryan Sep 25, 2024
4c746b6
tls passthrough example lint
j1m-ryan Sep 25, 2024
6a0644b
fix tests
j1m-ryan Sep 25, 2024
7e8c45c
fix test
j1m-ryan Sep 25, 2024
9db8c56
add new snapshot test, fix makeServerName function
j1m-ryan Sep 26, 2024
a751f78
add test for makeServerName function
j1m-ryan Sep 26, 2024
3d35774
add go tests
j1m-ryan Sep 26, 2024
624e693
Merge branch 'main' into poc/transport-server-sni
j1m-ryan Sep 26, 2024
2748b2f
change c.listeners to c.listenerHosts
j1m-ryan Oct 7, 2024
2fb8fdf
Merge branch 'main' into poc/transport-server-sni
j1m-ryan Oct 7, 2024
5f4ebc0
fix non tls passthrough hosts being added to tls passthrough template
j1m-ryan Oct 7, 2024
af2c0ed
Merge branch 'main' into feat/transport-server-sni
j1m-ryan Oct 7, 2024
87a671f
more go tests
j1m-ryan Oct 10, 2024
ae9e4a9
Merge branch 'main' into feat/transport-server-sni
j1m-ryan Oct 11, 2024
70debbe
add python tests
j1m-ryan Oct 11, 2024
12e5529
Merge branch 'main' into feat/transport-server-sni
j1m-ryan Oct 11, 2024
1b7621e
add listenerhost tests
j1m-ryan Oct 11, 2024
c85c9a8
add docs
j1m-ryan Oct 11, 2024
66bedf5
fix validateTSHost logic
j1m-ryan Oct 11, 2024
7be8dc2
remove unused function
j1m-ryan Oct 11, 2024
17b8e2f
Apply suggestions from code review
j1m-ryan Oct 11, 2024
20d71c3
test undo enumeration
j1m-ryan Oct 11, 2024
775a9b4
change numbers to headings
j1m-ryan Oct 11, 2024
cc4e1fb
Merge branch 'main' into feat/transport-server-sni
j1m-ryan Oct 14, 2024
e66a52c
make changes from code review
j1m-ryan Oct 14, 2024
615d06e
Merge branch 'main' into feat/transport-server-sni
j1m-ryan Oct 14, 2024
53bc93e
Merge branch 'main' into feat/transport-server-sni
j1m-ryan Oct 15, 2024
35c1cde
Merge branch 'main' into feat/transport-server-sni
j1m-ryan Oct 17, 2024
88ce4bf
Merge branch 'main' into feat/transport-server-sni
j1m-ryan Oct 21, 2024
c0bde77
bash to shell
j1m-ryan Oct 21, 2024
47959ef
Merge branch 'main' into feat/transport-server-sni
j1m-ryan Oct 22, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions examples/custom-resources/tls-passthrough/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,9 @@ You can see how the Secure App is implemented in the `secure-app.yaml` file.

1. Save the HTTPS port of the Ingress Controller where TLS Passthrough is enabled into a shell variable:

```console
$ IC_HTTPS_PORT=<port number>
```console
IC_HTTPS_PORT=<port number>
```

1. Save the HTTPS port of the Ingress Controller into a shell variable:

Expand Down
96 changes: 96 additions & 0 deletions examples/custom-resources/transport-server-sni/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
# TransportServer SNI

In this example we create two different TransportServers that listen on the same interface, which are distinguished by their Host field.

1. Create a GlobalConfiguration resource with the following listener.

```yaml
listeners:
- name: tcp-listener
port: 7000
protocol: TCP
```

1. Add a custom port to the NIC pod via the helm chart
j1m-ryan marked this conversation as resolved.
Show resolved Hide resolved

```yaml
controller.customPorts:
- name: port
containerPort: 7000
protocol: TCP
```

1. Add a custom port to the NIC service
j1m-ryan marked this conversation as resolved.
Show resolved Hide resolved

```yaml
controller.service.customPorts:
- name: tcp-port
port: 7000
protocol: TCP
targetPort: 7000
```

1. Create the cafe-secret, and mongo-secret. These secrets are used for TLS in the TransportServers
j1m-ryan marked this conversation as resolved.
Show resolved Hide resolved
`kubectl apply -f cafe-secret.yaml`
`kubectl apply -f mongo-secret.yaml`

1. Create the mongo and tcp echo example applications
j1m-ryan marked this conversation as resolved.
Show resolved Hide resolved
`kubectl apply -f mongo.yaml`
`kubectl apply -f tcp-echo-server.yaml`

1. Wait until these are ready.
j1m-ryan marked this conversation as resolved.
Show resolved Hide resolved
`kubectl get deploy -w`

1. Create the TransportServers for each application
j1m-ryan marked this conversation as resolved.
Show resolved Hide resolved
`kubectl apply -f cafe-transport-server.yaml`
`kubectl apply -f mongo-transport-server.yaml`

1. Ensure they are in valid state
j1m-ryan marked this conversation as resolved.
Show resolved Hide resolved
`kubectl get ts`

```bash
NAME STATE REASON AGE
cafe-ts Valid AddedOrUpdated 2m
mongo-ts Valid AddedOrUpdated 2m
```

1. Set up /etc/hosts or DNS
j1m-ryan marked this conversation as resolved.
Show resolved Hide resolved
In this example I am running NIC locally, so I will set
cafe.example.com and mongo.example.com in my /etc/hosts to localhost
If running NIC as a live service, the server names would be set at the DNS layer
j1m-ryan marked this conversation as resolved.
Show resolved Hide resolved
`cat /etc/hosts`

```bash
...
127.0.0.1 cafe.example.com
127.0.0.1 mongo.example.com
```

1. Expose port 7000 of the NIC Loadbalancer Service
j1m-ryan marked this conversation as resolved.
Show resolved Hide resolved
`k port-forward svc/my-release-nginx-ingress-controller 7000:7000`

1. Use ncat to ping cafe.example.com on port 7000 with ssl
j1m-ryan marked this conversation as resolved.
Show resolved Hide resolved
`ncat --ssl cafe.example.com 7000`
pdabelf5 marked this conversation as resolved.
Show resolved Hide resolved
When you write a message you should get sent back
j1m-ryan marked this conversation as resolved.
Show resolved Hide resolved

```bash
hi
hi
```

And once the connection is closed (ctrl + c) you should see the request and response in the NIC logs are both 2 bytes
j1m-ryan marked this conversation as resolved.
Show resolved Hide resolved

```bash
127.0.0.1 [24/Sep/2024:15:48:58 +0000] TCP 200 3 3 2.702 "-
```

1. Use mongosh to connect to the mongodb container, via the TransportServer, also on port 7000
j1m-ryan marked this conversation as resolved.
Show resolved Hide resolved
`mongosh --host mongo.example.com --port 7000 --tls --tlsAllowInvalidCertificates`
pdabelf5 marked this conversation as resolved.
Show resolved Hide resolved

```bash
test> show dbs
admin 40.00 KiB
config 60.00 KiB
local 40.00 KiB
test>
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
apiVersion: v1
data:
tls.crt: LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSUY1ekNDQTgrZ0F3SUJBZ0lVR2dXT0JNTkR2TXNWOGY3OWc0MlpSZy9KaWc0d0RRWUpLb1pJaHZjTkFRRUwKQlFBd2dZSXhDekFKQmdOVkJBWVRBbGhZTVJJd0VBWURWUVFJREFsVGRHRjBaVTVoYldVeEVUQVBCZ05WQkFjTQpDRU5wZEhsT1lXMWxNUlF3RWdZRFZRUUtEQXREYjIxd1lXNTVUbUZ0WlRFYk1Ca0dBMVVFQ3d3U1EyOXRjR0Z1CmVWTmxZM1JwYjI1T1lXMWxNUmt3RndZRFZRUUREQkJqWVdabExtVjRZVzF3YkdVdVkyOXRNQjRYRFRJME1Ea3kKTXpFd01EUXdNVm9YRFRNME1Ea3lNVEV3TURRd01Wb3dnWUl4Q3pBSkJnTlZCQVlUQWxoWU1SSXdFQVlEVlFRSQpEQWxUZEdGMFpVNWhiV1V4RVRBUEJnTlZCQWNNQ0VOcGRIbE9ZVzFsTVJRd0VnWURWUVFLREF0RGIyMXdZVzU1ClRtRnRaVEViTUJrR0ExVUVDd3dTUTI5dGNHRnVlVk5sWTNScGIyNU9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BiQm4vNmJDTFY3S0I3ZmY0Uk04b3c3K1l4aHFFTFhxcnVQS2paMnRRSWs2M2hzZklMd0tiRWIrCkhEM2VLZEhNc2hhbXFXZzI0NnlORW5nQUZCQzhoVU5kQ0pmeUthUlhkSlV5eDhqcWlKM3ErdnpnNFBieUhqeW0KZEQzM2pVT2UwdHdoSWJxKytUaXZCa1ptSDBsSStnVT0KLS0tLS1FTkQgUFJJVkFURSBLRVktLS0tLQo=
kind: Secret
metadata:
creationTimestamp: null
name: cafe-secret
type: kubernetes.io/tls
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
apiVersion: k8s.nginx.org/v1
kind: TransportServer
metadata:
name: cafe-ts
spec:
host: cafe.example.com
listener:
name: tcp-listener
protocol: TCP
tls:
secret: cafe-secret
upstreams:
- name: tcp-echo
service: tcp-echo-service
port: 7000
action:
pass: tcp-echo
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
apiVersion: v1
data:
tls.crt: LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSUY2VENDQTlHZ0F3SUJBZ0lVTGRHUktVc3FrZktiV1JheWwvaTdrSkVvWnRjd0RRWUpLb1pJaHZjTkFRRUwKQlFBd2dZTXhDekFKQmdOVkJBWVRBbGhZTVJJd0VBWURWUVFJREFsVGRHRjBaVTVoYldVeEVUQVBCZ05WQkFjTQpDRU5wZEhsT1lXMWxNUlF3RWdZRFZRUUtEQXREYjIxd1lXNTVUbUZ0WlRFYk1Ca0dBMVVFQ3d3U1EyOXRjR0Z1CmVWTmxZM1JwYjI1T1lXMWxNUm93R0FZRFZRUUREQkZ0YjI1bmJ5NWxlR0Z0Y0d4bExtTnZiVEFlRncweU5EQTUKTWpNeE1EQTFNVGxhRncwek5EQTVNakV4TURBMU1UbGFNSUdETVFzd0NRWURWUVFHRXdKWVdERVNNQkFHQTFVRQpDQXdKVTNSaGRHVk9ZVzFsTVJFd0R3WURWUVFIREFoRGFYUjVUbUZ0WlRFVU1CSUdB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4bVNiT3M4NDlGLzg4UEg0Y3VrYVRWNmZPUnFOaW54RXhuZQpqbnk3ajUxT01aWTQ4TVIvaGJhOVk3QWM3TE1Ec0pQdFZ5cStBemU4ODRreU5ZV2dtZHJHanBaVnhLeDQzMjFJCmhXM1NUam9SZEZBMFVCdENyT2ZUalF0cThPQzZqL1QrYWdwa0g2VjFQVkw3Y29PbjREU2RIb1RqdnJFZ0QrYTgKVzY1ODFvdHdha2tMK0FGalU0MkVHaTkxWnJLSUx3PT0KLS0tLS1FTkQgUFJJVkFURSBLRVktLS0tLQo=
kind: Secret
metadata:
creationTimestamp: null
name: mongo-secret
type: kubernetes.io/tls
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
apiVersion: k8s.nginx.org/v1
kind: TransportServer
metadata:
name: mongo-ts
spec:
host: mongo.example.com
tls:
secret: mongo-secret
listener:
name: tcp-listener
protocol: TCP
upstreams:
- name: mongo
service: mongodb
port: 27017
action:
pass: mongo
38 changes: 38 additions & 0 deletions examples/custom-resources/transport-server-sni/mongo.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
---
apiVersion: v1
kind: Service
metadata:
name: mongodb
spec:
selector:
app: mongodb
ports:
- protocol: TCP
port: 27017
targetPort: 27017
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: mongodb
spec:
replicas: 1
selector:
matchLabels:
app: mongodb
template:
metadata:
labels:
app: mongodb
spec:
containers:
- name: mongodb
image: mongo:latest
ports:
- containerPort: 27017
volumeMounts:
- name: storage
mountPath: /data/db
volumes:
- name: storage
emptyDir: {}
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: tcp-echo-server
spec:
replicas: 1
selector:
matchLabels:
app: tcp-echo-server
template:
metadata:
labels:
app: tcp-echo-server
spec:
containers:
- name: tcp-echo-server
image: alpine
command: ["/bin/sh"]
args:
- -c
- |
apk add --no-cache socat
echo "TCP Echo Server starting..."
socat -v tcp-listen:7000,fork,reuseaddr,keepalive exec:'/bin/cat'
pdabelf5 marked this conversation as resolved.
Show resolved Hide resolved
ports:
- containerPort: 7000
---
apiVersion: v1
kind: Service
metadata:
name: tcp-echo-service
spec:
selector:
app: tcp-echo-server
ports:
- protocol: TCP
port: 7000
targetPort: 7000
type: ClusterIP
Loading
Loading