Fedora Linux Support Community & Resources Center

Go Back   FedoraForum.org > Fedora 17/18 > Servers & Networking
FedoraForum Search

Forgot Password? Join Us!

Servers & Networking Discuss any Fedora server problems and Networking issues such as dhcp, IP numbers, wlan, modems, etc.

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 28th December 2009, 10:59 PM
johannlo's Avatar
johannlo Offline
Registered User
 
Join Date: Jul 2005
Location: Melbourne, Australia
Age: 33
Posts: 762
windows_xp_2003firefox
Anyone got a good guide to enabling https on apache2?

I've got a basic apache2 setup running w/ multiple virtual hosts, would like to try SSL (i.e. https).

I've got the IP networking side well and truly sorted but I need guidance on the apache/ssl config side. I have installed mod_ssl.

Does anyone have a good guide for Fedora that's recent? All I can find are ubuntu and old fedora 'core' guides, so not sure how much applies to F12. The best ones I can find so far is

https://help.ubuntu.com/community/fo...er/apache2/SSL

http://httpd.apache.org/docs/2.0/ssl/ssl_howto.html

Any help appreciated. Specifically I'm looking for

- generating SSL cert - also I assume this is different from my SSH keys?
- httpd.conf editing required.

cheers
__________________
the phases of 'nix troubleshooting

For :eek:
:confused: | google > :D
Next

Last edited by johannlo; 28th December 2009 at 11:07 PM.
Reply With Quote
  #2  
Old 28th December 2009, 11:26 PM
leigh123linux's Avatar
leigh123linux Offline
Retired Administrator
 
Join Date: Oct 2006
Posts: 21,509
linuxfedorafirefox
Try this

http://forums.fedoraforum.org/showthread.php?t=94257
Reply With Quote
  #3  
Old 29th December 2009, 01:35 AM
johannlo's Avatar
johannlo Offline
Registered User
 
Join Date: Jul 2005
Location: Melbourne, Australia
Age: 33
Posts: 762
windows_xp_2003firefox
Thanks, note that guide has some out of date paths for the certificate gen bit, specifically this is what I had to change

openssl rsa -in temp.key -out /etc/pki/tls/private/genie.key
openssl req -new -key /etc/pki/tls/private/genie.key -x509 -out genie.crt -days 365
rm ./temp.key
chmod 600 /etc/pki/tls/private/genie.key /etc/pki/tls/certs/genie.crt



After I do this, for the httpd.conf bit, do I just add a new virtualhost pointing to *:443?

Or do I do this in the ssl.conf file? The guides I'm reading are not clear unfortunately
__________________
the phases of 'nix troubleshooting

For :eek:
:confused: | google > :D
Next

Last edited by johannlo; 29th December 2009 at 01:37 AM.
Reply With Quote
  #4  
Old 29th December 2009, 02:15 AM
leigh123linux's Avatar
leigh123linux Offline
Retired Administrator
 
Join Date: Oct 2006
Posts: 21,509
linuxfedorafirefox
Quote:
Originally Posted by johannlo View Post
Thanks, note that guide has some out of date paths for the certificate gen bit, specifically this is what I had to change

openssl rsa -in temp.key -out /etc/pki/tls/private/genie.key
openssl req -new -key /etc/pki/tls/private/genie.key -x509 -out genie.crt -days 365
rm ./temp.key
chmod 600 /etc/pki/tls/private/genie.key /etc/pki/tls/certs/genie.crt



After I do this, for the httpd.conf bit, do I just add a new virtualhost pointing to *:443?

Or do I do this in the ssl.conf file? The guides I'm reading are not clear unfortunately

Just edit /etc/httpd/conf.d/ssl.conf and open port 443 in your firewall config.

Quote:
Change your_hostname for your real hostname. All that's left is to edit /etc/httpd/conf.d/ssl.conf and change the certificates to use your_hostname.crt and your_hostname.key
Reply With Quote
  #5  
Old 29th December 2009, 02:17 AM
johannlo's Avatar
johannlo Offline
Registered User
 
Join Date: Jul 2005
Location: Melbourne, Australia
Age: 33
Posts: 762
windows_xp_2003firefox
Thanks, I did all that (pointing ssl.conf to my key names) but still no dice.

My httpd.conf is far from out of the box though as I have been mucking around w/ virtual servers and such, also there is no entry corresponding to *, its all *:80 so I will go down that path (ie creating a virtual server on *.443). I was more wondering if there were additional lines required as well like 'ENABLE MOD_SSL' or something similar.
__________________
the phases of 'nix troubleshooting

For :eek:
:confused: | google > :D
Next
Reply With Quote
  #6  
Old 29th December 2009, 02:44 AM
leigh123linux's Avatar
leigh123linux Offline
Retired Administrator
 
Join Date: Oct 2006
Posts: 21,509
linuxfedorafirefox
Well I have just ran through the commands and it works ok here.



