Ability to configure SAN/CN validation for client certificates is missing

Abierto
#470 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 2 días

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
4/5
Tiempo estimado
3-5 días
Aptitud para principiantes
38/100
Tipo de issue
Nueva funcionalidad
Claridad
Bastante claro
Estado de actividad
Estancado
Stack tecnológico
go

Línea de trabajo

Comienza en la sección vinculada de config/http_config.go, alrededor de las líneas 819-823, y lee la documentación de configuración HTTPS de Prometheus. Sigue cómo se configura la validación de certificados de cliente y determina después dónde deberían ubicarse una opción dns_name_regex y su comportamiento de coincidencia. Se considera terminado cuando las identidades de los certificados de cliente autorizados puedan restringirse mediante el patrón configurado, en lugar de aceptar cualquier certificado firmado por la CA.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

Issue

Let's say I have a Prometheus server running, secured with TLS with a custom CA (that of my whole cluster).

Using the documentation at https://prometheus.io/docs/prometheus/latest/configuration/https/ I can specify that the server validates client certificates. However once that is configured, it will accept any certificate signed by the CA.

That is an issue because the safety levels of all the services that have certificates are not the same: some are more likely to be compromised than others.
And of course, it wouldn't be legitimate for some-random-maybe-compromised-service.example.com (even if we know it is that service thanks to the CA!) to access and export the Prometheus metrics.

Solving it

=> In order to avoid this, it should be possible not only to validate that the client certificate is signed by the CA, but that whoever it turns out to be thanks to that authentication is indeed authorized to connect to Prometheus.

Currently, the configuration does not seem to allow configuring that.

However, that also seems reasonably easy to enable:
It's just about adding the proper parameters here:
https://github.com/prometheus/common/blob/2f04d2ec94b96df44aa4f8a60ae9fb29d8512636/config/http_config.go#L819-L823

(Note however that in the article it tries to validate based on some connection data, whereas we just want to validate based on e.g. a regexp).

Implementation notes

I think it would be good to validate that by providing a dns_name_regex in the TLS configuration parameters, as that is both simple and very flexible (users can specify sets of services, wildcards, prefix/suffix factoring..., all while keeping the prometheus side of things very simple). Kafka has done the same for their mTLS configuration, where you can specify which role you get depending on regex.

Lenguaje dominante
Go
Estrellas
297
Forks
380
Merge medio
3 d 15 h
PR fusionados (30 d)
13

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de prometheus/common

Todos los issues de prometheus/common

Issues similares

Más issues de Go

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.