From bc2e75e1cdda3d88afb5f7adab7a49364d1bdeba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=93=D0=BE=D0=BB=D0=B8=D0=BA=D0=BE=D0=B2=20Maximillian?= =?UTF-8?q?=20=D0=90=D0=BD=D1=82=D0=BE=D0=BD?= Date: Thu, 26 Nov 2026 14:45:24 +0300 Subject: [PATCH] feat(telemetry): lab7 secure log and trace transport --- compose.yaml | 37 ++++++++++++++++++- .../datasources/observability.yaml | 4 +- infra/otel-collector.yaml | 10 ++++- infra/telemetry/grafana-datasources.conf | 26 +++++++++++++ infra/telemetry/jaeger-tls.conf | 34 +++++++++++++++++ 5 files changed, 106 insertions(+), 5 deletions(-) create mode 100644 infra/telemetry/jaeger-tls.conf diff --git a/compose.yaml b/compose.yaml index 66ba6bf..dd35cc2 100644 --- a/compose.yaml +++ b/compose.yaml @@ -428,6 +428,8 @@ services: image: opensearchproject/opensearch:2.19.7 restart: unless-stopped environment: + network.host: "127.0.0.1" + http.port: "19200" discovery.type: single-node node.store.allow_mmap: "false" DISABLE_INSTALL_DEMO_CONFIG: "true" @@ -443,7 +445,17 @@ services: restart: unless-stopped environment: COLLECTOR_OTLP_ENABLED: "true" - COLLECTOR_OTLP_GRPC_HOST_PORT: "0.0.0.0:4317" + COLLECTOR_OTLP_GRPC_HOST_PORT: "127.0.0.1:14317" + COLLECTOR_OTLP_HTTP_HOST_PORT: "127.0.0.1:4318" + COLLECTOR_GRPC_SERVER_HOST_PORT: "127.0.0.1:14250" + COLLECTOR_HTTP_SERVER_HOST_PORT: "127.0.0.1:14268" + QUERY_HTTP_SERVER_HOST_PORT: "127.0.0.1:16687" + QUERY_GRPC_SERVER_HOST_PORT: "127.0.0.1:16685" + ADMIN_HTTP_HOST_PORT: "127.0.0.1:14269" + PROCESSOR_JAEGER_COMPACT_SERVER_HOST_PORT: "127.0.0.1:6831" + PROCESSOR_JAEGER_BINARY_SERVER_HOST_PORT: "127.0.0.1:6832" + PROCESSOR_ZIPKIN_COMPACT_SERVER_HOST_PORT: "127.0.0.1:5775" + HTTP_SERVER_HOST_PORT: "127.0.0.1:5778" SPAN_STORAGE_TYPE: badger BADGER_EPHEMERAL: "false" BADGER_DIRECTORY_VALUE: /tmp/jaeger/data @@ -458,6 +470,9 @@ services: restart: unless-stopped command: ["--config=/etc/otelcol-contrib/config.yaml"] volumes: + - ./certs/private/ingress/ca.crt:/tls/ca.crt:ro + - ./certs/private/telemetry/collector-client.crt:/tls/client.crt:ro + - ./certs/private/telemetry/collector-client.key:/tls/client.key:ro - ./infra/otel-collector.yaml:/etc/otelcol-contrib/config.yaml:ro depends_on: - jaeger @@ -496,6 +511,26 @@ services: - ./certs/private/telemetry/otel-collector-server.key:/tls/server.key:ro - ./infra/telemetry/otel-collector-tls.conf:/etc/nginx/nginx.conf:ro + opensearch-tls: + image: nginx:1.27.4-alpine + restart: unless-stopped + network_mode: "service:opensearch" + volumes: + - ./certs/private/ingress/ca.crt:/tls/ca.crt:ro + - ./certs/private/telemetry/opensearch-server.crt:/tls/server.crt:ro + - ./certs/private/telemetry/opensearch-server.key:/tls/server.key:ro + - ./infra/telemetry/opensearch-tls.conf:/etc/nginx/nginx.conf:ro + + jaeger-tls: + image: nginx:1.27.4-alpine + restart: unless-stopped + network_mode: "service:jaeger" + volumes: + - ./certs/private/ingress/ca.crt:/tls/ca.crt:ro + - ./certs/private/telemetry/jaeger-server.crt:/tls/server.crt:ro + - ./certs/private/telemetry/jaeger-server.key:/tls/server.key:ro + - ./infra/telemetry/jaeger-tls.conf:/etc/nginx/nginx.conf:ro + rabbitmq-tls: image: nginx:1.27.4-alpine restart: unless-stopped diff --git a/infra/grafana/provisioning/datasources/observability.yaml b/infra/grafana/provisioning/datasources/observability.yaml index f40ba04..fe9c493 100644 --- a/infra/grafana/provisioning/datasources/observability.yaml +++ b/infra/grafana/provisioning/datasources/observability.yaml @@ -15,7 +15,7 @@ datasources: uid: opensearch type: grafana-opensearch-datasource access: proxy - url: http://opensearch:9200 + url: http://127.0.0.1:9200 editable: false jsonData: flavor: opensearch @@ -29,5 +29,5 @@ datasources: uid: jaeger type: jaeger access: proxy - url: http://jaeger:16686 + url: http://127.0.0.1:16686 editable: false diff --git a/infra/otel-collector.yaml b/infra/otel-collector.yaml index 36610e7..0861f9c 100644 --- a/infra/otel-collector.yaml +++ b/infra/otel-collector.yaml @@ -22,7 +22,11 @@ exporters: enabled: true opensearch: http: - endpoint: http://opensearch:9200 + endpoint: https://opensearch:9200 + tls: + ca_file: /tls/ca.crt + cert_file: /tls/client.crt + key_file: /tls/client.key logs_index: messenger-logs sending_queue: enabled: true @@ -31,7 +35,9 @@ exporters: otlp/jaeger: endpoint: jaeger:4317 tls: - insecure: true + ca_file: /tls/ca.crt + cert_file: /tls/client.crt + key_file: /tls/client.key sending_queue: enabled: true queue_size: 64 diff --git a/infra/telemetry/grafana-datasources.conf b/infra/telemetry/grafana-datasources.conf index d0a107f..3d687df 100644 --- a/infra/telemetry/grafana-datasources.conf +++ b/infra/telemetry/grafana-datasources.conf @@ -18,4 +18,30 @@ http { proxy_pass https://$target; } } + server { + listen 127.0.0.1:9200; + location / { + set $target "opensearch:9200"; + proxy_ssl_verify on; + proxy_ssl_server_name on; + proxy_ssl_name opensearch; + proxy_ssl_trusted_certificate /tls/ca.crt; + proxy_ssl_certificate /tls/client.crt; + proxy_ssl_certificate_key /tls/client.key; + proxy_pass https://$target; + } + } + server { + listen 127.0.0.1:16686; + location / { + set $target "jaeger:16686"; + proxy_ssl_verify on; + proxy_ssl_server_name on; + proxy_ssl_name jaeger; + proxy_ssl_trusted_certificate /tls/ca.crt; + proxy_ssl_certificate /tls/client.crt; + proxy_ssl_certificate_key /tls/client.key; + proxy_pass https://$target; + } + } } \ No newline at end of file diff --git a/infra/telemetry/jaeger-tls.conf b/infra/telemetry/jaeger-tls.conf new file mode 100644 index 0000000..10b25b8 --- /dev/null +++ b/infra/telemetry/jaeger-tls.conf @@ -0,0 +1,34 @@ +worker_processes 1; +events { worker_connections 512; } +http { + access_log off; + ssl_protocols TLSv1.2 TLSv1.3; + client_max_body_size 16m; + server { + listen 4317 ssl; + http2 on; + 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-(collector)$") { return 403; } + location = /opentelemetry.proto.collector.trace.v1.TraceService/Export { + limit_except POST { deny all; } + grpc_pass grpc://127.0.0.1:14317; + } + location / { return 403; } + } + server { + listen 16686 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-(grafana)$") { return 403; } + location /api/ { + limit_except GET { deny all; } + proxy_pass http://127.0.0.1:16687; + } + location / { return 403; } + } +} \ No newline at end of file