即使将此代码添加到Config.groovy
后,Grails也坚持使用自己的自签名证书:
grails.tomcat.truststorePath = "${grailsSettings.baseDir}/conf/ssl/truststore.jks"
grails.tomcat.truststorePassword = "changeit"
grails.tomcat.clientAuth = "want"
grails.tomcat.keystorePath = "${grailsSettings.baseDir}/conf/ssl/keystore.jks"
grails.tomcat.keystorePassword = "changeit"
grails.tomcat.keyAlias = "localhost"
知道如何强制Grails在这里使用真正的密钥库吗?
答案 0 :(得分:4)
显然,common mistake将这些设置放在Config.groovy
中。它们属于BuildConfig.groovy
。一旦我将它们放入BuildConfig.groovy
,一切都适合我。
答案 1 :(得分:0)
我无法让您的示例工作或弄清楚如何在BuildConfig.groovy
中设置任何属性,但对于grails 2.5.0,这对我来说是scripts/_Events.groovy
。
eventConfigureTomcat = { org.apache.catalina.startup.Tomcat tomcat ->
if (Environment.getCurrent() == Environment.DEVELOPMENT) {
System.setProperty("javax.net.debug", "ssl") //use this to confirm grails adds proper keystore/truststore settings
System.setProperty("javax.net.ssl.keyStoreType", "jks")
System.setProperty("javax.net.ssl.keyStore", "/absolute/path/to/keystore")
System.setProperty("javax.net.ssl.keyStorePassword", "<_password_>")
System.setProperty("javax.net.ssl.trustStoreType", "jks")
System.setProperty("javax.net.ssl.trustStore", "/absolute/path/to/truststore")
System.setProperty("javax.net.ssl.trustStorePassword", "<_password_>")
println "SSL configuration complete"
}
}