hosted by liquidweb


Go Back   Web Hosting Talk : Web Hosting Main Forums : Hosting Security and Technology : Hosting Security and Technology Tutorials : How to SETUP SSL (Apache + MODSSL)
Reply

Hosting Security and Technology Tutorials Tutorials related to server security or the like.
Forum Jump

How to SETUP SSL (Apache + MODSSL)

Reply Post New Thread In Hosting Security and Technology Tutorials Subscription
 
Send news tip View All Posts Thread Tools Search this Thread Display Modes
  #1  
Old 02-27-2004, 11:29 PM
YUPAPA YUPAPA is offline
Quant Trader
 
Join Date: May 2001
Location: HK
Posts: 2,931
Smile

How to SETUP SSL (Apache + MODSSL)



This Yupapa's Tutorial teaches you how to generate and setup a SSL certificate. ~

Assuming you have apache and openssl installed, you would like to generate and setup an SSL certificate for the domain 'MYdomain.com'


Generating RSA & CSR (Signing Request)
__________________________________________________
[root@yupapa root]#
[root@yupapa root]# cd /etc/httpd/conf/ssl.key


OPTION 1: Generating a RSA private key without a passphrase (ME recommended)
[root@yupapa /etc/httpd/conf/ssl.key]# openssl genrsa -out MYdomain.com.key 1024

OPTION 2: Generating a RSA private key with a passphrase. You will be prompted to enter a passphrase right after you hit enter.
[root@yupapa /etc/httpd/conf/ssl.key]# openssl genrsa -des3 -out MYdomain.com.key 1024

You should NOT generate the RSA private key with a passphrase if you have scripts that restart apache automatically. If you have, then apache just sit there and wait for the script to input the passphrase which is a mess!
There is a method that you can disable the passphrase to prompt when you restart apache which I'll show you later~

Next generate the CSR using the RSA Private Key
[root@yupapa /etc/httpd/conf/ssl.csr]# openssl req -new -key MYdomain.com.key -out MYdomain.com.csr
[root@yupapa /etc/httpd/conf/ssl.csr]# mv MYdomain.com.csr ../ssl.csr

You will be asked to enter your Common Name, Organization, Organization Unit, City or Locality, State or Province and Country.
Do not enter these characters '< > ~ ! @ # $ % ^ * / \ ( ) ?.,&' because they will not be accepted.

Common Name: the domain for the web server (e.g. MYdomain.com)
Organization: the name of your organization (e.g. YUPAPA)
Organization Unit: the section of the organization (e.g. Sales)
City or Locality: the city where your organzation is located (e.g. Flanders)
State or Province: the state / province where your organzation is located (e.g New Jersey)
Country: the country where your organzation is located (e.g US)

You may be asked for emeow address and challenge challenge password. I just hit enter when I generate the csr~

Now you should have:
/etc/httpd/conf/ssl.key/MYdomain.com.key
/etc/httpd/conf/ssl.csr/MYdomain.com.csr

Make a backup copy of your private key! If you lose it, you have to purchase a new cert!

Now you should submit your csr and they will mail you the certificate.




Installing the Certificate for Apache
__________________________________________________
[root@yupapa root]#
[root@yupapa root]# cd /etc/httpd/conf/ssl.crt


Copy the certificate that they mailed you to MYdomain.com.crt
Open your httpd.conf file and place the following to your virtualhost


Code:
<VirtualHost 123.456.789.123:443>
... some config like DocumentRoot , etc..
SSLEngine		on
SSLCertificateFile	/etc/httpd/conf/ssl.crt/MYdomain.com.crt
SSLCertificateKeyFile	/etc/httpd/conf/ssl.key/MYdomain.com.key
</VirtualHost>

Restart apache
OPTION 1 [root@yupapa /etc/httpd/conf/ssl.crt]# apachectl restart
OPTION 2 (using the sh script) [root@yupapa /etc/httpd/conf/ssl.crt]# /etc/rc.d/init.d/httpd restart


