TLS validation_context issues
Hey guys,
I'm trying to verify the client cert in envoy before proceeding further with the request, I have configured the validation_context however the I cannot start docker if I have validation_context present. Is validation_context supported at all ? I am referring to https://www.envoyproxy.io/docs/envoy/latest/intro/arch_overview/ssl.
My config looks like:
admin:
access_log_path: /tmp/admin_access.log
address:
socket_address: { address: 127.0.0.1, port_value: 5501 }
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
config:
stat_prefix: ingress_http
route_config:
name: local_route
virtual_hosts:
- name: local_service
domains: "*"
routes:
- match: { prefix: "/" }
route: { host_rewrite: www.google.com, cluster: service_google }
http_filters:
- name: envoy.router
tls_context:
common_tls_context:
tls_certificates:
- certificate_chain:
filename: /etc/localhost.crt
private_key:
filename: /etc/localhost.pem
validation_context:
trusted_ca:
filename: /etc/apig-cert.crt
clusters:
- name: service_google
connect_timeout: 0.25s
type: LOGICAL_DNS
# Comment out the following line to test on v6 networks
dns_lookup_family: V4_ONLY
lb_policy: ROUND_ROBIN
hosts: [{ socket_address: { address: google.com, port_value: 443 }}]
tls_context: { sni: www.google.com }
where localhost.crt is the server cert localhost.pem is the server key apig-cert.crt is the client cert
docker error message while starting is:
2018-06-29T14:35:00.372822300+10:00 container die 67871d37a8a4aa85d6bf298813d93f3ca67c3d803cdcd89084486a3efdf3c520 (exitCode=1, image=envoy:ssl, name=envoy_ssl)
2018-06-29T14:35:00.673024100+10:00 network disconnect 4fb12d47e4aac2a7f7e701cd5d7fe15dd76b716c520051683692a2d9a1b350ca (container=67871d37a8a4aa85d6bf298813d93f3ca67c3d803cdcd89084486a3efdf3c520, name=bridge, type=bridge)
@PiotrSikora @ggreenway
trusted_ca should point to a list of trusted CA certificates, not client certificate itself (that might somehow work, but I'm not sure about it). If you want to pin to a specific client certificate, then verify_certificate_spki or verify_certificate_hash might be more suitable.
Also, please provide Envoy error logs, since Docker error logs are pretty much useless for debugging this.
thanks @PiotrSikora
I tried verify_certificate_hash in an attempt to pin the client cert however I get
curl -vG -k --cert apig-cert.pem https://localhost:9080
* Rebuilt URL to: https://localhost:9080/
* Trying ::1...
* TCP_NODELAY set
* Connected to localhost (::1) port 9080 (#0)
* WARNING: SSL: Certificate type not set, assuming PKCS#12 format.
* SSL: Can't load the certificate "apig-cert.crt" and its private key: OSStatus -25299
* Closing connection 0
curl: (58) SSL: Can't load the certificate "apig-cert.crt" and its private key: OSStatus -25299
My config looks like
admin:
access_log_path: /tmp/admin_access.log
address:
socket_address: { address: 127.0.0.1, port_value: 5501 }
static_resources:
listeners:
- name: listener_0
address:
socket_address: { address: 0.0.0.0, port_value: 9080 }
filter_chains:
- filters:
- name: envoy.http_connection_manager
config:
stat_prefix: ingress_http
route_config:
name: local_route
virtual_hosts:
- name: local_service
domains: "*"
routes:
- match: { prefix: "/" }
route: { host_rewrite: www.google.com, cluster: service_google }
http_filters:
- name: envoy.router
tls_context:
common_tls_context:
tls_certificates:
- certificate_chain:
filename: "/etc/localhost.crt"
private_key:
filename: "/etc/localhost.key"
verify_certificate_hash: "hash_of_client_cert"
clusters:
- name: service_google
connect_timeout: 30s
type: LOGICAL_DNS
dns_lookup_family: V4_ONLY
lb_policy: ROUND_ROBIN
hosts: [{ socket_address: { address: google.com, port_value: 443 }}]
tls_context: { sni: www.google.com }
This issue has been automatically marked as stale because it has not had activity in the last 30 days. It will be closed in the next 7 days unless it is tagged "help wanted" or other activity occurs. Thank you for your contributions.
This issue has been automatically closed because it has not had activity in the last 37 days. If this issue is still valid, please ping a maintainer and ask them to label it as "help wanted". Thank you for your contributions.