Native Protocol encryption in YTsaurus

YTsaurus supports encryption of internal traffic between cluster components using TLS. This document describes the encryption architecture and provides configuration instructions for various deployment scenarios.

Overview

All components in a YTsaurus cluster — master servers, data nodes, proxies, and schedulers — communicate over the internal native RPC protocol. By default, data is transmitted in plaintext, which is acceptable as long as the network is trusted. However, if your cluster operates in a public network, or if you need to protect sensitive data, you should enable traffic encryption.

YTsaurus supports two connection security modes:

With certificate rotation, you can update certificates without service interruptions. When deploying on Kubernetes, certificate management can be automated using cert-manager.

Note

Native protocol encryption is available starting with YTsaurus version 25.2.

Encryption architecture

To configure encryption correctly, it's important to understand how components interact within a YTsaurus cluster. Below, we explain the transport-layer architecture and the process of establishing a secure connection.

What is the bus layer

The bus is the transport layer in YTsaurus that handles message delivery between components such as schedulers, proxies, data nodes, and others. The bus works with messages, which makes their size clearly defined — unlike standard TCP, which operates on a byte stream.

The RPC layer operates above the bus layer, assembling Protobuf messages from the transmitted bytes. The TCP layer, which handles network data transmission, sits below the bus layer. The bus layer knows the exact size of each message and waits for all bytes to arrive before passing the message upward.

The diagram below shows how YTsaurus cluster components interact with one another and with external clients. Traffic encryption is configured and applied only within the cluster — between its components such as HTTP proxies, master servers, and data nodes. The type of external client doesn't affect encryption: it can be a regular HTTP client, CHYT, SPYT, or any other service. For the full list of components that support encryption, see Components for configuration.

HTTP request YTsaurus cluster External client HTTP Proxy bus_client entry point for HTTP API Master Server bus_client + bus_server stores metadata Data Nodes bus_client + bus_server store data bus_client ↔ bus_server bus_client ↔ bus_server bus_client ↔ bus_server

Each component (master server, scheduler, data node, and others) performs two roles at once:

  • bus_client — initiates outgoing connections to other components.
  • bus_server — accepts incoming connections from other components.

For example, when an HTTP proxy requests data from a master server:

  • The HTTP proxy acts as a bus_client (connection initiator).
  • The master server acts as a bus_server (recipient).

At the same time, the master server can also act as a bus_client when communicating with other cluster components.

Establishing a secure connection

Establishing an encrypted connection between components happens in several stages:

  1. TCP connection setup — the client and server establish a standard TCP connection.
  2. Handshake exchange — the client sends its handshake to the server, and the server then sends its handshake to the client.
  3. Encryption decision — each side determines, based on the peer's handshake, whether an SSL connection should be established.
  4. SslAck exchange — if encryption is required, the client and server exchange fixed-size SslAck packets.
  5. Switching to SSL mode — after exchanging SslAck, both sides switch to using the SSL library.

Handshake is a Protobuf message exchanged by components immediately after a TCP connection is established. It includes:

  • encryption_mode — the encryption requirements (disabled/optional/required).
  • verification_mode — the certificate verification requirements (none/ca/full).

Key properties of a handshake:

  • Variable size — because it's a Protobuf message, its size may change when new fields are added.
  • Defined sequence — the client sends its handshake first, the server receives it and then sends its own.
  • Decision point — each side analyzes the peer's handshake and its own configuration to determine whether an encryption should be established.

Encryption decision

Each component decides whether to establish encryption based on:

  • Its own configuration (encryption_mode, verification_mode).
  • The peer's configuration (as provided in the handshake).

If one side is configured as required and the other as disabled, the connection won't be established.

How to enable encryption

To enable encryption, configure the appropriate parameters in the cluster component settings. Below is an overview of the available parameters and their usage scenarios.

Configuration parameters

Encryption is enabled via the bus_client and bus_server parameters in each component's configuration:

Parameter

Description

encryption_mode

Encryption mode:

  • disabled — encryption is turned off. If the other side requires encryption (required), the connection won't be established.
  • optional — encryption is used only if requested. The connection will be encrypted if the peer's mode is required.
  • required — encryption is mandatory. If the peer's mode is disabled, the connection will fail.

verification_mode

Certificate verification mode:

  • none — no peer authentication is performed.
  • ca — the peer is authenticated using a CA file (the certificate must be signed by a trusted CA).
  • full — the peer is authenticated using both the CA and hostname verification against the certificate (strictest mode).

