Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add encryption-at-rest document #3928

Merged
merged 12 commits into from
Jul 14, 2020
Merged

Conversation

TomShawn
Copy link
Contributor

@TomShawn TomShawn commented Jul 9, 2020

What is changed, added or deleted? (Required)

Which TiDB version(s) do your changes apply to? (Required)

  • master (the latest development version)
  • v4.0 (TiDB 4.0 versions)
  • v3.1 (TiDB 3.1 versions)
  • v3.0 (TiDB 3.0 versions)
  • v2.1 (TiDB 2.1 versions)

What is the related PR or file link(s)?

@TomShawn TomShawn added translation/from-docs This PR is translated from a PR in pingcap/docs. status/PTAL This PR is ready for reviewing. needs-cherry-pick-4.0 labels Jul 9, 2020
@TomShawn TomShawn requested review from yiwu-arbug and yikeke July 9, 2020 09:09
@yikeke yikeke requested review from ran-huang and removed request for yikeke July 9, 2020 10:11
@yiwu-arbug
Copy link
Contributor

@TomShawn @ran-huang great thanks for helping!


数据密钥由 TiKV 生成并传递给底层存储引擎(即 RocksDB)。RocksDB 写入的所有文件,包括 SST 文件,WAL 文件和 MANIFEST 文件,均由当前数据密钥加密。TiKV 使用的其他临时文件(可能包括用户数据)也由相同的数据密钥加密。默认情况下,TiKV 每周自动轮换数据密钥,但是该时间段是可配置的。密钥轮换时,TiKV 不会重写全部现有文件来替换密钥,但如果集群的写入量恒定,则 RocksDB 压缩会将带有最新数据密钥的旧数据重写进新数据文件。TiKV 跟踪密钥和加密方法,并使用密钥信息对读取的内容进行解密。

无论采用哪种数据加密方法,数据密钥都使用 AES256 在 GCM 模式下进行加密,以进行其他身份验证。所以使用文件而不是 KMS 传递密钥时,主密钥必须为 256位(32字节)。
Copy link
Contributor

@yiwu-arbug yiwu-arbug Jul 9, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
无论采用哪种数据加密方法,数据密钥都使用 AES256GCM 模式下进行加密,以进行其他身份验证。所以使用文件而不是 KMS 传递密钥时,主密钥必须为 256位(32字节)。
无论用户配置了哪种数据加密方法,数据密钥都使用 AES256-GCM 算法进行加密,以方便对主密钥进行验证。所以当使用文件而不是 KMS 方式指定主密钥时,主密钥必须为 256位(32字节)。

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ping

