Repository navigation
Closed
Closed
Copy link
Labels
Description
Hello,
i have Envoy Proxy PoC with Keycloak 12.4 and Okta. All works with Envoy 1.17-latest.
After upgrade to 1.18-latest (1.18.2) neither Okta nor Keycloak PoC work.
The error thrown is: "client credentials are invalid"
Client credentials are 100% valid and did not change after upgrade.
Downgrade to 1.17-latest immediately solves problem.
Example config for Okta:
admin:
access_log_path: /tmp/admin_access.log
address:
socket_address:
address: 0.0.0.0
port_value: 10444
static_resources:
listeners:
- name: listener_proxy
address:
socket_address:
address: 0.0.0.0
port_value: 10443
filter_chains:
- filters:
- name: envoy.filters.network.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: "/developer"
route:
prefix_rewrite: "/"
cluster: envoy-okta-back-developer
response_headers_to_add:
- header:
key: cache-control
value: "no-cache, no-store"
- match:
prefix: "/"
route:
cluster: envoy-okta-back-employee
response_headers_to_add:
- header:
key: cache-control
value: "no-cache, no-store"
http_filters:
- name: envoy.filters.http.oauth2
typed_config:
"@type": type.googleapis.com/envoy.extensions.filters.http.oauth2.v3alpha.OAuth2
config:
token_endpoint:
cluster: okta-cluster-https
uri: https://testpoc.okta.com/oauth2/clientxxx/v1/token
timeout: 5s
authorization_endpoint: https://testpoc.okta.com/oauth2/clientxxx/v1/authorize
redirect_uri: "https://%REQ(:authority)%/callback"
redirect_path_matcher:
path:
exact: /callback
signout_path:
path:
exact: /signout
forward_bearer_token: true
credentials:
client_id: "blablabla"
token_secret:
name: token
sds_config:
path: "/etc/envoy/token-secret.yaml"
hmac_secret:
name: hmac
sds_config:
path: "/etc/envoy/hmac.yaml"
- name: envoy.filters.http.router
transport_socket:
name: envoy.transport_sockets.tls
typed_config:
"@type": type.googleapis.com/envoy.extensions.transport_sockets.tls.v3.DownstreamTlsContext
common_tls_context:
tls_certificates:
- certificate_chain:
filename: /etc/envoy/certs/intranet_sitesitesite_com.crt
private_key:
filename: /etc/envoy/certs/intranet_sitesitesite_com.key
clusters:
- name: okta-cluster-https
connect_timeout: 2.25s
type: LOGICAL_DNS
dns_lookup_family: V4_ONLY
http2_protocol_options: {}
lb_policy: ROUND_ROBIN
load_assignment:
cluster_name: okta-cluster-https
endpoints:
- lb_endpoints:
- endpoint:
address:
socket_address:
address: testpoc.okta.com
port_value: 443
transport_socket:
name: envoy.transport_sockets.tls
typed_config:
"@type": type.googleapis.com/envoy.extensions.transport_sockets.tls.v3.UpstreamTlsContext
sni: testpoc.okta.com
common_tls_context:
validation_context:
match_subject_alt_names:
- exact: "*.okta.com"
trusted_ca:
filename: /etc/envoy/certs/ca-bundle.crt
- name: envoy-okta-back-employee
connect_timeout: 2.25s
type: LOGICAL_DNS
dns_lookup_family: V4_ONLY
lb_policy: ROUND_ROBIN
load_assignment:
cluster_name: envoy-okta-back-employee
endpoints:
- lb_endpoints:
- endpoint:
address:
socket_address:
address: envoy-okta-back-employee
port_value: 33233
- name: envoy-okta-back-developer
connect_timeout: 2.25s
type: LOGICAL_DNS
dns_lookup_family: V4_ONLY
lb_policy: ROUND_ROBIN
load_assignment:
cluster_name: envoy-okta-back-developer
endpoints:
- lb_endpoints:
- endpoint:
address:
socket_address:
address: envoy-okta-back-developer
port_value: 22222
Example config for Keycloak:
admin:
access_log_path: /tmp/admin_access.log
address:
socket_address:
address: 0.0.0.0
port_value: 10001
static_resources:
listeners:
- name: listener_proxy
address:
socket_address:
address: 0.0.0.0
port_value: 10000
filter_chains:
- filters:
- name: envoy.filters.network.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: "/developer"
route:
prefix_rewrite: "/"
cluster: envoy-keycloak-back-developer
response_headers_to_add:
- header:
key: cache-control
value: "no-cache, no-store"
- match:
prefix: "/"
route:
cluster: envoy-keycloak-back-employee
response_headers_to_add:
- header:
key: cache-control
value: "no-cache, no-store"
http_filters:
- name: envoy.filters.http.oauth2
typed_config:
"@type": type.googleapis.com/envoy.extensions.filters.http.oauth2.v3alpha.OAuth2
config:
token_endpoint:
cluster: keycloak
uri: http://keycloak.sitesitesite.com:8080/auth/realms/api/protocol/openid-connect/token
timeout: 5s
authorization_endpoint: http://keycloak.sitesitesite.com:8080/auth/realms/api/protocol/openid-connect/auth
redirect_uri: "https://%REQ(:authority)%/callback"
redirect_path_matcher:
path:
exact: /callback
signout_path:
path:
exact: /signout
forward_bearer_token: true
credentials:
client_id: "api"
token_secret:
name: token
sds_config:
path: "/etc/envoy/token-secret.yaml"
hmac_secret:
name: hmac
sds_config:
path: "/etc/envoy/hmac.yaml"
- name: envoy.filters.http.router
transport_socket:
name: envoy.transport_sockets.tls
typed_config:
"@type": type.googleapis.com/envoy.extensions.transport_sockets.tls.v3.DownstreamTlsContext
common_tls_context:
tls_certificates:
- certificate_chain:
filename: /etc/envoy/certs/example-com.crt
private_key:
filename: /etc/envoy/certs/example-com.key
clusters:
- name: keycloak
connect_timeout: 1.25s
type: LOGICAL_DNS
dns_lookup_family: V4_ONLY
lb_policy: ROUND_ROBIN
load_assignment:
cluster_name: keycloak
endpoints:
- lb_endpoints:
- endpoint:
address:
socket_address:
address: keycloak
port_value: 8080
- name: envoy-keycloak-back-employee
connect_timeout: 1.25s
type: LOGICAL_DNS
dns_lookup_family: V4_ONLY
lb_policy: ROUND_ROBIN
load_assignment:
cluster_name: envoy-keycloak-back-employee
endpoints:
- lb_endpoints:
- endpoint:
address:
socket_address:
address: envoy-keycloak-back-employee
port_value: 11111
- name: envoy-keycloak-back-developer
connect_timeout: 1.25s
type: LOGICAL_DNS
dns_lookup_family: V4_ONLY
lb_policy: ROUND_ROBIN
load_assignment:
cluster_name: envoy-keycloak-back-developer
endpoints:
- lb_endpoints:
- endpoint:
address:
socket_address:
address: envoy-keycloak-back-developer
port_value: 11121
Envoy proxy log in case of Okta:
[2021-04-22 17:33:07.686][14][debug][http] [source/common/http/filter_manager.cc:779] [C15][S17665552354465055548] request end stream
[2021-04-22 17:33:07.686][14][debug][upstream] [source/extensions/filters/http/oauth2/oauth_client.cc:43] Dispatching OAuth request for access token.
[2021-04-22 17:33:07.686][14][debug][router] [source/common/router/router.cc:445] [C0][S17369098839487975571] cluster 'okta-cluster-https' match for URL '/oauth2/clientxxx/v1/token'
[2021-04-22 17:33:07.687][14][debug][router] [source/common/router/router.cc:631] [C0][S17369098839487975571] router decoding headers:
':path', '/oauth2/clientxxx/v1/token'
':authority', 'testpoc.okta.com'
':method', 'POST'
':scheme', 'http'
'content-type', 'application/x-www-form-urlencoded'
'accept', 'application/json'
'x-envoy-internal', 'true'
'x-forwarded-for', '172.19.0.6'
'x-envoy-expected-rq-timeout-ms', '5000'
[2021-04-22 17:33:07.687][14][debug][pool] [source/common/http/conn_pool_base.cc:74] queueing stream due to no available connections
[2021-04-22 17:33:07.687][14][debug][pool] [source/common/conn_pool/conn_pool_base.cc:241] trying to create new connection
[2021-04-22 17:33:07.687][14][debug][pool] [source/common/conn_pool/conn_pool_base.cc:143] creating a new connection
[2021-04-22 17:33:07.687][14][debug][client] [source/common/http/codec_client.cc:43] [C27] connecting
[2021-04-22 17:33:07.687][14][debug][connection] [source/common/network/connection_impl.cc:860] [C27] connecting to 44.234.52.11:443
[2021-04-22 17:33:07.687][14][debug][connection] [source/common/network/connection_impl.cc:876] [C27] connection in progress
[2021-04-22 17:33:07.687][14][debug][http2] [source/common/http/http2/codec_impl.cc:1222] [C27] updating connection-level initial window size to 268435456
[2021-04-22 17:33:07.689][14][debug][connection] [source/common/network/connection_impl.cc:665] [C27] connected
[2021-04-22 17:33:07.693][14][debug][client] [source/common/http/codec_client.cc:82] [C27] connected
[2021-04-22 17:33:07.693][14][debug][pool] [source/common/conn_pool/conn_pool_base.cc:275] [C27] attaching to next stream
[2021-04-22 17:33:07.693][14][debug][pool] [source/common/conn_pool/conn_pool_base.cc:171] [C27] creating stream
[2021-04-22 17:33:07.693][14][debug][router] [source/common/router/upstream_request.cc:371] [C0][S17369098839487975571] pool ready
[2021-04-22 17:33:07.725][14][debug][router] [source/common/router/router.cc:1244] [C0][S17369098839487975571] upstream headers complete: end_stream=false
[2021-04-22 17:33:07.726][14][debug][http] [source/common/http/async_client_impl.cc:104] async http request response headers (end_stream=false):
':status', '401'
'date', 'Thu, 22 Apr 2021 17:33:07 GMT'
'content-type', 'application/json'
'server', 'nginx'
'public-key-pins-report-only', 'pin-sha256="r5EfzZxQVvQpKo3AgYRaT7X2bDO/kj3ACwmxfdT2zt8="; pin-sha256="MaqlcUgk2mvY/RFSGeSwBRkI+rZ6/dxe/DuQfBT/vnQ="; pin-sha256="72G5IEvDEWn+EThf3qjR7/bQSWaS2ZSLqolhnO6iyJI="; pin-sha256="rrV6CLCCvqnk89gWibYT0JO6fNQ8cCit7GGoiVTjCOg="; max-age=60; report-uri="https://okta.report-uri.com/r/default/hpkp/reportOnly"'
'x-okta-request-id', 'YIGzU@Y06dIV-mUFsj0MXAAABlc'
'x-xss-protection', '0'
'p3p', 'CP="HONK"'
'x-rate-limit-limit', '300'
'x-rate-limit-remaining', '298'
'x-rate-limit-reset', '1619112847'
'cache-control', 'no-cache, no-store'
'pragma', 'no-cache'
'expires', '0'
'content-security-policy', 'default-src 'self' *.oktacdn.com testpoc.okta.com; connect-src 'self' *.oktacdn.com *.mixpanel.com *.mapbox.com app.pendo.io data.pendo.io pendo-static-5634101834153984.storage.googleapis.com testpoc.okta.com testpoc-admin.okta.com testpoc.kerberos.okta.com https://oinmanager.okta.com data:; script-src 'unsafe-inline' 'unsafe-eval' 'self' *.oktacdn.com; style-src 'unsafe-inline' 'self' *.oktacdn.com app.pendo.io cdn.pendo.io pendo-static-5634101834153984.storage.googleapis.com; frame-src 'self' login.okta.com testpoc.okta.com testpoc-admin.okta.com; img-src 'self' *.oktacdn.com testpoc.okta.com *.tiles.mapbox.com *.mapbox.com app.pendo.io data.pendo.io cdn.pendo.io pendo-static-5634101834153984.storage.googleapis.com data: blob:; font-src data: 'self' *.oktacdn.com fonts.gstatic.com'
'expect-ct', 'report-uri="https://oktaexpectct.report-uri.com/r/t/ct/reportOnly", max-age=0'
'x-content-type-options', 'nosniff'
'strict-transport-security', 'max-age=315360000; includeSubDomains'
'set-cookie', 'sid=""; Expires=Thu, 01-Jan-1970 00:00:10 GMT; Path=/'
'set-cookie', 'JSESSIONID=CE85E4B0F797FCCFA07A485DBF63A0E4; Path=/; Secure; HttpOnly'
'x-envoy-upstream-service-time', '38'
[2021-04-22 17:33:07.726][14][debug][client] [source/common/http/codec_client.cc:124] [C27] response complete
[2021-04-22 17:33:07.726][14][debug][pool] [source/common/conn_pool/conn_pool_base.cc:200] [C27] destroying stream: 0 remaining
[2021-04-22 17:33:07.726][14][debug][upstream] [source/extensions/filters/http/oauth2/oauth_client.cc:72] Oauth response code: 401
[2021-04-22 17:33:07.726][14][debug][upstream] [source/extensions/filters/http/oauth2/oauth_client.cc:73] Oauth response body: {"error":"invalid_client","error_description":"Client authentication failed. Either the client or the client credentials are invalid."}
[2021-04-22 17:33:07.726][14][debug][http] [source/common/http/filter_manager.cc:883] [C15][S17665552354465055548] Sending local reply with details
[2021-04-22 17:33:07.726][14][debug][http] [source/common/http/conn_manager_impl.cc:1455] [C15][S17665552354465055548] encoding headers via codec (end_stream=false):
':status', '401'
'cache-control', 'no-cache, no-store'
'content-length', '18'
'content-type', 'text/plain'
'date', 'Thu, 22 Apr 2021 17:33:07 GMT'
'server', 'envoy'
[2021-04-22 17:33:07.726][14][debug][http2] [source/common/http/http2/codec_impl.cc:997] [C27] stream closed: 0
Search for error message:
"Client authentication failed. Either the client or the client credentials are invalid."
Envoy proxy log in case of Keycloak:
envoy-keycloak-front | [2021-04-22 17:26:03.574][24][debug][upstream] [source/extensions/filters/http/oauth2/oauth_client.cc:43] Dispatching OAuth request for access token.
envoy-keycloak-front | [2021-04-22 17:26:03.574][24][debug][router] [source/common/router/router.cc:445] [C0][S3744323587196550320] cluster 'keycloak' match for URL '/auth/realms/api/protocol/openid-connect/token'
envoy-keycloak-front | [2021-04-22 17:26:03.574][24][debug][router] [source/common/router/router.cc:631] [C0][S3744323587196550320] router decoding headers:
envoy-keycloak-front | ':path', '/auth/realms/api/protocol/openid-connect/token'
envoy-keycloak-front | ':authority', 'keycloak.sitesitesite.com:8080'
envoy-keycloak-front | ':method', 'POST'
envoy-keycloak-front | ':scheme', 'http'
envoy-keycloak-front | 'content-type', 'application/x-www-form-urlencoded'
envoy-keycloak-front | 'accept', 'application/json'
envoy-keycloak-front | 'x-envoy-internal', 'true'
envoy-keycloak-front | 'x-forwarded-for', '172.18.0.6'
envoy-keycloak-front | 'x-envoy-expected-rq-timeout-ms', '5000'
envoy-keycloak-front |
envoy-keycloak-front | [2021-04-22 17:26:03.574][24][debug][pool] [source/common/http/conn_pool_base.cc:74] queueing stream due to no available connections
envoy-keycloak-front | [2021-04-22 17:26:03.574][24][debug][pool] [source/common/conn_pool/conn_pool_base.cc:241] trying to create new connection
envoy-keycloak-front | [2021-04-22 17:26:03.574][24][debug][pool] [source/common/conn_pool/conn_pool_base.cc:143] creating a new connection
envoy-keycloak-front | [2021-04-22 17:26:03.574][24][debug][client] [source/common/http/codec_client.cc:43] [C4] connecting
envoy-keycloak-front | [2021-04-22 17:26:03.574][24][debug][connection] [source/common/network/connection_impl.cc:860] [C4] connecting to 172.18.0.3:8080
envoy-keycloak-front | [2021-04-22 17:26:03.574][24][debug][connection] [source/common/network/connection_impl.cc:876] [C4] connection in progress
envoy-keycloak-front | [2021-04-22 17:26:03.574][24][debug][connection] [source/common/network/connection_impl.cc:665] [C4] connected
envoy-keycloak-front | [2021-04-22 17:26:03.574][24][debug][client] [source/common/http/codec_client.cc:82] [C4] connected
envoy-keycloak-front | [2021-04-22 17:26:03.575][24][debug][pool] [source/common/conn_pool/conn_pool_base.cc:275] [C4] attaching to next stream
envoy-keycloak-front | [2021-04-22 17:26:03.575][24][debug][pool] [source/common/conn_pool/conn_pool_base.cc:171] [C4] creating stream
envoy-keycloak-front | [2021-04-22 17:26:03.575][24][debug][router] [source/common/router/upstream_request.cc:371] [C0][S3744323587196550320] pool ready
envoy-keycloak-front | [2021-04-22 17:26:03.617][24][debug][router] [source/common/router/router.cc:1244] [C0][S3744323587196550320] upstream headers complete: end_stream=false
envoy-keycloak-front | [2021-04-22 17:26:03.617][24][debug][http] [source/common/http/async_client_impl.cc:104] async http request response headers (end_stream=false):
envoy-keycloak-front | ':status', '401'
envoy-keycloak-front | 'cache-control', 'no-store'
envoy-keycloak-front | 'x-xss-protection', '1; mode=block'
envoy-keycloak-front | 'pragma', 'no-cache'
envoy-keycloak-front | 'x-frame-options', 'SAMEORIGIN'
envoy-keycloak-front | 'referrer-policy', 'no-referrer'
envoy-keycloak-front | 'date', 'Thu, 22 Apr 2021 17:26:03 GMT'
envoy-keycloak-front | 'connection', 'keep-alive'
envoy-keycloak-front | 'strict-transport-security', 'max-age=31536000; includeSubDomains'
envoy-keycloak-front | 'x-content-type-options', 'nosniff'
envoy-keycloak-front | 'content-type', 'application/json'
envoy-keycloak-front | 'content-length', '75'
envoy-keycloak-front | 'x-envoy-upstream-service-time', '42'
envoy-keycloak-front |
envoy-keycloak-front | [2021-04-22 17:26:03.617][24][debug][client] [source/common/http/codec_client.cc:124] [C4] response complete
envoy-keycloak-front | [2021-04-22 17:26:03.617][24][debug][upstream] [source/extensions/filters/http/oauth2/oauth_client.cc:72] Oauth response code: 401
envoy-keycloak-front | [2021-04-22 17:26:03.617][24][debug][upstream] [source/extensions/filters/http/oauth2/oauth_client.cc:73] Oauth response body: {"error":"unauthorized_client","error_description":"Invalid client secret"}
envoy-keycloak-front | [2021-04-22 17:26:03.617][24][debug][http] [source/common/http/filter_manager.cc:883] [C3][S10340968160964716544] Sending local reply with details
envoy-keycloak-front | [2021-04-22 17:26:03.617][24][debug][http] [source/common/http/conn_manager_impl.cc:1455] [C3][S10340968160964716544] encoding headers via codec (end_stream=false):
envoy-keycloak-front | ':status', '401'
envoy-keycloak-front | 'cache-control', 'no-cache, no-store'
envoy-keycloak-front | 'content-length', '18'
envoy-keycloak-front | 'content-type', 'text/plain'
envoy-keycloak-front | 'date', 'Thu, 22 Apr 2021 17:26:03 GMT'
envoy-keycloak-front | 'server', 'envoy'
envoy-keycloak-front |
envoy-keycloak-front | [2021-04-22 17:26:03.617][24][debug][pool] [source/common/http/http1/conn_pool.cc:53] [C4] response complete
envoy-keycloak-front | [2021-04-22 17:26:03.617][24][debug][pool] [source/common/conn_pool/conn_pool_base.cc:200] [C4] destroying stream: 0 remaining
envoy-keycloak-front | [2021-04-22 17:26:05.946][1][debug][main] [source/server/server.cc:209] flushing stats
Search for error message:
"{"error":"unauthorized_client","error_description":"Invalid client secret"}"
In both cases client secret is defined in following way:
resources:
- "@type": "type.googleapis.com/envoy.extensions.transport_sockets.tls.v3.Secret"
name: token
generic_secret:
secret:
# Fill in the client secret your OAuth2 provider assigned to you.
inline_string: "zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz"
Any advice how to fix it?
Thank you!
Reacted by Alexcei
Activity
[-]envoy.filters.http.oauth2 stops working after upgrade from 1.17-latest to 1.18-latest (1.18.2) for both Okta and Keycloak[/-][+]envoy.filters.http.oauth2 stops working after upgrade from 1.17-latest to 1.18-latest (1.18.2)[/+][-]envoy.filters.http.oauth2 stops working after upgrade from 1.17-latest to 1.18-latest (1.18.2)[/-][+]envoy.filters.http.oauth2 stops working after upgrade from 1.17.2 to 1.18.2[/+]asraa commentedon Apr 23, 2021
@rgs1 @derekargueta has anything changed with oauth filter?
rgs1 commentedon Apr 23, 2021
Hmm not sure... cc: @williamsfu99
nonefaken commentedon Apr 23, 2021
Hi! FYI there must be some changes. I tried to implement "auth_scopes", which motivated to upgrade to 1.18.2 # Cf. #14168 which was introduced after 1.17.2. Not saying it caused it.
nonefaken commentedon Apr 30, 2021
survivors? cc: @williamsfu99 @rgs1 @derekargueta @asraa