tags:

views:

581

answers:

2

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

Much appreciated.

A: 

You can run 'grails run-app-https' instead of 'grails run-app' and it will create a self-signed certificate for you and run in SSL.

Burt Beckwith
Hi Burt, Thanks but I have created a self signed certificate using Java keytool. As in the future I have to use a valid and Veri-Signed SSL.
WaZ
+1  A: 

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.

ataylor
ataylor,Thanks for replying. I have been busy trying to work Grails on a local JBoss. Once I get that bit sorted I will use SSL. If any case you have had any experience of using GRAILS with JBoss please share.Highly appreciated,WB
WaZ