forked from mtusi2026/mtusi2026lab7
43 lines
3.2 KiB
Plaintext
43 lines
3.2 KiB
Plaintext
pid /tmp/nginx.pid;
|
|
worker_shutdown_timeout 5s;
|
|
error_log /dev/stderr warn;
|
|
events { worker_connections 1024; }
|
|
http { access_log off; client_body_temp_path /tmp/body; proxy_temp_path /tmp/proxy; client_max_body_size 11m; ssl_certificate /identity/service.crt; ssl_certificate_key /identity/service.key; ssl_client_certificate /pki/ca.crt; ssl_crl /pki/ca.crl; ssl_protocols TLSv1.2 TLSv1.3; ssl_session_tickets off; ssl_session_cache off; server { listen 3000 ssl; location / { proxy_pass http://127.0.0.1:13000; proxy_set_header Host $host; proxy_set_header X-Forwarded-Proto https; } }
|
|
map $ssl_client_s_dn $allowed_4318 { default 0; CN=api 1; CN=worker 1; CN=dispatcher 1; }
|
|
server { listen 4318 ssl; ssl_verify_client on;
|
|
location / { if ($allowed_4318 = 0) { return 403; } proxy_pass http://127.0.0.1:14318; proxy_http_version 1.1; }
|
|
}
|
|
map $ssl_client_s_dn $allowed_8888 { default 0; CN=prometheus 1; }
|
|
server { listen 8888 ssl; ssl_verify_client on;
|
|
location / { if ($allowed_8888 = 0) { return 403; } proxy_pass http://127.0.0.1:18888; proxy_http_version 1.1; }
|
|
}
|
|
map $ssl_client_s_dn $allowed_8889 { default 0; CN=prometheus 1; }
|
|
server { listen 8889 ssl; ssl_verify_client on;
|
|
location / { if ($allowed_8889 = 0) { return 403; } proxy_pass http://127.0.0.1:18889; proxy_http_version 1.1; }
|
|
}
|
|
map $ssl_client_s_dn $allowed_9090 { default 0; CN=grafana 1; CN=operator 1; }
|
|
server { listen 9090 ssl; ssl_verify_client on;
|
|
location / { if ($allowed_9090 = 0) { return 403; } proxy_pass http://127.0.0.1:19090; proxy_http_version 1.1; }
|
|
}
|
|
map "$ssl_client_s_dn:$request_method:$uri" $loki_action {
|
|
default 0;
|
|
~^CN=collector:POST:/otlp/v1/logs$ 1;
|
|
~^CN=(grafana|operator):GET:/(loki/api/v1/|ready) 1;
|
|
}
|
|
map $ssl_client_s_dn $allowed_3100 { default 0; CN=collector 1; CN=grafana 1; CN=operator 1; }
|
|
server { listen 3100 ssl; ssl_verify_client on;
|
|
location / { if ($loki_action = 0) { return 403; } proxy_pass http://127.0.0.1:13100; proxy_http_version 1.1; }
|
|
}
|
|
map $ssl_client_s_dn $allowed_3200 { default 0; CN=grafana 1; CN=operator 1; }
|
|
server { listen 3200 ssl; ssl_verify_client on;
|
|
location / { if ($request_method != GET) { return 403; } if ($allowed_3200 = 0) { return 403; } proxy_pass http://127.0.0.1:13200; proxy_http_version 1.1; }
|
|
}
|
|
}
|
|
stream { ssl_certificate /identity/service.crt; ssl_certificate_key /identity/service.key; ssl_client_certificate /pki/ca.crt; ssl_crl /pki/ca.crl; ssl_protocols TLSv1.2 TLSv1.3; ssl_session_tickets off; ssl_session_cache off; map $ssl_client_s_dn $target_6379 { default 127.0.0.1:9; CN=worker 127.0.0.1:16379; CN=dispatcher 127.0.0.1:16379; CN=api 127.0.0.1:16379; CN=operator 127.0.0.1:16379; }
|
|
server { listen 6379 ssl; ssl_verify_client on; proxy_connect_timeout 2s; proxy_timeout 10s; proxy_pass $target_6379; }
|
|
map $ssl_client_s_dn $target_6380 { default 127.0.0.1:9; CN=api 127.0.0.1:16380; CN=operator 127.0.0.1:16380; }
|
|
server { listen 6380 ssl; ssl_verify_client on; proxy_connect_timeout 2s; proxy_timeout 10s; proxy_pass $target_6380; }
|
|
map $ssl_client_s_dn $target_4317 { default 127.0.0.1:9; CN=collector 127.0.0.1:14317; }
|
|
server { listen 4317 ssl; ssl_alpn h2; ssl_verify_client on; proxy_connect_timeout 2s; proxy_timeout 10s; proxy_pass $target_4317; }
|
|
}
|