asp.net - 如何使用 Amazon Elastic Beanstalk 加密 web.config 部分并部署到多个服务器

标签 asp.net amazon-web-services web-config amazon-elastic-beanstalk

我正在使用 AWS Elastic Beanstalk 部署一个网站,并且可以非常轻松地将其部署到负载平衡的网络场中。

现在,我想对我已部署的网站的 web.config 中的某些部分进行加密,无论是在部署之前还是部署之后。

有很多文章介绍如何使用 Aspnet_regiis.exe 工具使用 RSA 来加密某个部分,但是,问题是当您处理网络场时,因为您需要将私钥导出到其他服务器。

摘自这篇文章http://msdn.microsoft.com/en-us/library/ff647398.aspx请参阅:

Web Farm Scenarios If you want to deploy the same encrypted configuration file on multiple servers in a Web farm, you should use the RSAProtectedConfigurationProvider. This provider makes it easy for you encrypt the data on one server computer and then export the RSA private key needed to decrypt the data. You can then deploy the configuration file and the exported key to the target servers, and then re-import the keys.

但是,我的问题是,在负载均衡的环境中,服务器会由于自动缩放规则而上下波动,我需要一个流程来自动化 key 的管理,即在新部署的服务器上导入用于加密 Web.config 的私钥。

有人做过这件事或者可以提供一些见解吗?

最佳答案

按照 @kukido 的建议,您需要做的是创建一个包含以下内容的 .ebextension 文件。

commands:
  encryptConfig:
    command: aspnet_regiis.exe -pe "connectionStrings" -app /
    cwd: %windir%\\Microsoft.NET\\Framework64\\v4.0.30319

关于asp.net - 如何使用 Amazon Elastic Beanstalk 加密 web.config 部分并部署到多个服务器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18369268/

相关文章:

amazon-web-services - 如何区分对 AWS 服务的调用是由 IAM 用户还是由 Cloud Formation 进行?

python - 在 python2 boto 中使用 aws 配置文件

asp.net - 如何在 roleManager ASP.NET 中读取加密的连接字符串

reactjs - 如何将React-app-rewired与Customize-CRA集成

c# - 我可以保证 Response.Filter 的 Stream.Write() 方法不会有部分字符字节吗?

asp.net - 本地主机找不到存储过程 'dbo.aspnet_CheckSchemaVersion'

asp.net - 使用 ASP.NET MVC 3 构建的 REST API 的版本控制 - 最佳实践

c# - 使用asp.net c#中的验证控件限制用户在文本框中输入html标签

scala - Spark : Writing data frame to s3 bucket

asp.net - 使用 ASPNET_REGIIS 加密 Web 配置