-
Notifications
You must be signed in to change notification settings - Fork 358
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat:support configuring xff trusted cidrs
Signed-off-by: Rudrakh Panigrahi <[email protected]>
- Loading branch information
Showing
9 changed files
with
317 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
87 changes: 87 additions & 0 deletions
87
test/e2e/testdata/authorization-client-ip-trusted-cidrs.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
apiVersion: gateway.networking.k8s.io/v1 | ||
kind: HTTPRoute | ||
metadata: | ||
name: http-with-authorization-client-ip-trusted-cidr-1 | ||
namespace: gateway-conformance-infra | ||
spec: | ||
parentRefs: | ||
- name: same-namespace | ||
rules: | ||
- matches: | ||
- path: | ||
type: Exact | ||
value: /protected3 | ||
backendRefs: | ||
- name: infra-backend-v1 | ||
port: 8080 | ||
--- | ||
apiVersion: gateway.networking.k8s.io/v1 | ||
kind: HTTPRoute | ||
metadata: | ||
name: http-with-authorization-client-ip-trusted-cidr-2 | ||
namespace: gateway-conformance-infra | ||
spec: | ||
parentRefs: | ||
- name: same-namespace | ||
rules: | ||
- matches: | ||
- path: | ||
type: Exact | ||
value: /protected4 | ||
backendRefs: | ||
- name: infra-backend-v1 | ||
port: 8080 | ||
--- | ||
apiVersion: gateway.envoyproxy.io/v1alpha1 | ||
kind: SecurityPolicy | ||
metadata: | ||
name: authorization-client-ip-trusted-cidr-1 | ||
namespace: gateway-conformance-infra | ||
spec: | ||
targetRefs: | ||
- group: gateway.networking.k8s.io | ||
kind: HTTPRoute | ||
name: http-with-authorization-client-ip-trusted-cidr-1 | ||
authorization: | ||
defaultAction: Allow | ||
rules: | ||
- name: "deny-location-1" # First matching rule is applied, so 192.168.1.0/24 will be denied | ||
action: Deny | ||
principal: | ||
clientCIDRs: | ||
- 192.168.1.0/24 | ||
--- | ||
apiVersion: gateway.envoyproxy.io/v1alpha1 | ||
kind: SecurityPolicy | ||
metadata: | ||
name: authorization-client-ip-trusted-cidr-2 | ||
namespace: gateway-conformance-infra | ||
spec: | ||
targetRefs: | ||
- group: gateway.networking.k8s.io | ||
kind: HTTPRoute | ||
name: http-with-authorization-client-ip-trusted-cidr-2 | ||
authorization: | ||
defaultAction: Deny | ||
rules: | ||
- action: Allow | ||
principal: | ||
clientCIDRs: | ||
- 10.0.2.0/24 | ||
--- | ||
# This is a client traffic policy that enables client IP detection using the XFF header. | ||
# So, the client IP can be detected from the XFF header and used for authorization. | ||
#apiVersion: gateway.envoyproxy.io/v1alpha1 | ||
Check warning on line 74 in test/e2e/testdata/authorization-client-ip-trusted-cidrs.yaml GitHub Actions / lint
|
||
#kind: ClientTrafficPolicy | ||
Check warning on line 75 in test/e2e/testdata/authorization-client-ip-trusted-cidrs.yaml GitHub Actions / lint
|
||
#metadata: | ||
Check warning on line 76 in test/e2e/testdata/authorization-client-ip-trusted-cidrs.yaml GitHub Actions / lint
|
||
# name: enable-client-ip-detection-trusted-cidr | ||
# namespace: gateway-conformance-infra | ||
#spec: | ||
Check warning on line 79 in test/e2e/testdata/authorization-client-ip-trusted-cidrs.yaml GitHub Actions / lint
|
||
# clientIPDetection: | ||
# xForwardedFor: | ||
# trustedCidrs: | ||
# - "172.16.0.0/12" | ||
# targetRefs: | ||
# - group: gateway.networking.k8s.io | ||
# kind: Gateway | ||
# name: same-namespace |
Oops, something went wrong.