Overview of CockroachDB Cloud authentication
Organization level functions can be performed through three different interfaces, each with its own authentication flows:- The CockroachDB Cloud Console UI provides a user with an overview of their CockroachDB Cloud account, and offers functionality for administering an organization and the clusters within it. Refer to: Console authentication
-
The
ccloudutility allows users to execute cloud functions from the command line. Refer to:ccloudauthentication - The CockroachDB Cloud API allows service accounts to perform many organization and cluster administration functions. Refer to: Cloud API authentication
Console UI authentication
You may log in to the CockroachDB Cloud Console with a username and password, or by using .We recommend that CockroachDB Cloud Console users log in with , optionally with two-factor authentication (2FA) enabled for the SSO provider. This prevents potential attackers from using stolen credentials to access or tamper with your critical data.CockroachDB Cloud supports SSO with GitHub, Google, and Microsoft. provides additional configuration and flexibility, and includes support for OIDC or SAML protocols, autoprovisioning, and limiting the email domains that can use a given authentication method.Visit your CockroachDB Cloud Console’s account settings page and switch to SSO to improve the security of your cluster.
ccloud authentication
The ccloud utility offers Organization users a way to script many functions that must otherwise be performed in the console interface.
For more information, refer to:
To authenticate ccloud to a particular organization, run the following command. ccloud will open up your machine’s default browser, attempt to authenticate to the console and export a temporary auth token.
Cloud API authentication
The allows automated execution of organization functions. Unlikeccloud and the console UI, however, only service accounts can authenticate to the API.
Service accounts authenticate to the API using API keys, which are provisioned through the console UI.
Refer to:
SQL client authentication
To execute SQL statements or perform database administration functions on a cluster, you must connect to the cluster with a SQL client. CockroachDB clients include the CockroachDB CLI, and numerous .The connection string
You can obtain a connection string or CLI command for your cluster, to use with your choice of SQL client, by visiting your cluster’s overview page, and clicking Connect button, and following the instructions.https://cockroachlabs.cloud/cluster/< your cluster UUID >/
Clients can authenticate in two ways. Your connection string must be modified depending on which you are using:
Note that the is also required for authenticating the cluster server against the SQL client. This certificate can be downloaded by following the instructions in the Connect UI.
Username and password
A user can authenticate to a cluster by providing their username and password in the connection string. The connection string UI will indicate how to modify the string to user credentials. For information on managing SQL user credentials, including provisioning passwords, refer to .PKI security certificate
SQL clients may authenticate to CockroachDB Advanced clusters using PKI security certificates. Refer to for an overview of PKI certificate authentication in general and its use in CockroachDB. Refer to for procedural information on administering and using client certificate authentication.Node identity verification
The generated to connect to your application uses theverify-full SSL mode by default to verify a node’s identity. This mode encrypts the data in-flight as well as verifies the identity of the CockroachDB node, thus ensuring a secure connection to your cluster. Using this mode prevents MITM (Machine in the Middle) attacks, impersonation attacks, and eavesdropping.
To connect securely to your cluster using the verify-full mode:
- Download the CA certificate and place it in the
certsdirectory. The Certificate Authority (CA) certificate is the file that the client uses to verify the identity of the CockroachDB node. - When connecting to the cluster, specify the path to the
certsdirectory in the connection string. See for more details.
require SSL mode, although we do not recommend using it since it can make the cluster susceptible to MITM and impersonation attacks. For more information, see the “Protection Provided in Different Modes” section in PostgreSQL’s SSL Support document.
For more information about creating SQL users and passwords, see .
SSL mode settings
The table below lists thesslmode settings you can use to and their associated security risks. Other settings are not recommended.
sslmode | Eavesdropping protection | MITM protection | Description |
|---|---|---|---|
require | Yes | No | Force a secure connection. An error occurs if the secure connection cannot be established. This is less secure than using a CA certificate and is only recommended for testing or unimportant data. |
verify-full | Yes | Yes | Force a secure connection, verify that the server certificate is signed by a known CA, and verify that the server address matches that specified in the certificate. |

