java - ElasticBeanstalk - 更改 java.security?

标签 java amazon-elastic-beanstalk

我想更改 Elastic Beanstalk 实例上 $JAVA_HOME/jre/lib/security/java.security 中的 securerandom.source 值。

如何通过 .ebextensions 做到这一点?或者是另一种方法来做到这一点?

最佳答案

$JAVA_HOME/jre/lib/security/java.security文件的开头,有一段内容是

# This is the "master security properties file".
#
# An alternate java.security properties file may be specified
# from the command line via the system property
#
#    -Djava.security.properties=<URL>
#
# This properties file appends to the master security properties file.
# If both properties files specify values for the same key, the value
# from the command-line properties file is selected, as it is the last
# one loaded.

因此,您可以在 .ebextensions 文件夹下创建一个包含以下内容的 java-security.config 文件:

# Create a file named java-security under /usr/share/tomcat8/conf to override the default value of securerandom.source
files: 
  "/usr/share/tomcat8/conf/java-security" :
    mode: "000755"
    owner: tomcat
    group: tomcat
    content: |
      securerandom.source=<the file you want for securerandom.source>

然后进入elastic beanstalk环境

-> 配置

-> 软件

-> 环境属性

-> 输入 java.security.properties 作为 Name,并输入 /usr/share/tomcat8/conf/java-security 作为 < em>值。

然后重新启动tomcat。您的 securerandom.source 应更改为您希望的值。

要记住的一件事是用户 tomcat 必须有权读取 /usr/share/tomcat8/conf/java-security 文件。

关于java - ElasticBeanstalk - 更改 java.security?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56688927/

相关文章:

java - response.setHeader ("Refresh", "300") 是什么意思?

java - 如何使用 iText 检测签名的 pdf 是否有效?

java - HttpClientBuilder - java.lang.NoSuchFieldError : INSTANCE

java - 如何调用数组构造函数初始化数组长度?

java - 在 Elastic Beanstalk 中设置 networkaddress.cache.ttl 的推荐方法是什么?

amazon-web-services - 自动伸缩、弹性IP

java - spring以:input形式显示错误的用户输入

ruby-on-rails - 在 Rails 应用程序中向 PostgreSQL 提供 SSL 证书

amazon-web-services - Google 服务帐户 key (json) 和 AWS Elastic Beanstalk

amazon-web-services - 使用 aws cli 部署到单独的帐户