Skip to content

Instantly share code, notes, and snippets.

@salrashid123
Created May 24, 2022 20:42
Show Gist options
  • Save salrashid123/8aa50af0d13da1bccf29eaa5f6e1409b to your computer and use it in GitHub Desktop.
Save salrashid123/8aa50af0d13da1bccf29eaa5f6e1409b to your computer and use it in GitHub Desktop.
GCP Authentication filter server (https://blog.salrashid.dev/articles/2022/envoy_gcp_authn/ )
admin:
access_log_path: /dev/null
address:
socket_address:
address: 127.0.0.1
port_value: 9000
node:
cluster: service_greeter
id: test-id
static_resources:
listeners:
- name: listener_0
address:
socket_address: { address: 0.0.0.0, port_value: 10000 }
filter_chains:
- filters:
- name: envoy.http_connection_manager
typed_config:
"@type": type.googleapis.com/envoy.extensions.filters.network.http_connection_manager.v3.HttpConnectionManager
stat_prefix: ingress_http
codec_type: AUTO
route_config:
name: local_route
virtual_hosts:
- name: local_service
domains: ["*"]
routes:
- match:
prefix: "/get"
direct_response:
status: 200
body:
inline_string: "ok"
http_filters:
- name: envoy.filters.http.jwt_authn
typed_config:
"@type": type.googleapis.com/envoy.extensions.filters.http.jwt_authn.v3.JwtAuthentication
providers:
google-jwt:
issuer: https://accounts.google.com
audiences:
- server.c.$PROJECT_ID.internal
remote_jwks:
http_uri:
uri: https://www.googleapis.com/oauth2/v3/certs
cluster: jwt.www.googleapis.com|443
timeout:
seconds: 5
from_headers:
- name: Authorization
value_prefix: "Bearer "
rules:
- match:
prefix: "/"
requires:
provider_name: "google-jwt"
- name: envoy.filters.http.router
typed_config:
"@type": type.googleapis.com/envoy.extensions.filters.http.router.v3.Router
transport_socket:
name: envoy.transport_sockets.alts
typed_config:
"@type": type.googleapis.com/envoy.extensions.transport_sockets.alts.v3.Alts
handshaker_service: "169.254.169.254:8080"
peer_service_accounts:
- "$CLIENT_SERVICE_ACCOUNT"
clusters:
- name: jwt.www.googleapis.com|443
type: LOGICAL_DNS
dns_lookup_family: V4_ONLY
connect_timeout: 2s
lb_policy: ROUND_ROBIN
load_assignment:
cluster_name: service_httpbin
endpoints:
- lb_endpoints:
- endpoint:
address:
socket_address:
address: www.googleapis.com
port_value: 443
transport_socket:
name: envoy.transport_sockets.tls
typed_config:
"@type": type.googleapis.com/envoy.extensions.transport_sockets.tls.v3.UpstreamTlsContext
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment