Monday
Jan092012

Lowry Parsons

Have recently been working on a new venture, Lowry Parsons, a publisher of eBooks. This has involved creating the website, but more interestingly publishing an ebook for Amazon Kindle. The book, The Five Minute Master on Email Overload, is available on Amazon now. 

More on the publishing process to follow as well as how to publish on Apple iBooks.

Thursday
Sep012011

Confluence and JIRA with HTTPS

So I wanted to get the development server running over HTTPS. This was always on my list of things to get done but the issue was forced as a supplier was having trouble accessing SVN over HTTP and after some research it seemed that it might be because a proxy somewhere between them and server was tripping out the relevant WebDAV HTTP methods. One way around this was to use HTTPS.

So to check things out I obtained a free 30 day SSL from SSL247. This has issued me with a RapidSSL certificate, which is great as they seem preety cheap and as this is a develoment server I have no need for and EV cert so I applied and within 5 mins I had my certificate. 

With this installed the static webpages and SVN worked fine. I have yet to get the supplier to try but at this point everything was OK. The problems came when trying to get Confluence and JIRA servers running with HTTPS. 

I knew that I had to change the base URLs, so once this was done I tried to access the server and I was getting redirected at various points to the HTTP version. Unfortunatly the documentation on the Atlassian website all refers to getting Confluence and JIRA serving HTTPS directly. This though is not what I required as I wanted Apache to be the SSL endpoint and forward the traffic to Confluence and JIRA using HTTP. This would be OK as the Confluence and JIRA installations were only available on localhost and so no issues.

After seraching the internet I stumbled across Lackhead.org who had the answer. The full answer is here, but in breif the proxyPort, scheme and proxyName elements needs to be added to section of the server.xml, like so

And that's it, restart Tomcat and it all works. You can now remove the non-ssl directives from the Apache config so that Confluence, JIRA and SVN are no longer accessible on HTTP. Of course if you have links to those old URLs you will need to add rewrite rules to redirect the http versions to the https versions

And that really is it.

Thursday
Jun022011

Getting MySQL Workbench to work on a remote host

When you first install MySQL on Ubuntu 10.04 server it is configured to only allow connections from localhost and so if you want to connect MySQL Workbench to the server for administration purposes then you need to allow connections from any IP address. This editing the /etc/mysql/my.cnf file and find the section [mysqld] and edit the bind-address entry from 127.0.0.1 to be your full IP address or if you want to bind to all addresses then use 0.0.0.0. Also make sure that there is no skip-networking section.

And don't forget to restart MySql

And grant privileges to root for remote administration, through the mysql console

You will also need to add the MySql port to the firewall rules to allow access

Thanks to Vivek Gite over at nixCraft for his great artical on the same subject.

Wednesday
Jun012011

Building an Development Server

So as part of a project I am working on I need to have a development server that will allow me to run a number of development tools, specifically JIRA, Confluence , Subversion, and MySQL but later maybe some other tools.

First I looked at the options for hosting. I would need a host wher eI could run tomcat and apache, this really meant a dedicated server or a cloud service. After a quite look into a number of providers I plumpted for a Rackspace Cloud Server. Sign up was astraight forward and after a phone call from Rackspace to confirm my details I was ready to create my first VM. This was very easy using their web based front end and within 10 mins I had a new Ubuntu 10.04 LTS Server up and running and was able to logon with SSH.

Security

So how to configure this new server. Since Rackspace give you root access it was nessassary to secure the server. This involved logging on as root and seting up two new groups, sshlogins and admin, adding a newuser, putting the newuser in both the groups:

Next we need to restricting ssh to the new sshlogins group only. To do this edit the /etc/ssh/sshd_config file, find where it says PermitRootLogin yes and change it to PermitRootLogin no then at the bottom of file add:

for this to take effect the sshd needs to be restarted:

And finally allowing the admin group to perform sudo actions. This involes editing the /etc/sudoers file, however as this is so important this needs to be done using visudo, adding the following line at the bottom.

Then save the file.

Now logout of root and log back in again as newuser

Next we need to stop any connections to ports except those we wish to have access through, i.e. 22 (for SSH) and 80 (for the Webserver). To do this will be use the inbuilt iptables, however to make life easier we will use ufw to configure the firewall. To do this first you will need to install ufw:

