-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
Nacos configuration encryption/Nacos配置加密 #5367
Comments
I have a question about this design. For most of situation, users will input configuration before encrypting in console. Whether console need to connect third part system and do encrypt? What's more, when user query configuration in console, how to decrypt the configuration? |
Co-authored-by: lidaoyang <lidaoyang@hotmail.com>
另外,传输层与客户端的加解密逻辑 和 落库取库的加解密 分开可不同实现是否更好?In addition, is it better that the encryption and decryption logic of the transport layer and the client side and the encryption and decryption of the library can be implemented differently? |
请问下,配置加解密功能 在1.4版本上实现吗? |
修改点中的服务端部分似乎还没有实现? |
是的,由于服务端需要实现配置加密的可扩展、可插拔,目前还没有比较好的插件方案,所以还没有实现。 |
1.4.2 的client已经支持配置加密SPI扩展了 |
几个问题:
|
备注,在大多数私有云场景,idc内部,明文传输是没有问题的 |
概念
交互流程
原则
以上是一些关于敏感配置加密方案的思考。 |
希望在nacos上用密文保存密码,加载到项目中时通过某些手段(例如拦截器,或继承某个类)解密。这个能实现吗? |
Nacos configuration encryption/Nacos配置加密
Is your feature request related to a problem? Please describe.
Nacos storage configuration is stored in the database in plaintext, and the plaintext data can be obtained no matter in the database or at the transport layer (such as HTTP packet capture).
Describe the solution you'd like
If you need to encrypt the configuration, you need to transmit the cipher text at both the storage layer and the transport layer, and only decrypt it on the client.
Encryption can be done by a third-party encryption system (such as Alibaba Cloud kms) or implemented by yourself (such as AES algorithm). Currently, the restrictions of the third-party encryption system and Nacos are inconsistent. For example, KMS direct encryption does not support special characters, and only supports up to 16kb, etc. .
So using secondary encryption, the struct is as follows:
The specific client operation is shown in the figure:
The client must be able to identify the encrypted configuration, which can be identified by whether there is encryptedDataKey, or by other characteristics, such as by prefix.
For the convenience of user understanding, it is possible to identify whether the encryption configuration is configured at a glance, and it is recommended to use the prefix (
cipher-
) to identify it.The encryption method must be extensible, and this one can be extended through SPI
Client implementation
As shown in the figure above, client modification mainly involves two parts:
Get Configuration
Publish Configuration
Modification
Client
Server
背景
Nacos存储配置都是明文存储在数据库中,不管是在数据库里、还是在传输层(比如HTTP抓包),都能拿到明文数据。
解决方案
如果需要加密配置,则需要在存储层和传输层都传输密文,只在客户端解密。
加密可以由第三方加密系统来完成(比如阿里云kms)或者自己实现(比如AES算法),目前第三方加密系统和Nacos的限制并不一致,比如KMS直接加密不支持特殊字符,最大只支持16kb等。
所以使用二级加密,方案如下:
具体的客户端操作如图:
客户端要能识别加密的配置,可以通过是否有encryptedDataKey来识别,也可以通过其他特征,比如通过前缀来识别。
为了用户理解方便,能够一眼识别出来是否加密配置,推荐通过前缀(
cipher-
)来识别。加密方式必须可以扩展,这一块可以通过SPI来实现扩展点。扩展点的逻辑可以不同,比如
cipher-
前缀表示第三方系统直接加密,cipher-kms-aes-128-
表示AES128,cipher-kms-aes-256-
表示AES256等等,这一块的扩展性可以通过用户自己实现SPI来做到。客户端实现
如上图所示,客户端修改主要涉及到两部分:
配置获取
配置发布
修改点
客户端
服务端
The text was updated successfully, but these errors were encountered: