Skip to main content

TCP Services

TCP services are a special kind of Otoroshi service designed to proxy pure TCP connections (SSH, databases, HTTP, etc.) without HTTP-level processing.

UI page

You can find all TCP services here

Properties

PropertyTypeDefaultDescription
idstringUnique identifier
namestringDisplay name of the TCP service
descriptionstringDescription
enabledbooleantrueWhether the service is active
portnumberThe listening port for incoming TCP connections
interfacestring0.0.0.0Network interface the service listens on
tagsarray of string[]Tags
metadataobject{}Key/value metadata
tlsstringDisabledTLS mode (see below)
clientAuthstringNonemTLS client authentication mode (see below)
sniobjectSNI configuration (see below)
rulesarray of object[]Routing rules (see below)

TLS modes

ModeDescription
DisabledNo TLS. TCP traffic is proxied as-is
PassThroughThe target exposes TLS. Traffic passes through Otoroshi without termination
EnabledOtoroshi terminates TLS and selects the certificate based on SNI

Client authentication

ModeDescription
NoneNo client certificate required
WantClient certificate is requested but not required
NeedValid client certificate is mandatory

SNI (Server Name Indication)

SNI allows Otoroshi to select different targets based on the hostname in the TLS handshake.

PropertyTypeDefaultDescription
enabledbooleanfalseEnable SNI-based routing
forwardIfNoMatchbooleanfalseForward to a default target if no SNI match is found
forwardsTo.hoststringDefault target hostname (when no SNI match)
forwardsTo.ipstringDefault target IP address
forwardsTo.portnumberDefault target port
forwardsTo.tlsbooleanfalseUse TLS to connect to the default target

Rules

For any listening TCP proxy, you can define multiple routing rules based on SNI or extracted HTTP host (when proxying HTTP).

PropertyTypeDescription
domainstringRegex pattern to match against the domain name
targetsarray of objectList of targets for this rule
targets[].hoststringTarget hostname
targets[].ipstringTarget IP address
targets[].portnumberTarget port
targets[].tlsbooleanUse TLS to connect to this target

JSON example

{
"id": "tcp_service_postgres",
"name": "PostgreSQL proxy",
"description": "TCP proxy for the production PostgreSQL cluster",
"enabled": true,
"port": 5432,
"interface": "0.0.0.0",
"tls": "Enabled",
"clientAuth": "None",
"sni": {
"enabled": true,
"forwardIfNoMatch": true,
"forwardsTo": {
"host": "postgres-primary.internal",
"ip": null,
"port": 5432,
"tls": false
}
},
"rules": [
{
"domain": ".*read.*",
"targets": [
{
"host": "postgres-replica.internal",
"ip": null,
"port": 5432,
"tls": false
}
]
}
],
"tags": ["database", "production"],
"metadata": {}
}

Admin API

GET    /api/tcp/services           # List all TCP services
POST /api/tcp/services # Create a TCP service
GET /api/tcp/services/:id # Get a TCP service
PUT /api/tcp/services/:id # Update a TCP service
DELETE /api/tcp/services/:id # Delete a TCP service
PATCH /api/tcp/services/:id # Partially update a TCP service