Code:
yum install httpd system-config-httpd mod_ssl
chkconfig httpd on
cd /etc/pki/tls/certs/
openssl genrsa -aes256 -out temp.key 2048
openssl rsa -in temp.key -out ../private/leigh123.homelinux.com.key
openssl req -new -key ../private/leigh123.homelinux.com.key  -x509 -out leigh123.homelinux.com.crt -days 365
rm ./temp.key
chmod 600 ../private/leigh123.homelinux.com.key leigh123.homelinux.com.crt
nano /etc/httpd/conf.d/ssl.conf
and change ssl.conf ( part of file displayed ) to


Code:
SSLCipherSuite ALL:!ADH:!EXPORT:!SSLv2:RC4+RSA:+HIGH:+MEDIUM:+LOW

#   Server Certificate:
# Point SSLCertificateFile at a PEM encoded certificate.  If
# the certificate is encrypted, then you will be prompted for a
# pass phrase.  Note that a kill -HUP will prompt again.  A new
# certificate can be generated using the genkey(1) command.
SSLCertificateFile /etc/pki/tls/certs/leigh123.homelinux.com.crt

#   Server Private Key:
#   If the key is not combined with the certificate, use this
#   directive to point at the key file.  Keep in mind that if
#   you've both a RSA and a DSA private key you can configure
#   both in parallel (to also allow the use of DSA ciphers, etc.)
SSLCertificateKeyFile /etc/pki/tls/private/leigh123.homelinux.com.key

#   Server Certificate Chain:
And to finish it

Code:
service httpd restart
Reply With Quote
  #7  
Old 29th December 2009, 02:55 AM
Firewing1's Avatar
Firewing1 Offline
Administrator
 
Join Date: Dec 2004
Location: Canada
Age: 22
Posts: 9,224
macossafari
Quote:
Originally Posted by johannlo View Post
Thanks, note that guide has some out of date paths for the certificate gen bit, specifically this is what I had to change

openssl rsa -in temp.key -out /etc/pki/tls/private/genie.key
openssl req -new -key /etc/pki/tls/private/genie.key -x509 -out genie.crt -days 365
rm ./temp.key
chmod 600 /etc/pki/tls/private/genie.key /etc/pki/tls/certs/genie.crt



After I do this, for the httpd.conf bit, do I just add a new virtualhost pointing to *:443?

Or do I do this in the ssl.conf file? The guides I'm reading are not clear unfortunately
This is the kind of think I wish people PM'd me about more often... I'll update the guide later today
__________________
[+] My open source software and blog
[+] Some of my howtos: (for full list, click here)
Reply With Quote
  #8  
Old 29th December 2009, 07:18 AM
johannlo's Avatar
johannlo Offline
Registered User
 
Join Date: Jul 2005
Location: Melbourne, Australia
Age: 33
Posts: 762
windows_vistafirefox
OK I fixed it, I had to move my virtual hosts over to the ssl.conf file instead of the main httpd.conf

Now I have a more annoying question: how do I do it so some virtual hosts are accessible via port 80 and others ONLY via 443?

I've turned off port 80 en masse in httpd.conf for now but I want my virtual host in httpd.conf to be accessible via port 80.

If I leave port 80 on, I seem to be able to get to my other virtual host even though its only in the ssl.conf file. It must be the defaults for httpd.conf to allow access to the entire /var/www/html - how do I block this off?

---------- Post added at 11:18 PM CST ---------- Previous post was at 11:12 PM CST ----------

OK I'm an idiot I answered my own question.

My fix: put 'allow none' in the default httpd.conf, and then set up a separate virtual host allowing only the desired servername.


You see, I have my ISP's 'default' DNS name (i have static IP) on my private pages, which enable me to control my bittorrent/usenet via http. I also stream music via ampache. Obviously this I want to keep private.

I also have a DNS name held separately that is the one I publicly give out, that only points to the 'public' section of my server. Hence why I wanted this config.

Thanks leigh and firewing for your help (how do you guys find the time?!?!)
__________________
the phases of 'nix troubleshooting

For :eek:
:confused: | google > :D
Next
Reply With Quote
Reply

Tags
apache2, enabling, good, guide, https

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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

Similar Threads
Thread Thread Starter Forum Replies Last Post
Audio Skipping: Followed Silpheed2K's guide to no good avail bdiddy Using Fedora 0 9th November 2009 03:03 AM
Help w/ enabling HTTPS johannlo Servers & Networking 0 24th July 2009 10:26 AM
Good LDAP Guide recommendation davecgs Servers & Networking 7 27th February 2009 05:34 PM
need good guide for update FC3->Fc6 Wolle Installation and Live Media 1 18th March 2007 03:14 PM
FC4 Apache2 PHP5 enabling debug messages Tekifuku Servers & Networking 0 5th June 2006 05:55 AM


Current GMT-time: 22:14 (Saturday, 25-05-2013)

TopSubscribe to XML RSS for all Threads in all ForumsFedoraForumDotOrg Archive
logo

All trademarks, and forum posts in this site are property of their respective owner(s).
FedoraForum.org is privately owned and is not directly sponsored by the Fedora Project or Red Hat, Inc.

Privacy Policy | Term of Use | Posting Guidelines | Archive | Contact Us | Founding Members

Powered by vBulletin® Copyright ©2000 - 2012, vBulletin Solutions, Inc.

FedoraForum is Powered by RedHat