SSL - This page contains secure and non secure itemsLast Update: 14th June, 2005
Article ID: 75



Introduction

SSL stands for Secure Sockets Layer. This is technology derived in part from the military that encrypts data transfers across the internet. There are several flavours of SSL but the most prevalent one today is 128 bit encryption, but watch out 256 bit encryption is on it's way!

For an e-trader, SSL encryption protects your customers transaction details as they are passed back and forth between their browser and your server/domain. The data encryption happens at one end using a key and is deciphered at the other end using an equivalent key. The permutations for how data can be encrypted are astronomical making it virtually theft and interference proof during transit.

SSL DOES NOT PROTECT your server from attacks, nor your admin or catalog from malicious hacks. In order to protect your server and files you need to use facilities such as firewalls, virus checkers, Apache and IIS user and password protection for directories and files.

Why Do I Need SSL ?

You need SSL if you are selling to the public for two very good reasons.

1) Your customers expect it - As surfers become more sophisticated they look at your site and want to make sure their details will be safe should they order products. SSL seals are part - but a big part - in that re-assurance process. If the choice between two sites comes down to which offers transaction security - do you want to be the site that misses out?

2) Even if you have unsophisticated customers who do not look for SSL encryption before they buy - if the data they send you is intercepted and misused - you could land up being in heavy lawsuits for amongst many other things negligence. This is a small possibility - but do you want to take the risk?


Getting SSL

How Do I Get SSL?

Surf and find a Certificate issuer you feel happy with where you buy your SSL cerificate for a period of time 1 year, 2 year, etc.

If you have your own server you will need to generate a CSR (Certificate Signing request). If you are on shared hosting you need to get your host to raise a CSR (Certificate Signing request). To do this the host will need certain information from you, especially if they are not also your registrar. Such info will be your domains registered adminstrator. This info will be required by the SSL issuer. Along with the CSR they also generate a key that will be used to encrypt and decipher data transmissions from your server/domain.

