feat(metrics): lab7 secure Prometheus scraping and queries

This commit is contained in:
Голиков Maximillian Антон
2026-11-26 12:21:59 +03:00
parent 35f10c1ef9
commit b1035430dc
9 changed files with 104 additions and 4 deletions
+21
View File
@@ -0,0 +1,21 @@
worker_processes 1;
events { worker_connections 512; }
http {
access_log off;
ssl_protocols TLSv1.2 TLSv1.3;
client_max_body_size 16m;
resolver 127.0.0.11 valid=10s ipv6=off;
server {
listen 127.0.0.1:9090;
location / {
set $target "prometheus:9090";
proxy_ssl_verify on;
proxy_ssl_server_name on;
proxy_ssl_name prometheus;
proxy_ssl_trusted_certificate /tls/ca.crt;
proxy_ssl_certificate /tls/client.crt;
proxy_ssl_certificate_key /tls/client.key;
proxy_pass https://$target;
}
}
}
+14 -1
View File
@@ -17,4 +17,17 @@ http {
}
location / { return 403; }
}
}
server {
listen 9464 ssl;
ssl_certificate /tls/server.crt;
ssl_certificate_key /tls/server.key;
ssl_client_certificate /tls/ca.crt;
ssl_verify_client on;
if ($ssl_client_s_dn !~ "^CN=lab7-telemetry-(prometheus)$") { return 403; }
location = /metrics {
limit_except GET { deny all; }
proxy_pass http://127.0.0.1:19464;
}
location / { return 403; }
}
}
+7
View File
@@ -0,0 +1,7 @@
tls_server_config:
cert_file: /tls/server.crt
key_file: /tls/server.key
client_ca_file: /tls/ca.crt
client_auth_type: RequireAndVerifyClientCert
client_allowed_sans:
- lab7-telemetry-grafana
+20
View File
@@ -0,0 +1,20 @@
worker_processes 1;
events { worker_connections 512; }
http {
access_log off;
ssl_protocols TLSv1.2 TLSv1.3;
client_max_body_size 16m;
server {
listen 15692 ssl;
ssl_certificate /tls/server.crt;
ssl_certificate_key /tls/server.key;
ssl_client_certificate /tls/ca.crt;
ssl_verify_client on;
if ($ssl_client_s_dn !~ "^CN=lab7-telemetry-(prometheus)$") { return 403; }
location = /metrics/detailed {
limit_except GET { deny all; }
proxy_pass http://127.0.0.1:15693;
}
location / { return 403; }
}
}