Kubernetes "Storing keys in a directory '{path}' that may not be persisted outside of the containe



我们在Kubernetes中运行的。net Core Web API服务的生产日志中收到了警告。

将密钥存储在可能不会在外部持久化的目录'{path}'中容器的。当容器失效时,受保护的数据将不可用摧毁了!","@l"Warning"path":"/根/.aspnet/DataProtection-Keys", SourceContext:"Microsoft.AspNetCore.DataProtection.Repositories.FileSystemXmlRepository"

我们没有在StartUp中显式调用services. adddataprotection(),但似乎我们得到了使用。net Core 3.1和。net 5的服务的警告。(不适用于。net Core 2.1),也有StartUp

services.AddAuthentication Or 
services.AddMvc()

(可能还有其他条件我遗漏了)

我无法准确识别,它在哪里被调用,但在本地我可以看到相关的dll加载之前从XmlKeyManager访问DataProtection-Keys

Loaded 'C:Program FilesdotnetsharedMicrosoft.NETCore.App3.1.19Microsoft.Win32.Registry.dll'. 
Loaded 'C:Program FilesdotnetsharedMicrosoft.NETCore.App3.1.19System.Xml.XDocument.dll'. 
Loaded 'C:Program FilesdotnetsharedMicrosoft.NETCore.App3.1.19System.Private.Xml.Linq.dll'. 
Loaded 'C:Program FilesdotnetsharedMicrosoft.NETCore.App3.1.19System.Private.Xml.dll'. 
Loaded 'C:Program FilesdotnetsharedMicrosoft.NETCore.App3.1.19System.Resources.ResourceManager.dll'.
Microsoft.AspNetCore.DataProtection.KeyManagement.XmlKeyManager:
Using 'C:Users..AppDataLocalASP.NETDataProtection-Keys' as key repository and Windows DPAPI to encrypt keys at rest.

考虑到我们没有明确使用DataProtection,没有长时间使用身份验证加密,并且在测试期间我们没有看到任何问题,忽略这些警告是否安全?

或者错误意味着,如果不同的pod将涉及相同的客户端,身份验证可能会失败,它会更好地做一些建议在如何存储数据保护密钥以外的docker容器??

在分析了我们的应用程序如何使用受保护的数据(身份验证cookie, CSRF令牌等)之后,我们的团队决定,"当容器被破坏时,受保护的数据将不可用"。这只是一个警告,不会对客户产生影响,所以我们忽略它。

但YMMV。

相关内容

最新更新