Qualities of a SSL Company:

  • They own or have a trusted root in most browsers.

    All browsers come pre-installed with so called Trusted roots. These prevent Joe Shmoe and his cousin Joe Bloggs from issuing worthless certificates that cannot do the encrypting to unsuspecting buyers.

    To see trusted roots if you use IE go to Internet Options under tools and select the content tab where you will see in the middle section all the trusted root certs installed on IE and their issuers.


  • If they don't have a trusted root in most browsers make sure they have a cert known as a chaining cert that links whatever they sell to you with a trusted root.


  • What to watch out for?

    1. Your certificate will encrypt data in a very precise way - if the cert is issued to www.yourdomain.com it will NOT encrypt transfers between yourdomain.com and browsers and vice versa. So make sure you instruct your host to get the CSR raised with the correct AND full name of the domain you want to be encrypted.

    I normally use the domain name without the www. qualifier because servers for a number of reasons can strip the www. off, but I have yet to see a server add it on without a deliberate redirect.

    2. Send the CSR to your cert issuer who will vet the details and write to the administrator noted when the CSR was raised.

    3. Assuming you are the administrator of your domain - you will have to acknowledge the mail from the issuer and OK the SSL.

    4. The issuer will raise a SSL cert and send it to you. If you are using a chaining issuer they will also send a chain certificate.

    5. Send these to your host who will install as follows:


    SSL with osCommerce

    How Does SSL Work With OsCommerce?

    The workings of SSL with osCommerce are quite straightforward. Once your SSL is installed, you set the configuration path for https:// in catalog/includes/configure.php to enable SSL and the code takes care of the rest.

    // Define the webserver and path parameters
    // * DIR_FS_* = Filesystem directories (local/physical)
    // * DIR_WS_* = Webserver directories (virtual/URL)
    define('HTTP_SERVER', 'http://www.yourdomain.com'); // eg, http://localhost - should not be empty for productive servers
    define('HTTPS_SERVER', 'https://yourdomain.com'); // eg, https://localhost - should not be empty for productive servers
    define('ENABLE_SSL', true); // secure webserver for checkout procedure?
    define('HTTP_COOKIE_DOMAIN', 'www.yourdomain.com');
    define('HTTPS_COOKIE_DOMAIN', 'yourdomain.com');
    define('HTTP_COOKIE_PATH', '/catalog/');
    define('HTTPS_COOKIE_PATH', '/catalog/');
    define('DIR_WS_HTTP_CATALOG', '/catalog/');
    define('DIR_WS_HTTPS_CATALOG', '/catalog/');

    Note: In the example above the certificate was issued WITHOUT the www. qualifier and this shop is installed in Catalog directory ONE level below root. In normal working - these changes above will result in a small padlock being shown in the bottom right of your browser status bar when you navigate to a secure page AND your address line will show the https:// URL instead of http://


    If you look through the code you will see example after example of statements that refer to SSL where osC is making a decision based on request type as to whether to display the secured or non secured pages.

    In short neither you nor your customers has to type in https:// into the address line to get to secure pages. osCommerce will identify from the configuration if SSL is installed and direct browsers to the correct page depending on what the browser is doing on your site.


    Trouble Shooting

    1. Security Alert

    The alert box says info you exchange with this site cannot be viewed or changed by others. However there is a problem with the sites security certificate.

    The box has 3 levels of alert which are:

    Your certificate has probably been issued with or without the www. and you have used the other spellng in your catalog/includes/configure.php file. Make sure the cert name as issued is used in the configure.php files.

    2. This page has both secure and insecure items

    This alert appears if the secured page the browser is trying to show has objects or references that point to non secured domains.

    So for instance if you had a graphical image of credit cards as processed by your gateway and say you were hotlinking to the images with a piece of code such as <img src="http://mycreditcardprocessor.com> That image is not on your encrypted domain hence the alert would show.

    Often this problem will appear from one or more of three sources:

    3. Page 404 (unavailable)

    If you set your site up and during install you choose SSL security WITHOUT having done the stuff in here you may get 404's when you try to access secured pages.

    Wrapping Up

    1. Self issued certificates

    Some people have dedicated servers and even on some shared server you can raise a self issued SSL certification. This does everything as above except the certificate root does not exist in browsers. Therefore your site may be secure (although I do not profess to know if self certificates offer 128 bit encryption), BUT your site visitors will ALWAYS get the alert in Trouble Shooting point 1.

    Even though the alert says the site is safe, this is perhaps worse than not having a certificate as it alerts people to the fact that there is a problem with the certificate - and people do not like problems !!!

    2. Shared SSL certificates

    Talk to your host for the path you need to apply in your configure.php paths

    3. Fixing SSL Problems

    If the problem is an image you are hotlinking you need to ask the owner if you can have access to the image and place it in your own images directory under the encrypted domain and then change the path in your footer so that it now references the image in your domain.

    <?php
      
    echo tep_image(DIR_WS_IMAGES . 'my_image.gif', 'my ALT text', '100', '150');
    ?>




    All images which are also hyperlinks should be referenced in the following way:

    <?php
      
    echo '<a href="' . tep_href_link('your_directory/your_page.php') . '">' . tep_image(DIR_WS_IMAGES . your_image.gif) . '</a>';
    ?>





    If you are using images in the stylesheet for backgrounds they should also use the relative address ... e.g. images/my_background.gif


    If you have for instance a visitor counter that goes back to the counter owners server to process info - you may be able to construct an if else statement around the counter using php such that if the $request_type is SSL then do not go to the counter owners site.

    For Google ads the script has to go back to google - not on your domain which gives the problem so use the following construct to prevent google ads from showing iF the browser is on a secure page:

    <?php
    if ($request_type != 'SSL') {
    .....
    .....
    .....
    src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
    </script>
    .....
    .....
    }
    ?>

     

     

    Trademark Policy | Copyright Policy | Sitemap

    Copyright © 2000-2005 osCommerce. All rights reserved.