From 817c3c5047a8c223d6535ab1cc9cb7eab79ba79a Mon Sep 17 00:00:00 2001 From: craig Date: Fri, 8 Dec 2023 10:56:11 +0000 Subject: [PATCH 1/7] new secure protect and connect walkthrough --- doc/user-guides/secure-protect-connect.md | 372 ++++++++++++++++++++++ 1 file changed, 372 insertions(+) create mode 100644 doc/user-guides/secure-protect-connect.md diff --git a/doc/user-guides/secure-protect-connect.md b/doc/user-guides/secure-protect-connect.md new file mode 100644 index 000000000..fc4c897aa --- /dev/null +++ b/doc/user-guides/secure-protect-connect.md @@ -0,0 +1,372 @@ +# Kuadrant Quick Start + +## Pre-requisites + +- Completed the [single cluster quick start](https://docs.kuadrant.io/getting-started-single/) + +## Overview + +In this guide, we will cover the different policies from Kuadrant and how you can use them to secure, protect and connect an istio controlled gateway in a single cluster and how you can set more refined protection on the HTTPRoutes exposed by that gateway. + +Here are the steps we will go through: + +- [Deploy a sample application](#deploy-the-example-app-we-will-serve-via-our-gateway) +- [Define a new Gateway](#define-a-new-istio-managed-gateway) +- [Ensure TLS based secure connectivity to the gateway with `TLSPolicy`](#define-tlspolicy) +- [Define a default `RateLimitPolicy` to set some infrastructure limits on your gateway](#define-infrastructure-rate-limiting) +- [Define a default `AuthPolicy` to `Deny ALL` access to the gateway](#define-a-gateway-authpolicy) +- [Define `DNSPolicy` to bring traffic to the gateway](#define-dnspolicy) +- [Override the Gateway's Deny ALL `AuthPolicy`](#override-the-gateways-deny-all-authpolicy) +- [Override the Gateway `RateLimits`](#override-the-gateways-ratelimits) + + +To help with this walk through, you should set a `KUADRANT_ZONE_ROOT_DOMAIN` environmental variable to a domain you want to use. If it you want to try `DNSPolicy` this should also be a domain you have access to the DNS for in `route53 or GCP`. Example: +```export KUADRANT_ZONE_ROOT_DOMAIN=my.domain.iown``` + +### Deploy the example app we will serve via our gateway + +`kubectl apply -f https://raw.githubusercontent.com/Kuadrant/kuadrant-operator/main/examples/toystore/toystore.yaml` + +### Define a new Istio managed gateway + +``` +kubectl --context kind-kuadrant-local apply -f - < Date: Tue, 12 Dec 2023 11:22:15 +0000 Subject: [PATCH 2/7] Update doc/user-guides/secure-protect-connect.md Co-authored-by: Jason Madigan <4467+jasonmadigan@users.noreply.github.com> --- doc/user-guides/secure-protect-connect.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/user-guides/secure-protect-connect.md b/doc/user-guides/secure-protect-connect.md index fc4c897aa..1fcc5e98f 100644 --- a/doc/user-guides/secure-protect-connect.md +++ b/doc/user-guides/secure-protect-connect.md @@ -368,5 +368,5 @@ while :; do curl -k --write-out '%{http_code}\n' --silent --output /dev/null -H ```sh -while :; do curl -k --write-out '%{http_code}\n' --silent --output /dev/null -H 'Authorization: APIKEY IAMBOB' "https://api.$KUADRANT_ZONE_ROOT_DOMAIN/cars" | grep -E --color "\b(429)\b|$"; sleep 1; done +while :; do curl -k --resolve api.${KUADRANT_ZONE_ROOT_DOMAIN}:443:${INGRESS_HOST} --write-out '%{http_code}\n' --silent --output /dev/null -H 'Authorization: APIKEY IAMBOB' "https://api.$KUADRANT_ZONE_ROOT_DOMAIN/cars" | grep -E --color "\b(429)\b|$"; sleep 1; done ``` From 1059414ad81e7ecef976894b86201b087f3942a3 Mon Sep 17 00:00:00 2001 From: Craig Brookes Date: Tue, 12 Dec 2023 11:22:25 +0000 Subject: [PATCH 3/7] Update doc/user-guides/secure-protect-connect.md Co-authored-by: Jason Madigan <4467+jasonmadigan@users.noreply.github.com> --- doc/user-guides/secure-protect-connect.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/user-guides/secure-protect-connect.md b/doc/user-guides/secure-protect-connect.md index 1fcc5e98f..624c395c4 100644 --- a/doc/user-guides/secure-protect-connect.md +++ b/doc/user-guides/secure-protect-connect.md @@ -363,7 +363,7 @@ So here again just an example, we have given `bob` twice as many requests to use Lets test this new setup: ```sh -while :; do curl -k --write-out '%{http_code}\n' --silent --output /dev/null -H 'Authorization: APIKEY IAMALICE' "https://api.$KUADRANT_ZONE_ROOT_DOMAIN/cars" | grep -E --color "\b(429)\b|$"; sleep 1; done +while :; do curl -k --resolve api.${KUADRANT_ZONE_ROOT_DOMAIN}:443:${INGRESS_HOST} --write-out '%{http_code}\n' --silent --output /dev/null -H 'Authorization: APIKEY IAMALICE' "https://api.$KUADRANT_ZONE_ROOT_DOMAIN/cars" | grep -E --color "\b(429)\b|$"; sleep 1; done ``` From 1c749844b9de508488c3084657ed4792c7506ca2 Mon Sep 17 00:00:00 2001 From: Craig Brookes Date: Tue, 12 Dec 2023 11:22:37 +0000 Subject: [PATCH 4/7] Update doc/user-guides/secure-protect-connect.md Co-authored-by: Jason Madigan <4467+jasonmadigan@users.noreply.github.com> --- doc/user-guides/secure-protect-connect.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/user-guides/secure-protect-connect.md b/doc/user-guides/secure-protect-connect.md index 624c395c4..5f9ebc704 100644 --- a/doc/user-guides/secure-protect-connect.md +++ b/doc/user-guides/secure-protect-connect.md @@ -257,7 +257,7 @@ Lets test again. This time we expect a `403` still as the DENY_ALL is still in e ``` -curl -k "https://api.$KUADRANT_ZONE_ROOT_DOMAIN/cars" -i +curl -k --resolve api.${KUADRANT_ZONE_ROOT_DOMAIN}:443:${INGRESS_HOST} "https://api.$KUADRANT_ZONE_ROOT_DOMAIN/cars" -i ``` From d97e457183bba64de06fb50d367cbd7d109622c9 Mon Sep 17 00:00:00 2001 From: Craig Brookes Date: Tue, 12 Dec 2023 11:22:45 +0000 Subject: [PATCH 5/7] Update doc/user-guides/secure-protect-connect.md Co-authored-by: Jason Madigan <4467+jasonmadigan@users.noreply.github.com> --- doc/user-guides/secure-protect-connect.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/user-guides/secure-protect-connect.md b/doc/user-guides/secure-protect-connect.md index 5f9ebc704..23f23e9f3 100644 --- a/doc/user-guides/secure-protect-connect.md +++ b/doc/user-guides/secure-protect-connect.md @@ -218,7 +218,7 @@ EOF Lets test again. This time we expect a `403` ``` -curl -k --resolve api.${KUADRANT_ZONE_ROOT_DOMAIN}:443:172.18.200.1 "https://api.$KUADRANT_ZONE_ROOT_DOMAIN/cars" +curl -k --resolve api.${KUADRANT_ZONE_ROOT_DOMAIN}:443:${INGRESS_HOST} "https://api.$KUADRANT_ZONE_ROOT_DOMAIN/cars" ``` From 35f8e8f2e9e73e5b68fc5c8b1d31f7c38e5354c0 Mon Sep 17 00:00:00 2001 From: Craig Brookes Date: Tue, 12 Dec 2023 11:23:01 +0000 Subject: [PATCH 6/7] Update doc/user-guides/secure-protect-connect.md Co-authored-by: Jason Madigan <4467+jasonmadigan@users.noreply.github.com> --- doc/user-guides/secure-protect-connect.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/user-guides/secure-protect-connect.md b/doc/user-guides/secure-protect-connect.md index 23f23e9f3..c0f89efea 100644 --- a/doc/user-guides/secure-protect-connect.md +++ b/doc/user-guides/secure-protect-connect.md @@ -139,7 +139,7 @@ EOF With this HTTPRoute in place the service we deployed later is exposed via the gateway. We should be able to access our endpoint via HTTPS: ``` -curl -k --resolve api.${KUADRANT_ZONE_ROOT_DOMAIN}:443:172.18.200.1 "https://api.$KUADRANT_ZONE_ROOT_DOMAIN/cars" +curl -k --resolve api.${KUADRANT_ZONE_ROOT_DOMAIN}:443:${INGRESS_HOST} "https://api.$KUADRANT_ZONE_ROOT_DOMAIN/cars" ``` From 685a5efca5a6ebdfa6e66c8ea29e5f4aed16aae7 Mon Sep 17 00:00:00 2001 From: Craig Brookes Date: Tue, 12 Dec 2023 11:23:08 +0000 Subject: [PATCH 7/7] Update doc/user-guides/secure-protect-connect.md Co-authored-by: Jason Madigan <4467+jasonmadigan@users.noreply.github.com> --- doc/user-guides/secure-protect-connect.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/user-guides/secure-protect-connect.md b/doc/user-guides/secure-protect-connect.md index c0f89efea..bb9ec349d 100644 --- a/doc/user-guides/secure-protect-connect.md +++ b/doc/user-guides/secure-protect-connect.md @@ -175,7 +175,7 @@ kubectl wait ratelimitpolicy infra-ratelimit -n kuadrant-system --for=condition= The limit here is artificially low in order for us to show it working easily. Lets test it with our endpoint: ``` -for i in {1..10}; do curl -k --resolve api.${KUADRANT_ZONE_ROOT_DOMAIN}:443:172.18.200.1 "https://api.$KUADRANT_ZONE_ROOT_DOMAIN/cars" && sleep 1; done +for i in {1..10}; do curl -k --resolve api.${KUADRANT_ZONE_ROOT_DOMAIN}:443:${INGRESS_HOST} "https://api.$KUADRANT_ZONE_ROOT_DOMAIN/cars" && sleep 1; done ``` Here we should see `409s` start returning after the 5th request.