Showing posts with label java. Show all posts
Showing posts with label java. Show all posts

Sunday, June 28, 2015

Plugin Development Environment Done right


I'm not normally one to endorse a particular product or company but in this case I really have to take my hat off to Atlassian and their plugin development environment for their products. I have had previous experience with contributing to a plugin but this was the first time I had started from scratch on a new plugin.

Getting going

First off the SDK creates you a skeleton of the project for which ever product you are creating the plugin for. This has an example of tests that you can run (very important) and also right away you can build your plugin, ready to install into the product.

Running in situ 

At this point you already have some working code, but the best thing is that you can run the full product right there from your plugin is built and then test it out on a running server. This allows extremely fast development, no downloading packages from a website, setting up a database, seeding it with data. One command at it's all up and running in a couple of minutes.

Rapid Development cycle

Since running up the server takes quite some time, the good people at Atlassian also provide a quick way to install the plugin once the server is running. All you need to do is to run another command, which compiles, packages and automatically installs your plugin to the running server in a matter of seconds, allowing you to test your changes in a very small amount of time. 

The above coupled with very good API documentation really eases the pain of development. 

And Finally...

All this means you get to focus hard on what your plugin is doing, and removes the cruft of having to worry about the environment that your plugin will run in. It is dead easy to get up and running and this is largely due to the work put in by the company in order to facilitate this. 

Being involved in DevOps I want to be creating this types of tools for developers in my organisation so that they can also develop quickly and easily and not worry about how hard it may be to get their code deployed to a running environment. 

Reference

https://developer.atlassian.com/docs/getting-started
https://developer.atlassian.com/static/
https://developer.atlassian.com/docs/getting-started/set-up-the-atlassian-plugin-sdk-and-build-a-project

Tuesday, September 16, 2014

AWS RDS MySQL SSL

Following my previous post of SSL with ELB's and instances I'd like to write a quick post about SSL and RDS MySQL. This is worth another blog post because it behaves slightly differently than your normal apache http or tomcat servers. 

This is because the SSL is enforced at the user level and not at the server port level. Typically when you disable insecure traffic to a particular server you will disable the port that it is listening on for insecure traffic - such as port 80 for the apache web server. 

MySQL is different, you still connect through the default port (3306), or whatever port you have configured it to run, but the difference is the way you connect. In order to ensure secure communication you must first create a user which requires SSL to connect:

First connect to the RDS instance as the root user:
mysql -h myinstance.123456789012.us-east-1.rds.amazonaws.com -P 3306 -u root -p
You can then create users in the specific way:
GRANT SELECT, INSERT, UPDATE, DELETE on db_name.* to 'encrypted_user'@'%' IDENTIFIED BY 'suprsecret' REQUIRE SSL;FLUSH PRIVILEGES;
You can now test this with the mysql client that you used earlier to connect to the database earlier:
mysql -h myinstance.123456789012.us-east-1.rds.amazonaws.com -u encrypted_user -p --ssl_ca=mysql-ssl-ca-cert.pem --ssl-verify-server-cert
The above should prompt you for the password that you set up above, and allow you to connect to the database securely. 

This is the database server end complete. The next part is to configure your application to use SSL to connect to the database securely. There are a number of ways in which you can complete this, for this example I'm going to configure a java application.

For this example we're going to configure the JDK to allow the secure connection. There are a number of options here, including application container specific configurations but this way has the advantage that all java applications (container or otherwise) will be able to connect.

First get the RDS MySQL server certificate from AWS:
wget https://rds.amazonaws.com/doc/mysql-ssl-ca-cert.pem
Now import this into the java trust store (replace $JAVA_HOME as necessary):
$JAVA_HOME/bin/keytool -importcert -alias rds -keystore $JAVA_HOME/jre/lib/security/cacerts -storepass changeme -file ./auspost-root-ca.cer -noprompt
Connecting to the MySQL database is the same as before however you now specify three new options in your connection string which connect using SSL:
jdbc:mysql://myinstance.123456789012.us-east-1.rds.amazonaws.com:3306?useSSL=true&verifyServerCertificate=true&requireSSL=true
For brevity I will not include the rest of the code that you use in java in order to connect.