Archive

Posts Tagged ‘secure’

Apache SSL redirect

February 12th, 2009 Arthur Gressick No comments

So I have this secure shopping cart RoR project. I want people to simply navigate to the web address but when they get there I want them to automatically be moved over the the SSL version. I was looking for a simply solution one that I could very easily implement without changing much of the code of the site. Here is how I did it.

In Apache Virtual Host file on the *:80 config I have this set.

<VirtualHost *:80>
     ServerName subdomain.domain.com
     Redirect / https://subdomain.domain.com/
     ServerAlias subdomain.domain.com
</VirtualHost>

This will direct any of the information coming in on the port 80 over to the 443/https portion of the website. Make sure you have the HTTP portion configured properly.

Creating a Ubuntu CSR for Go Daddy

February 11th, 2009 Arthur Gressick 1 comment

I had to get a SSL certificate for a web site of mine yesterday. I decided to get another SSL certificate from GoDaddy. Here are my notes for getting the certificate.

I went ahead and created a folder to make all of my work in so that I could zip it up later or have the Rsync server grab it and save it in the main infrastructure.

mkdir /root/certificate_godaddy

This will generate the randomized string create the csr.

openssl genrsa -out domain_name.key 1024

This will create the CSR for GoDaddy which will you will need to copy and paste into their site. If you are going to be requesting a Wild Card SSL make sure that the NAME is *.domain_name.com

openssl req -new -key domain_name.key -out domain_name.csr

Now log into the GoDaddy site and paste the contents from the above CSR into their site. When you get the email back I suggest putting the 2 files they give you in the same location as you created the above. You will most likely have the following files.

domain_name.com.crt
gd_bundle.crt

With those files you will need to setup the SSL virtual host like the below:

<VirtualHost *:443>
        ServerName subdomain.domain_name.com
        ServerAdmin user@domain.com
        DocumentRoot "/home/user/vhosts/site_down"
        DirectoryIndex index.html index.php
        ErrorLog /var/log/apache2/secure_domain_name_error.log
        <IfModule mod_ssl.c>
                SSLEngine On
                SSLCertificateFile "/home/user/csr/_.domain_name.com.crt"
                SSLCertificateKeyFile "/home/user/csr/domain_name.com.key"
                SSLCertificateChainFile "/home/user/csr/gd_bundle.crt"
        </IfModule>
        .. The rest of your config file
</VirtualHost>

From here you should have no problems with the GoDaddy certificate. Hope this helps everyone.