Skip to content

Commit 7c57f31

Browse files
authored
Merge pull request #72 from smallstep/tidb
TiDB
2 parents 097cf3e + b7db7a1 commit 7c57f31

File tree

4 files changed

+39
-0
lines changed

4 files changed

+39
-0
lines changed

docs/tidb/config.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
name: TiDB
2+
protocol: mysql
3+
server_port: 4000
4+
topics: {}

docs/tidb/logo.png

11 KB
Loading

docs/tidb/topics/client_auth.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
TiDB requires client certificates to be configured on a per-user basis. The requirement can be configured using `CREATE USER` or `ALTER USER` statements. When set, TiDB will reject connections from these users if they don't present a valid certificate signed by your CA.
2+
3+
```sql
4+
mysql> CREATE USER 'myuser'@'%' REQUIRE SUBJECT 'CN={{ client_name }}';
5+
mysql> ALTER USER 'myuser'@'%' REQUIRE SUBJECT 'CN={{ client_name }}';
6+
```
7+
8+
You can [require other user certificate information](https://docs.pingcap.com/tidb/stable/certificate-authentication#get-user-certificate-information) in order to establish a connection.

docs/tidb/topics/server_auth.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
Copy the `{{ server_cert }}`, `{{ server_key }}`, and `{{ ca_cert }}` files to the directory that contains your TiDB config file.
2+
3+
```shell-session
4+
$ sudo cp {{ server_cert }} /<tidb-config-dir>/server-cert.pem
5+
$ sudo cp {{ server_key }} /<tidb-config-dir>/server-key.pem
6+
$ sudo cp {{ ca_cert }} /<tidb-config-dir>/ca.pem
7+
```
8+
9+
These files should be owned by the user that runs TiDB. Now add the following to your TiDB config file:
10+
11+
```ini
12+
#...
13+
[security]
14+
# Path of file that contains list of trusted SSL CAs for connection with mysql client.
15+
ssl-ca = "ca.pem"
16+
17+
# Path of file that contains X509 certificate in PEM format for connection with mysql client.
18+
ssl-cert = "server-cert.pem"
19+
20+
# Path of file that contains X509 key in PEM format for connection with mysql client.
21+
ssl-key = "server-key.pem"
22+
23+
require-secure-transport=true
24+
#...
25+
```
26+
27+
Restart your TiDB server for these changes to take effect.

0 commit comments

Comments
 (0)