You may be asked to enter the passphrase IF you generated the RSA with a passphrase. If you do NOT want to be asked for a passphrase when restarting apache, re-generate your RSA key file.
[root@yupapa /etc/httpd/conf/ssl.crt]# cd ../ssl.key
[root@yupapa /etc/httpd/conf/ssl.key]# mv MYdomain.com.key MYdomain.com.key.has-passphrase
[root@yupapa /etc/httpd/conf/ssl.key]# openssl rsa -in MYdomain.com.key.has-passphrase -out MYdomain.com.key


And then restart apache again

Now you should be able to access https://MYdomain.com ~ And Finally make sure those directories and files are only writable and readable by root!


Last edited by Akash; 03-08-2004 at 06:56 PM.
Reply With Quote


Sponsored Links
  #2  
Old 02-28-2004, 04:29 AM
viGeek viGeek is offline
Russ
 
Join Date: Mar 2002
Location: Philadelphia, PA
Posts: 2,493
Great how-to YUPAPA!


Last edited by Akash; 03-08-2004 at 06:57 PM.
Reply With Quote
  #3  
Old 04-26-2004, 09:36 PM
Mr_Colostomy Mr_Colostomy is offline
New Member
 
Join Date: Apr 2004
Posts: 3
Re: How to SETUP SSL (Apache + MODSSL)

Quote:
Originally posted by YUPAPA
Now you should submit your csr and they will mail you the certificate.
Where/How do I submit it?

Bigtime Thanx
-Colo

P.S. I've also generated the key and csr in webpanel, but when I goto install cert I get....Sorry key not found? I've copied pasted and I realize that I need a crt and not a csr, I just know who to send it to. I know I'm the biggest noob on the board, but I'm at a total loss here.

And what version of Apache? When I tried to enter the SSLEngine On line, I got an error and had to remove it.
Apache Core 1.3.29
mod_ssl 2.8.16 are my versions


Last edited by Mr_Colostomy; 04-26-2004 at 09:47 PM.
Reply With Quote
Sponsored Links
  #4  
Old 05-18-2004, 03:11 PM
stftk stftk is offline
Web Hosting Evangelist
 
Join Date: May 2003
Posts: 472
If you want a verified SSL certificate, you will need to submit your CSR to a signing authority such as Geotrust or freessl. For just $20 you can get a chained SSL cert from www.rackshack.net .

Or you can have it sign itself in which cause you would get a box when going to the page saying this cert is not from a trusted authority.

When you go to setup the SSL cert in your admin panel, copy the CSR into the first box and the CRT into the second box (certificate box).

Reply With Quote
  #5  
Old 08-17-2004, 07:57 PM
tity0505 tity0505 is offline
Newbie
 
Join Date: Mar 2003
Posts: 17
yupapa thanks for the tutorial,
i'm new to this and having trouble installing it for apache, because under the folder i don't have "httpd" folder anywhere

Reply With Quote
  #6  
Old 09-05-2004, 02:09 AM
marshallm marshallm is offline
Newbie
 
Join Date: Aug 2004
Posts: 29
Does anyone know if you can use PGP to create the cert, and then sign it with your company's corporate signing key?

Seems to me that would be the way to go if your company uses PGP.

Thanks!

Reply With Quote
Reply

Related posts from TheWhir.com
Title Type Date Posted
Researchers Urge System Admins to Check for New Apache Web Server Backdoor Malware Web Hosting News 2013-05-01 11:35:53
Apache Web Server Adds Cloud Capabilities with First Major Update in 5 Years Web Hosting News 2012-02-21 16:05:02
The Apache Software Foundation Launches Hadoop v1.0 Web Hosting News 2012-01-05 18:29:16
Oracle is the Latest Vendor to Apply Patch for Apache Killer Flaw Web Hosting News 2011-09-19 14:43:58
Patch Released for Apache Software DDoS Vulnerability Web Hosting News 2011-08-26 15:03:10


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes
Postbit Selector

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump
Login:
Log in with your username and password
Username:
Password:



Forgot Password?
Advertisement:
Web Hosting News:



 

X

Welcome to WebHostingTalk.com

Create your username to jump into the discussion!

WebHostingTalk.com is the largest, most influentual web hosting community on the Internet. Join us by filling in the form below.


(4 digit year)

Already a member?