Files
mtusi2026lab7/infra/telemetry/opensearch-tls.conf
T

60 lines
1.6 KiB
Plaintext

worker_processes 1;
events { worker_connections 512; }
http {
access_log off;
ssl_protocols TLSv1.2 TLSv1.3;
client_max_body_size 16m;
map $ssl_client_s_dn $role {
default "";
"CN=lab7-telemetry-collector" collector;
"CN=lab7-telemetry-grafana" grafana;
}
upstream local_opensearch {
server 127.0.0.1:19200;
}
server {
listen 9200 ssl;
ssl_certificate /tls/server.crt;
ssl_certificate_key /tls/server.key;
ssl_client_certificate /tls/ca.crt;
ssl_verify_client on;
if ($role = "") { return 403; }
location = / {
limit_except GET { deny all; }
proxy_pass http://local_opensearch/;
}
location = /_bulk {
if ($role != collector) { return 403; }
limit_except POST { deny all; }
proxy_pass http://local_opensearch/_bulk;
}
location = /_msearch {
if ($role != grafana) { return 403; }
limit_except POST { deny all; }
proxy_pass http://local_opensearch/_msearch;
}
location ~ ^/messenger-logs([*]|[-a-z0-9_.]*)/(_search|_msearch|_field_caps)$ {
if ($role != grafana) { return 403; }
limit_except GET POST { deny all; }
proxy_pass http://local_opensearch$uri$is_args$args;
}
location ~ ^/messenger-logs([*]|[-a-z0-9_.]*)/_mapping$ {
if ($role != grafana) { return 403; }
limit_except GET { deny all; }
proxy_pass http://local_opensearch$uri$is_args$args;
}
location / { return 403; }
}
}