Configure RBAC with Teleport
On this page
The Teleport integration provides secure and certificate-based access to SingleStore via the Teleport Database Service.
How the Teleport Integration Works
Teleport uses a proxy service that routes traffic from database clients to the SingleStore database using mutual TLS (mTLS).
The Teleport Database Service verifies the identity of the SingleStore databases by checking their TLS certificates against either the Teleport database CA or a custom CA configured for the database.
Teleport authenticates using mutual TLS (mTLS).
Prerequisites
-
An active Teleport cluster.
Verify connectivity to the Teleport cluster. To test connectivity: -
Run
tsh loginto sign in.For example: tsh login --proxy=<Teleport_cluster_endpoint> --user=<Teleport_username> -
Run
tctl status.Typically, if this command runs successfully, other tctlcommands will run as expected.
-
-
An active SingleStore deployment running SingleStore database version 9.
0. 12 or later. -
A host to run the Teleport Database Service.
-
Install the
mariadbormysqlcommand-line client. -
(Optional) A certificate authority.
-
(Optional) Install Helm to install the Teleport Database Service on a Kubernetes cluster.
Configure the Teleport Connection
Perform the following tasks to configure the connection between Teleport and SingleStore:
-
Create a Teleport database token.
-
Create a certificate/key pair.
-
Configure SingleStore.
-
Create a local Teleport User.
-
Configure and start Teleport Database Service.
-
Connect to SingleStore.
Once the connection is successfully configured, use Teleport to manage access to the SingleStore databases.
Create a Teleport Database Token
The Teleport Database Service requires a token to connect to the Teleport cluster.
tctl tokens add --type=db --format=text
Copy and store the generated token in /tmp/token on the server that will run the Teleport Database Service.
Create a Certificate/Key Pair
Configure the SingleStore database to trust the Teleport CA.
Use Teleport CA
To configure the SingleStore database to trust the Teleport CA and issue a certificate for the database, perform the following tasks:
-
To use the
tctlcommand-line tool, a Teleport user must be able to assume theDbsystem role.Add the following allowrule to the Teleport user's role:allow:impersonate:users: ["Db"]roles: ["Db"] -
Run the following command to export Teleport's CA and generate a certificate/key pair.
Update the hostname where the Teleport Database Service can access the SingleStore database server and the certificate validity period before running the command. tctl auth sign --format=db --host=<hostname> --out=server --ttl=<validity>This command creates 3 files:
-
server.cas -
server.crt -
server.key
-
-
Export the Teleport Database CA public certificate and merge it with
server.to generate a bundled certificate to be used by the SingleStore database.cas tctl auth export --type=db > teleport-db-ca.pemcat server.cas teleport-db-ca.pem > teleport-bundle.pem
Configure SingleStore
Enable TLS Connections
Run the following commands to enable TLS connections for SingleStore.
sdb-admin update-config --key ssl_cert --value /path/to/server.crt --all --yessdb-admin update-config --key ssl_key --value /path/to/server.key --all --yessdb-admin update-config --key ssl_ca --value /path/to/teleport-bundle.pem --all --yessdb-admin update-config --key ssl_ca_for_client_cert --value /path/to/teleport-bundle.pem --all --yes# Restart the database to apply updatessdb-admin restart-node --all --yes
Create/Update a Database User
Teleport uses a certificate to authenticate database users.
-
To create a new SingleStore database user:
CREATE USER 'jane'@'%' REQUIRE SUBJECT '/CN=jane';Provide the necessary privileges to the new database user.
For example: GRANT ALL PRIVILEGES ON dbTest.* TO 'jane'; -
Update an existing user:
ALTER USER 'jane'@'%' REQUIRE SUBJECT '/CN=jane';-- Remove the password for the userSET PASSWORD FOR 'jane'@'%' = PASSWORD("");
Create a Local Teleport User
Use the tctl users add command to create a local Teleport user.
tctl users add \--roles=access \--db-users="*" \--db-names="*" \jane
This command creates a local Teleport user named jane with the built-in access role and access to all the databases and database user names.
Configure and Start Teleport Database Service
Install and configure Teleport on the host where Teleport Database Service will run, using either of the following:
-
Linux server
-
Kubernetes cluster
Install on a Linux Server
-
To install a Teleport Agent on a Linux server, run the Teleport cluster's install script.
The script selects the correct version, edition, and installation mode for the cluster. For example: curl "https://<Teleport_cluster_hostname>:<port>/scripts/install.sh" | sudo bashUpdate the Teleport cluster hostname and port before running the command.
-
Generate a configuration file at
/etc/teleport.for the Teleport Database Service.yaml Update example.in the command to use the host and port of the Teleport Proxy Service.teleport. sh:443 Specify the endpoint ( host:port) of the SingleStore deployment in the--urioption.For example: Note
This command configures Teleport Database Service to use the Teleport CA.
Also, a single Teleport process can run multiple services.
The following command overwrites any existing configuration file. If you're running multiple services, add --output=stdoutto print the configuration in the terminal, and then manually adjust/etc/teleport..yaml sudo teleport db configure create \-o file \--token=/tmp/token \--proxy=example.teleport.sh:443 \--name=example-singlestore \--protocol=mysql \--uri=s2.example.com:3306 \--labels=env=dev -
Configure the Teleport Database Service to automatically start when the system starts.
-
If Teleport is installed using a package manager, run the following commands:
sudo systemctl enable teleportsudo systemctl start teleport -
If Teleport is installed using a tar archive, run the following command:
sudo teleport install systemd -o /etc/systemd/system/teleport.servicesudo systemctl enable teleportsudo systemctl start teleport
Run the
systemctl status teleportcommand to view the status of the Teleport Database Service. -
Install on a Kubernetes Cluster
Teleport provides Helm charts to install the Teleport Database Service on a Kubernetes cluster.
-
Configure Helm to fetch the Teleport charts from the Teleport Helm repository.
Run the following command: helm repo add teleport https://charts.releases.teleport.dev -
Run the following command to refresh the local Helm cache:
helm repo update -
Install a Teleport Agent in the Kubernetes cluster with the Teleport Database Service configuration.
Create a values.file with the required configuration.yaml The following configures the Teleport Database Service to use the Teleport CA.
Update the host and port of the Teleport Proxy Service and the endpoint of the SingleStore deployment. Replace JOIN_with the Teleport Database Token created earlier.TOKEN roles: dbproxyAddr: example.teleport.sh# Set to false if using Teleport Community Editionenterprise: trueauthToken: "JOIN_TOKEN"databases:- name: example-mysqluri: s2.example.com:3306protocol: mysqlstatic_labels:env: dev -
Install the chart.
helm install teleport-kube-agent teleport/teleport-kube-agent \--create-namespace \--namespace teleport-agent \--version 18.2.10 \-f values.yaml -
Run the following command to verify that the Teleport Agent is running:
kubectl -n teleport-agent get podsNAME READY STATUS RESTARTS AGE teleport-kube-agent-0 1/1 Running 0 32s
Connect to SingleStore
Once the Teleport Database Service is added to the cluster, run the following commands to log in to Teleport and view the databases accessible to the current user.
tsh login --proxy=teleport.example.com --user=janetsh db ls
Name Description Labels
------------------- ------------------- -------
example-singlestore Example SingleStore env=devTo connect to a database, run the tsh db connect command.
tsh db connect --db-user=jane --db-name=<database> example-singlestore
This command retrieves the credentials for a database and connects to it.
Note
The mysql or mariadb command-line client must be available in the system PATH to establish a connection.mariadb is the default command-line client for SingleStore.
To log out of a database and remove the credentials, run the following command:
# Remove credentials for a specific database instance.tsh db logout <database-name># Remove credentials for all database instances.tsh db logout
Last modified: November 11, 2025