ElasticBeanstalk-更改java.security?

时间:2019-06-20 15:07:49

标签: java amazon-elastic-beanstalk

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

如何通过.ebextensions做到这一点?还是这样做的另一种方式?

1 个答案:

答案 0 :(得分:1)

$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.

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

# 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>

然后进入弹性beantalk环境

->配置

->软件

->环境属性

->为 Name 输入java.security.properties,为 Value 输入/usr/share/tomcat8/conf/java-security

然后重新启动tomcat。您的securerandom.source应该更改为所需的值。

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