ЛР 7: безопасность, mTLS и OpenBao на оценку 3

This commit is contained in:
2026-12-06 15:19:24 +03:00
parent 20afc2c790
commit 280c5a3300
101 changed files with 5950 additions and 63 deletions
+84
View File
@@ -0,0 +1,84 @@
pid /tmp/nginx.pid;
events { worker_connections 512; }
http {
access_log off;
server_tokens off;
client_body_temp_path /tmp/nginx-body;
proxy_temp_path /tmp/nginx-proxy;
fastcgi_temp_path /tmp/nginx-fastcgi;
uwsgi_temp_path /tmp/nginx-uwsgi;
scgi_temp_path /tmp/nginx-scgi;
client_max_body_size 16m;
server {
listen 8444 ssl;
ssl_certificate /run/identity/server.crt;
ssl_certificate_key /run/identity/server.key;
ssl_protocols TLSv1.2 TLSv1.3;
proxy_set_header Authorization "";
location ~ ^/ingest/v1/(logs|metrics|traces)$ {
auth_basic "otlp-ingest";
auth_basic_user_file /run/identity/ingest.htpasswd;
limit_except POST { deny all; }
rewrite ^/ingest(.*)$ $1 break;
proxy_pass http://127.0.0.1:14318;
}
location = /loki-write {
auth_basic "loki-write";
auth_basic_user_file /run/identity/collector.htpasswd;
limit_except POST { deny all; }
proxy_pass http://127.0.0.1:3100/otlp/v1/logs;
}
location = /tempo-write {
auth_basic "tempo-write";
auth_basic_user_file /run/identity/collector.htpasswd;
limit_except POST { deny all; }
proxy_pass http://127.0.0.1:14319/v1/traces;
}
location = /metrics {
auth_basic "prometheus-scrape";
auth_basic_user_file /run/identity/scrape.htpasswd;
limit_except GET { deny all; }
proxy_pass http://127.0.0.1:8889/metrics;
}
location = /collector-metrics {
auth_basic "prometheus-scrape";
auth_basic_user_file /run/identity/scrape.htpasswd;
limit_except GET { deny all; }
proxy_pass http://127.0.0.1:8888/metrics;
}
location /prometheus/api/v1/ {
auth_basic "grafana";
auth_basic_user_file /run/identity/grafana.htpasswd;
limit_except GET POST { deny all; }
proxy_pass http://127.0.0.1:9090/api/v1/;
}
location /loki/loki/api/v1/ {
auth_basic "grafana";
auth_basic_user_file /run/identity/grafana.htpasswd;
limit_except GET { deny all; }
proxy_pass http://127.0.0.1:3100/loki/api/v1/;
}
location /tempo/api/ {
auth_basic "grafana";
auth_basic_user_file /run/identity/grafana.htpasswd;
limit_except GET { deny all; }
proxy_pass http://127.0.0.1:3200/api/;
}
location / { return 404; }
}
server {
listen 3443 ssl;
ssl_certificate /run/identity/server.crt;
ssl_certificate_key /run/identity/server.key;
ssl_protocols TLSv1.2 TLSv1.3;
location / {
proxy_set_header Host $http_host;
proxy_set_header X-Forwarded-Proto https;
proxy_pass http://127.0.0.1:3000;
}
}
}