And configure the firewall as follows (thanks for Mike Descy at 101Umbrellas):

Installing base software

The base software for this installation is JIRA, Confluence , Subversion and MySQL. To install these and the other required components tomcat6-user for the private instance features of tomcat and ttf-dejavu for the fonts required as the server is installed with X11 use:

Configuring MySQL

MySQL needs to have some options set so it can work for Jira and Confluence. The easiest way to do this is to edit /etc/mysql/my.cnf and add the following lines at the end of the [mysqld] section just before the [mysqldump] section start

And then restart MySQl

Now we need Databases and users for Jira and confluence. To create these logon to the mysql console as root and enter:

Configuring Tomcat for Jira and Confluence

The tomcat6-user is required later for creating the separate tomcat instances

Confluence and Jira will need home directories as does tomcat for it's server instances, I put these in the /srv directory where the tomcat instance will also live eventually

We are going to create two new tomcat instances one for jira and one for confluence. Here we are setting the HTTP connection ports to 8090 and 8091 respectivly and the control ports to 8015 and 8016. Once the server instances are created the Catalina/localhost directories need to be created for each of the new tomcat instances

Since Jira and Confluence require some extra jars to work, namely those in the http://www.atlassian.com/software/jira/downloads/binary/jira-jars-tomcat-distribution-4.3-rc1-tomcat-6x.zip and the MySQL JDBC driver these need to be downloaded and put into the system-wide tomcat /usr/share/tomcat6/lib directory.

Next we need the .war files for Jira and Confluence. These need to be compliled and I suggest you do this on a seperate machine and follow the Atlassian instructions for Jira and confluence to build .war files and then copy the .war files to the live server ready for deployment to the tomcat instances.

Web configuration files for Jira and Confluence need to be created before starting the servers. For Jira the file, /srv/tomcat/jira/conf/Catalina/localhost/jira.xml should contain:

And for Confluence, something very similar the file, /srv/tomcat/confluence/conf/Catalina/localhost/confluence.xml should contain:

To set the memory allocation settings for Tomcat edit both jira/bin/setenv.sh and confluence/bin/setenv.sh and add the following line at the end:

Next you need to stop the default tomcat instance from automatically starting and set the Jira and Confluence instances to automatically start. To do this you need to create, and make executable, /etc/init.d/jira and /etc/init.d/confluence scripts as:

/etc/init.d/jira

/etc/init.d/confluence

And make them executable:

Then it is necessary to disable the default tomcat instance and enable the jira and confluence instances. Thanks to http://www.debuntu.org/how-to-manage-services-with-update-rc.d for this. Anyway here are the commands you need:

Startup Jira and Confluence:

Configuring Apache HTTPD

There are a number of things to configure in Apache. First you need to enable the proxy modules as these are required for the Proxy rules that are required. To do this:

Next the default site configuration file, /etc/apache2/sites-enabled/000-default needs to be edited to set the ServerName, ServerAdmin and DocumentRoot properties as such:

Then the proxy rules sections need to be added at the bottom of the file, but before the closing tag:

I like to put a basic index.html file in the /srv/www directory that allows users to find the Jira and Confluence sites. I use something like:

And restart Apache:

Configuring Subversion

This is fairly easy, I have decided to use http as the access method and thanks to the Ubuntu documentation on Subversion all you need to do is:

You then need to add the following to the Apache config file /etc/apache2/sites-enabled/000-default, after the previously added proxy sections but before the final tag:

Then you need to add a password for any users, the -c option is required for the first user but not any others:

And restart Apache:

Whats Left to do:

This setup all works and is all that is really required. However there are a couple of other things that you may wish to do:

  • Start jira and confluence as tomcat6 user - currently the tomcat instances run as root and this has security implications. Making the tomcat instances run as the tomcat6 user adds small amount of security such that if a hacker finds a security hole in tomcat then they only have limited access.
  • Configure Apache for SSL - This again adds more security and we can even stop all access to Jira, Confluence and Subversion without going through the SSL version of the site, thus stopping any password snooping
Tuesday
May172011

reCAPTCHA

In building a new website I was looking for a CAPTCHA program for User registration and after a very short search came across reCAPTCHA. Part Google, this CAPTCHA tries to harness the astonishing 150,000 man hours of work humans around the world spend each day solving CAPTCHAs for good use, reading old books. Amazing.