Archive for March, 2008

License management plugin for Grails application

Wednesday, March 26th, 2008

I have been recently working on a plugin that provides ability to securely create, install and verify license for closed source grails applications. This plugin utilizes TrueLicense Library Collection (TLC). You can download the plugin here.

Installation

grails install-plugin <path-to-grails-license-0.1.zip>

Usage

  • Generate license file: grails generate-license
  • Start app: grails run-app
  • Instal/verify license at http://localhost:8080/your_app/license. If you try to access your app without installing license, you will be redirected to this page.

Components

  • /plugins/license-0.1/etc/privateKey.store - private key file. This never gets included in your WAR. (You should generate your own private/public keys with keytool command. see tips section below)
  • /plugins/license-0.1/etc/LicensePrivateConfig.properties - holds all necessary configuration to create a license such as issuer, holder, validity etc. Again not included in WAR
  • /plugins/license-0.1/conf/publicCerts.store - public key file. This is included in WAR
  • /plugins/license-0.1/conf/LicensePublicConfig.groovy - holds all necessary information required for the client. Included in WAR
  • /plugins/license-0.1/controller/LicenseController - Install, verify license
  • /plugins/license-0.1/services/LicenseService - Install, verify license
  • /plugins/license-0.1/conf/LicenseFilter - defines which controllers, actions need to be protected.

Tips

  • To generate private key:
    keytool -genkey -alias privatekey -keystore privateKeys.store
  • To generate public key
    keytool -export -alias privatekey -file certfile.cer -keystore privateKeys.store
    keytool -import -alias publiccert -file certfile.cer -keystore publicCerts.store
  • The system preferences are stored in the registry in windows and file system (/etc/.java/) in Linux. You may need appropriate permissions to be able to do this.