cipher_list

A list of cipher suites separated by colons. Example: "AES128-GCM-SHA256:PSK-AES128-GCM-SHA256".

ca

A CA certificate or a path to the certificate file. Example: { "file_name" = "/etc/yt/certs/ca.pem" }.

cert_chain

A certificate or a path to the certificate file. Example: { "file_name" = "/etc/yt/certs/cert.pem" }.

private_key

A private key or a path to the key file. Example: { "file_name" = "/etc/yt/certs/key.pem" }.

load_certs_from_bus_certs_directory

Load certificates from the bus certificates directory. When set to true, the ca, cert_chain, and private_key parameters are treated as file names rather than full paths. Convenient when working with external clusters.

Encryption mode compatibility

When a connection is established, the result depends on the combination of encryption_mode settings configured for bus_client and bus_server:

Client

Server

Result

disabled

disabled

Unencrypted connection

disabled

optional

Unencrypted connection

disabled

required

Connection error

optional

disabled

Unencrypted connection

optional

optional

Unencrypted connection

optional

required

Encrypted connection

required

disabled

Connection error

required

optional

Encrypted connection

required

required

Encrypted connection

Components for configuration

You can configure encryption for the following cluster components:

  • controller_agent
  • data_node
  • discovery
  • exec_node
  • master
  • master_cache
  • proxy
  • rpc_proxy
  • scheduler
  • tablet_node
  • timestamp_provider
  • clock_provider
  • qt
  • yql_agent

You can also enable encryption when working with external cluster components such as SPYT and CHYT.

Note

To use TLS with CHYT, you need:

  • CHYT version 2.17 or later.

  • Strawberry version 0.0.14 or later.

Integration with CHYT

Unlike other components, CHYT runs inside a YTsaurus vanilla operation, so certificates are passed in a specific way:

  • Strawberry reads certificates from the files specified in its configuration.
  • The cluster-connection configuration with bus_client/bus_server parameters is taken from Cypress to determine the encryption mode and connection settings for cluster components.
  • The operation receives all security settings, including certificates and encryption parameters, via a secure_vault.
  • When certificates change, Strawberry recalculates the hash of the updated configuration data. If either side detects that the hash has changed, Strawberry automatically restarts the operation to apply the new settings.

The secure_vault allows you to pass certificates and keys to operations securely, without exposing them in plaintext. The cluster-connection configuration includes all the necessary settings for establishing secure connections between CHYT and other cluster components, including encryption modes (encryption_mode) and certificate verification modes (verification_mode).

Configuration examples

The examples below show how to configure TLS for different security levels. These settings are used in configuration files for YTsaurus components. For more details on how to apply them, see Configuration parameters.

Mutual certificate verification (mTLS)

Configuration for the highest security level with certificate verification on both sides:

mTLS configuration example
# Client side
bus_client:
  encryption_mode: required
  verification_mode: full
  ca:
    file_name: /etc/yt/certs/ca.pem
  cert_chain:
    file_name: /etc/yt/certs/client.pem
  private_key:
    file_name: /etc/yt/certs/client.key

# Server side
bus_server:
  encryption_mode: required
  verification_mode: full
  ca:
    file_name: /etc/yt/certs/ca.pem
  cert_chain:
    file_name: /etc/yt/certs/server.pem
  private_key:
    file_name: /etc/yt/certs/server.key

One-way encryption

Configuration where only the client verifies the server's certificate:

One-way verification example
# Client side
bus_client:
  encryption_mode: required
  verification_mode: ca
  ca:
    file_name: /etc/yt/certs/ca.pem

# Server side
bus_server:
  encryption_mode: required
  verification_mode: none
  cert_chain:
    file_name: /etc/yt/certs/server.pem
  private_key:
    file_name: /etc/yt/certs/server.key

Setup scenarios

The way you configure encryption depends on how your YTsaurus cluster is deployed. Here are instructions for the main deployment scenarios.

K8s with an operator
  • K8s with an operator
  • Manual deployment
  • External clusters

Performance

Encryption increases CPU load and may slightly reduce performance. Based on test results:

  • CPU load increases by 5–15%, depending on the operation type.
  • Throughput decreases by 3–10%.
  • Latency increases by 1–5 ms.

Secure vault for operation secrets.