data-key-rotation-period = 7d
```

`data-encryption-method` 的可选值为 `aes128-ctr`、`aes192-ctr`、`aes256-ctr` 和 `plaintext`。默认值为 `plaintext`,即默认不开启加密功能。`data-key-rotation-period` 指定 TiKV 轮换密钥的频率。可以为新 TiKV 群集或现有 TiKV 群集开启加密,尽管只保证启用后写入的数据才能被加密。要禁用加密,请在配置文件中删除 `data-encryption-method`,或将该参数值为 `plaintext`,然后重启 TiKV。
Copy link
Contributor

@yiwu-arbug yiwu-arbug Jul 9, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
`data-encryption-method` 的可选值为 `aes128-ctr``aes192-ctr``aes256-ctr``plaintext`。默认值为 `plaintext`,即默认不开启加密功能。`data-key-rotation-period` 指定 TiKV 轮换密钥的频率。可以为新 TiKV 群集或现有 TiKV 群集开启加密,尽管只保证启用后写入的数据才能被加密。要禁用加密,请在配置文件中删除 `data-encryption-method`,或将该参数值为 `plaintext`,然后重启 TiKV。
`data-encryption-method` 的可选值为 `aes128-ctr``aes192-ctr``aes256-ctr``plaintext`。默认值为 `plaintext`,即默认不开启加密功能。`data-key-rotation-period` 指定 TiKV 轮换密钥的频率。可以为新 TiKV 群集或现有 TiKV 群集开启加密,但只有启用后写入的数据才保证被加密。要禁用加密,请在配置文件中删除 `data-encryption-method`,或将该参数值为 `plaintext`,然后重启 TiKV。

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ping


`data-encryption-method` 的可选值为 `aes128-ctr`、`aes192-ctr`、`aes256-ctr` 和 `plaintext`。默认值为 `plaintext`,即默认不开启加密功能。`data-key-rotation-period` 指定 TiKV 轮换密钥的频率。可以为新 TiKV 群集或现有 TiKV 群集开启加密,尽管只保证启用后写入的数据才能被加密。要禁用加密,请在配置文件中删除 `data-encryption-method`,或将该参数值为 `plaintext`,然后重启 TiKV。

如果启用了加密(即 `data-encryption-method` 的值不是 `plaintext`),则必须指定主密钥。要将 AWS KMS CMK 指定为主密钥,请在`[security.encryption]` 部分之后添加 `[security.encryption.master-key]` 部分:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
如果启用了加密(即 `data-encryption-method` 的值不是 `plaintext`),则必须指定主密钥。要将 AWS KMS CMK 指定为主密钥,请在`[security.encryption]` 部分之后添加 `[security.encryption.master-key]` 部分:
如果启用了加密(即 `data-encryption-method` 的值不是 `plaintext`),则必须指定主密钥。要使用 AWS KMS 方式指定为主密钥,请在`[security.encryption]` 部分之后添加 `[security.encryption.master-key]` 部分:

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ping

@ran-huang
Copy link
Contributor

可以把这个地方的链接补回去:https://github.com/pingcap/docs-cn/blame/master/whats-new-in-tidb-4.0.md#L84

@yiwu-arbug Do you mean adding a link to encryption-at-rest.md in what's new in 4.0 L84?

@yiwu-arbug
Copy link
Contributor

可以把这个地方的链接补回去:https://github.com/pingcap/docs-cn/blame/master/whats-new-in-tidb-4.0.md#L84

@yiwu-arbug Do you mean adding a link to encryption-at-rest.md in what's new in 4.0 L84?

yes. I deleted it in #3622. Let's add it back now.

@ti-srebot
Copy link
Contributor

@ran-huang, @yiwu-arbug, PTAL.

@TomShawn
Copy link
Contributor Author

@yiwu-arbug All comments are addressed. PTAL again, thanks!

@yiwu-arbug
Copy link
Contributor

可以把这个地方的链接补回去:https://github.com/pingcap/docs-cn/blame/master/whats-new-in-tidb-4.0.md#L84

@yiwu-arbug Do you mean adding a link to encryption-at-rest.md in what's new in 4.0 L84?

yes. I deleted it in #3622. Let's add it back now.

@TomShawn

@TomShawn
Copy link
Contributor Author

TomShawn commented Jul 13, 2020

@yiwu-arbug PTAL

@ti-srebot ti-srebot added the status/LGT1 Indicates that a PR has LGTM 1. label Jul 13, 2020
Copy link
Contributor

@yiwu-arbug yiwu-arbug left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Thanks!

@ti-srebot
Copy link
Contributor

@yiwu-arbug,Thanks for your review. However, LGTM is restricted to Reviewers or higher roles.See the corresponding SIG page for more information. Related SIGs: docs(slack).

@TomShawn TomShawn added the status/can-merge Indicates a PR has been approved by a committer. label Jul 14, 2020
@ti-srebot
Copy link
Contributor

@TomShawn Oops! This PR requires at least 2 LGTMs to merge. The current number of LGTM is 1.

@TomShawn TomShawn added require-LGT1 Indicates that the PR requires an LGTM. status/can-merge Indicates a PR has been approved by a committer. and removed status/can-merge Indicates a PR has been approved by a committer. labels Jul 14, 2020
@ti-srebot
Copy link
Contributor

/run-all-tests

@ti-srebot ti-srebot merged commit 15a74ee into pingcap:master Jul 14, 2020
ti-srebot pushed a commit to ti-srebot/docs-cn that referenced this pull request Jul 14, 2020
@ti-srebot
Copy link
Contributor

cherry pick to release-4.0 in PR #3964

@TomShawn TomShawn deleted the encyption-at-rest-ch branch July 14, 2020 07:38
TomShawn added a commit that referenced this pull request Jul 14, 2020
Signed-off-by: ti-srebot <[email protected]>

Co-authored-by: TomShawn <[email protected]>
Copy link

@Kennedy1991 Kennedy1991 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
require-LGT1 Indicates that the PR requires an LGTM. status/can-merge Indicates a PR has been approved by a committer. status/LGT1 Indicates that a PR has LGTM 1. status/PTAL This PR is ready for reviewing. translation/from-docs This PR is translated from a PR in pingcap/docs.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants