Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SSL, Tomcat and Grails

Tags:

ssl

grails

tomcat

I want to implement SSL in Grails. I cannot find the file /conf/server.xml in Grails folder structure. Has anyone implemented it?

Any help is much appreciated.

like image 860
WaZ Avatar asked Mar 02 '10 16:03

WaZ


1 Answers

How to set this up depends how you are deploying your grails app.

If you are deploying to a container like tomcat, install and configure SSL as you normally would. Then just build a war file with grails war and deploy normally. For tomcat in particular, open the top level tomcat server.xml and add an SSL Connector like so:

<Connector port="8443" maxHttpHeaderSize="8192"
    maxThreads="150" minSpareThreads="25" maxSpareThreads="75"
    enableLookups="false" disableUploadTimeout="true"
    acceptCount="100" scheme="https" secure="true"
    clientAuth="false" sslProtocol="TLS"
    SSLEngine="on"
    SSLCertificateFile="/path/to/cert.pem"
    SSLCertificateKeyFile="/path/to/key.pem"
    SSLPassword="passphrase"
     />

Adjust the connector port to 443 to accept SSL requests directly on the default port. Then drop your war file into the webapps folder.

For the embedded development server (jetty), import your cert into a keystore with keytool and put it in the grails work directory under ssl/keystore. This will look something like $HOME/.grails/1.2.1/ssl/keystore. The keystore password must be "123456". Then run grails with grails run-app --https. Grails will create the keystore file if it doesn't exists, but won't overwrite it if you replace it with your own.

like image 92
ataylor Avatar answered Nov 05 '22 09:11

ataylor