Apache
  Home arrow Apache arrow Page 10 - Secure Installation and Configuration
Dev Shed Forums  
Administration  
AJAX  
Apache  
BrainDump  
DHTML  
Flash  
Java  
JavaScript  
Multimedia  
MySQL  
Oracle  
Perl  
PHP  
Practices  
Python  
Reviews  
Security  
Smartphone Development  
Style-Sheets  
Web Services  
XML  
Zend  
Zope  
Mobile Linux  
App Generation ROI  
IBM® developerWorks  
Forums Sitemap  
E-Commerce Hosting  
Linux Web Hosting  
Managed Hosting  
Small Business Hosting  
VPS Hosting  
Weekly Newsletter

 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid  
Request Media Kit
Contact Us  
Site Map  
Privacy Policy  
Support  
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
Google.com  
APACHE

Secure Installation and Configuration
By: Apress Publishing
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: starstarstarstarstar / 30
    2004-08-17


    Table of Contents:
  • Secure Installation and Configuration
  • Asymmetric Encryption and GnuPG
  • GnuPG and Apache Signatures
  • Checking and Installing Apache
  • Running Apache and Testing it with Nikto
  • Secure Configuration
  • File Permissions
  • Don’t Give Extra Information Away
  • Apache and SSL
  • Generate Certificates
  • Configuration

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      error-file:tidyout.log Del.ici.ous error-file:tidyout.log Digg
      error-file:tidyout.log Blink error-file:tidyout.log Simpy
      error-file:tidyout.log Google error-file:tidyout.log Spurl
      error-file:tidyout.log Y! MyWeb error-file:tidyout.log Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article

     
     
    ADVERTISEMENT


    Secure Installation and Configuration - Generate Certificates
    ( Page 10 of 11 )

    Generating the Certificates

    Before you start Apache, you need to generate the server’s private key. You can use the following command:

    [root@merc root]# openssl genrsa -des3 -out server.key 1024
    Generating RSA private key, 1024 bit long modulus
    ...++++++
    .++++++
    e is 65537 (0x10001)
    Enter pass phrase for server.key:
    ******
    Verifying - Enter pass phrase for server.key:
    ******
    [root@merc root]#

    You then need to create a Certificate Signing Request (CSR), using your server’s private key:

    [root@merc root]# openssl req -new -key server.key -out server.csr
    Enter pass phrase for server.key:
    You are about to be asked to enter information that will be incorporated
    [...]
    -------
    Country Name (2 letter code) [GB]:
    AU
    State or Province Name (full name) [Berkshire]:
    WA
    Locality Name (eg, city) [Newbury]:
    Fremantle
    Organization Name (eg, company) [My Company Ltd]:
    Mobily.com
    Organizational Unit Name (eg, section) []: Common Name (eg, your name or your server's hostname) []: www.mobily.com

    Email Address []: my_address@mobily.com
    Please enter the following 'extra' attributes
    to be sent with your certificate request
    A challenge password []:
    An optional company name []:
    [root@merc root]#

    You should send the generated file, server.csr, to a Certificate Authority (CA). After verifying your details, they will reply with a proper certificate (the file would be probably called server.crt).

    If you want to test your server, you will need to create your own CA first:

    [root@merc root]# openssl genrsa -des3 -out ca.key 1024
    Generating RSA private key, 1024 bit long modulus
    .........++++++
    ........++++++
    e is 65537 (0x10001)
    Enter pass phrase for ca.key:
    ******
    Verifying - Enter pass phrase for ca.key:
    ******

    You now need to create a self-signed CA certificate:

    [root@merc root]# openssl req -new -x509 -days 365 -key ca.key -out ca.crt
    Enter pass phrase for ca.key:
    ******
    You are about to be asked to enter information that will be incorporated into your certificate request.
    What you are about to enter is what is called a Distinguished Name or a DN.
    There are quite a few fields but you can leave some blank
    For some fields there will be a default value,
    If you enter '.', the field will be left blank.
    ------
    Country Name (2 letter code) [GB]:
    AU
    State or Province Name (full name) [Berkshire]:
    Test
    Locality Name (eg, city) [Newbury]:
    Test
    Organization Name (eg, company) [My Company Ltd]:
    Test
    Organizational Unit Name (eg, section) []:
    Test
    Common Name (eg, your name or your server's hostname) []:
    Email Address []:
    [root@merc root]#

    You should now use the script sign.sh to sign your server.csr file with your newly created certifying authority:

    [root@merc root]# apache_source/mod_ssl-2.8.14-1.3.29/pkg.contrib/sign.sh server.csr
    CA signing: server.csr -> server.crt:
    Using configuration from ca.config
    Enter pass phrase for ./ca.key:
    Check that the request matches the signature
    Signature ok
    The Subject's Distinguished Name is as follows countryName         :PRINTABLE:'AU'
    stateOrProvinceName :PRINTABLE:'WA'
    localityName        :PRINTABLE:'Fremantle'
    organizationName    :PRINTABLE:'Mobily.com'
    commonName          :PRINTABLE:'www.mobily.com'
    emailAddress        :IA5STRING:'merc@mobily.com'
    Certificate is to be certified until Aug 17 04:42:23 2004 GMT (365 days)
    Sign the certificate? [y/n]:
    y
    1 out of 1 certificate requests certified, commit? [y/n]
    y
    Write out database with 1 new entries
    Data Base Updated
    CA verifying: server.crt <-> CA cert
    server.crt: OK

    You now have the files server.crt (your certificate) and server.key (your server’s private key). 

    This chapter is from Hardening Apache, by Tony Mobily. (Apress, 2004, ISBN: 1590593782). Check it out at your favorite bookstore today. Buy this book now.



     
     
    >>> More Apache Articles          >>> More By Apress Publishing
     

       

    APACHE ARTICLES

    - Creating a VAMP (Vista, Apache, MySQL, PHP) ...
    - Putting Apache in Jail
    - Containing Intrusions in Apache
    - Server Limits for Apache Security
    - Setting Permissions in Apache
    - Installing Apache
    - Apache Installation and Configuration
    - Apache Tapestry and Custom Components: DateI...
    - Tapestry and AJAX: Autocompleter and InlineE...
    - PropertySelection and IPropertySelectionMode...
    - The DatePicker and Shell Components of Apach...
    - Apache Tapestry: ASO and More Components
    - Apache Tapestry and DirectLink, IoC and DI
    - Making a CelebrityCollector with Apache Tape...
    - Apache Tapestry and Listener Methods, Condit...





    © 2003-2009 by Developer Shed. All rights reserved. DS Cluster 2 Hosted by Hostway
    For more Enterprise Application Development news, visit eWeek