• Things to remember when creating Apache SSL certs

    Since I don’t create certs all that often, I’ve always been frusterated by having to search out the commands every time I have to make one. Frequently I forget about removing tripple DES from the server.key file, and end up with a cert that makes me enter a psss phraze every time I start up Apache.

    Thus, I decided to create an entry here with all the commands, so that I will never have to go searching for them again.

    First, change directory into your Apache configuration directory:

    # cd /path/to/httpd/conf

    Generate the server key (with password):

    # openssl genrsa -des3 -out server.key 1024

    Optionally, we can generate a key file without a password. This means that Apache will start without requesting a password. This is important should there ever be a power failure, or when a reset is required and no one knows the password. Use the following command:

    # openssl rsa -in server.key -out server.pem

    A CSR (Certificate Signing Request) is required for afirming that the server key is valid. The server.pem is used in place of server.key as we don’t require a password:

    # openssl req -new -key server.pem -out server.csr

    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) [AU]:US
    State or Province Name (full name) [Some-State]:Your State
    Locality Name (eg, city) []:Your Cit
    Organization Name (eg, company) [Internet Widgits Pty Ltd]: Your Company Nam
    Organizational Unit Name (eg, section) []:Department Name
    Common Name (eg, YOUR name) []: server.spiralbound.net
    Email Address []:me@spiralbound.net
    Please enter the following ‘extra’ attributes to be sent with your certificate request
    A challenge password []:
    An optional company name []:

    Finally, the certificate needs to be signed. Normally this is done by an official authority such as Thawte. However, if this is not available, we can sign the certificate ourselves. In this example a time limit of 3 years, or 1095 days is set for the amount of time to be valid. Again, we use the server.pem file without a password.

    # openssl x509 -req -days 1095 -in server.csr -signkey server.pem -out server.crt

    This entry was posted on Thursday, April 28th, 2005 at 3:59 pm and is filed under Data and Technology. You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.
  • 1 Comment

    Take a look at some of the responses we've had to this article.

    1. Steven Burnell
      Dec 30th
      Reply

      Thanks for the post on this, I keep it bookmarked for easy reference. One thing I would like to note though is that in your example above, you first make your private key, encrypting it as you do so, and then in your second (optional) command you remove the encryption by inputting the encrypted file and outputting the results to a new plain text file. This can be done in one simple step if you don’t want the encryption to begin with:

      openssl genrsa -out plaintext.key 2048

      Then you can do the remaining steps for CSR and self-signing with that file. Just saves a step, an extra file, and possibly some confusion to someone new to this.

  • Leave a Reply

    Let us know what you thought.

  • Name (required):

    Email (required):

    Website:

    Message:

Visitors have tagged this post: t (352) - openssl no password (67) - apache certificate password (48) - remove password from ssl cert (45) - remove password from ssl key (41) - ssl remove password (41) - apache ssl password (37) - genrsa no password (33) - remove password from ssl certificate (30) - openssl remove certificate password (30) - remove ssl password (28) - openssl genrsa without password (23) - openssl without password (23) - spiralbound net (23) - apache ssl "remove password" (22) - openssl remove password (21) - apache ssl no password (20) - generate apache.pem (20) - Create .pem (19) - apache ssl without password (18) - openssl genrsa no password (18) - generate csr without password (18) - remove password ssl key (17) - remove password from ssl (17) - openssl remove password from certificate (17) - remove password from pem file (16) - openssl change password (16) - genrsa without password (16) - start apache ssl without password (15) - ssl certificate remove password (15) - openssl certificate remove password (14) - openssl remove password certificate (14) - apache certificate remove password (14) - openssl certificate without password (13) - remove password ssl (13) - generate ssl key without password (13) - ssl cert remove password (13) - openssl remove certificate (13) - openssl pem no password (13) - ssl without password (12) - apache certificate without password (11) - remove ssl key password (11) - openssl req no password (11) - openssl key "no password" (10) - openssl certificate no password (10) - apache ssl password startup (10) - apache remove certificate password (10) - removing password from ssl certificate (10) - remove password ssl certificate (10) - apache.pem (10) - generate apache pem (9) - +Openssl +apache +remove-password (9) - openssl delete certificate (9) - ssl key without password (9) - apache remove password from cert (9) - removing ssl password (8) - apache remove password certificate (8) - remove password from ssl key file (8) - openssl remove password from cert (8) - openssl apache pem (8) - apache ssl key "remove password" (8) - "remove password from certificate" (8) - apache certificate "no password" (8) - genrsa password (8) - remove ssl cert password (8) - make apache.pem (8) - generate csr no password (8) - f (8) - tag/Solaris (7) - apache ssl start password (7) - openssl create .pem (7) - "apache.pem" (7) - remove password ssl cert (7) - removing password from ssl key (7) - remove certificate password apache (7) - ssl key no password (7) - openssl remove password apache (7) - SSL key remove password (7) - remove password from certificate openssl (7) - openssl remove cert password (7) - apache pem key (7) - all (6) - apache ssl certificate "remove password" (6) - removing password ssl key (6) - apache ssl start without password (6) - remove password certificate openssl (6) - make pem (6) - openssl apache no password (6) - openssl key without password (6) - removing password from ssl cert (6) - start apache ssl password (6) - apache openssl remove password (6) - removing openssl certificate password (6) - apache cert no password (6) - certificate password apache (6) - openssl csr no password (6) - apache ssl cert password (6) - apache restart ssl password (6) - openssl no pass (6) - server (5) - openssl generate (5) - openssl key "change password" (5) - openssl apache.pem (5) - remove password from apache certificate (5) - remove password from certificate apache (5) - remove password from csr (5) - remove password from cert (5) - remove password certificate apache (5) - start apache ssl no password (5) - openssl remove challenge password (5) - apache remove password from key (5) - remove apache SSL password (5) - openssl remove pem password (5) - remove password from pem (5) - openssl generate key without password (5) - "remove password" apache SSL (5) - openssl remove password from keyfile (5) - apache start ssl password (5) - how to remove password from ssl certificate (5) - generating apache.pem (5) - remove password pem file (5) - csr no password (5) - ssl password remove (5) - apache pem password (5) - csr without password (5) - apache start certificate password (5) - apache (4) - openssl apache without password (4) - openssl create (4) - removing password from .pem (4) - apache cert without password (4) - openssl create pem file (4) - ssl remove password from certificate (4) - openssl generate certificate without password (4) - create apache.pem (4) - apache remove ssl password (4) - OpenSSL generate key no password (4) - openssl create key without password (4) - remove openssl certificate password (4) - no password csr (4) - openssl remove password pem (4) - openssl create apache (4) - remove password from apache key (4) - openssl remove password from key (4) - openssl rsa -in server.key -out server.pem (4) - starting apache ssl without password (4) - apache create .pem (4) - remove password from openssl certificate (4) - create pem without password (4) - openssl create without password (4) -