 |
 |
 |
 |
| Security and Privacy Sadly, malware, spyware, hackers and privacy threats abound in today's world. Let's be paranoid and secure our penguins, and slam the doors on privacy exploits. |

25th January 2006, 10:45 PM
|
|
Registered User
|
|
Join Date: Mar 2005
Posts: 16

|
|
|
Securing Squirrelmail by using https
I was wondering if anybody had any guides to help with securing squirrelmail with https??
Or has anybody had any luck in doing this that would like to share how they accomplished it??
Thanks
Chili
|

26th January 2006, 01:16 AM
|
 |
Registered User
|
|
Join Date: Apr 2005
Location: Chicago, IL, US
Age: 35
Posts: 100

|
|
the best way to do it is by allowing your users to type "http://yourserver.com/webmail" or simply "yourserver.com/webmail" and having apache rewrite the plain http:// address into an "https://" address. in your /etc/httpd/conf/httpd.conf, you will need:
Code:
# Rewrite Engine
RewriteEngine On
# Rewrite HTTP requests to HTTPS for secured areas
RewriteCond %{HTTPS} !=on
RewriteRule ^/webmail/(.*)$ https://yourserver.com/webmail/$1 [R=301,L]
Make sure that you remove the "squirrelmail.conf" file from your /etc/httpd/conf.d directory.
Then in your /etc/httpd/conf.d/ssl.conf, you will need:
Code:
# --- SquirrelMail Configuration --- #
Alias /webmail /usr/share/squirrelmail
<Directory /usr/share/squirrelmail>
Options FollowSymLinks
AllowOverride None
Order allow,deny
Allow from all
</Directory>
What this all does is make it that your server doesn't really offer the /webmail alias from the http port, but only through your https port, but it will allow your users to simply type "yourserver.com/webmail" in their address bars so they don't have to type out the https:// thing each time. your server will then rewrite their requests into secure requests that can then be served by your ssl virtual host.
|

26th January 2006, 03:28 AM
|
|
Registered User
|
|
Join Date: Mar 2005
Posts: 16

|
|
|
Thanks for the help. I will give it a shot and post the results!!
|

26th January 2006, 10:12 PM
|
|
Registered User
|
|
Join Date: Mar 2005
Posts: 16

|
|
That did kind of work. The good news is if I type mail.mydomain.com/webmail, it automatically redirects to https and the login works for HTTPS. What I was hoping for was I just type in mail.mydomain.com and it redirects from there. Here are some of my configs:
/etc/httpd/conf/hppd.conf
Code:
# Redirect allows you to tell clients about documents which used to exist in
# your server's namespace, but do not anymore. This allows you to tell the
# clients where to look for the relocated document.
# Example:
Redirect permanent /squirrelmail https://mail.mydomain.com/squirrelmail
<VirtualHost *:80>
ServerName mail.mydomain.com
DocumentRoot /usr/share/squirrelmail
</VirtualHost>
# Rewrite Engine
RewriteEngine On
# Rewrite HTTP requests to HTTPS for secured areas
RewriteCond %{HTTPS} !=on
RewriteRule ^/squirrelmail/(.*)$ https://www.mydomain.com/webmail/$1 [R=301,L]
/etc/httpd/conf.d/ssl.conf
Code:
# Do NOT simply read the instructions in here without understanding
# what they do. They're here only as hints or reminders. If you are unsure
# consult the online docs. You have been warned.
#
LoadModule ssl_module modules/mod_ssl.so
# Until documentation is completed, please check http://www.modssl.org/
# for additional config examples and module docmentation. Directives
# and features of mod_ssl are largely unchanged from the mod_ssl project
# for Apache 1.3.
#
# When we also provide SSL we have to listen to the
# standard HTTP port (see above) and to the HTTPS port
#
Listen 443
##
## SSL Global Context
##
## All SSL configuration in this context applies both to
## the main server and all SSL-enabled virtual hosts.
##
#
# Some MIME-types for downloading Certificates and CRLs
#
AddType application/x-x509-ca-cert .crt
AddType application/x-pkcs7-crl .crl
# Pass Phrase Dialog:
# Configure the pass phrase gathering process.
# The filtering dialog program (`builtin' is a internal
# terminal dialog) has to provide the pass phrase on stdout.
SSLPassPhraseDialog builtin
# Inter-Process Session Cache:
# Configure the SSL Session Cache: First the mechanism
# to use and second the expiring timeout (in seconds).
#SSLSessionCache dc:UNIX:/var/cache/mod_ssl/distcache
SSLSessionCache shmcb:/var/cache/mod_ssl/scache(512000)
SSLSessionCacheTimeout 300
# Semaphore:
# Configure the path to the mutual exclusion semaphore the
# SSL engine uses internally for inter-process synchronization.
SSLMutex default
# Pseudo Random Number Generator (PRNG):
# Configure one or more sources to seed the PRNG of the
# SSL library. The seed data should be of good random quality.
# WARNING! On some platforms /dev/random blocks if not enough entropy
# is available. This means you then cannot use the /dev/random device
# because it would lead to very long connection times (as long as
# it requires to make more entropy available). But usually those
# platforms additionally provide a /dev/urandom device which doesn't
# block. So, if available, use this one instead. Read the mod_ssl User
# Manual for more details.
SSLRandomSeed startup file:/dev/urandom 256
SSLRandomSeed connect builtin
#SSLRandomSeed startup file:/dev/random 512
#SSLRandomSeed connect file:/dev/random 512
#SSLRandomSeed connect file:/dev/urandom 512
#
# Use "SSLCryptoDevice" to enable any supported hardware
# accelerators. Use "openssl engine -v" to list supported
# engine names. NOTE: If you enable an accelerator and the
# server does not start, consult the error logs and ensure
# your accelerator is functioning properly.
#
SSLCryptoDevice builtin
#SSLCryptoDevice ubsec
##
## SSL Virtual Host Context
##
<VirtualHost _default_:443>
# General setup for the virtual host, inherited from global configuration
#DocumentRoot "/var/www/html"
ServerName mail.mydomain.com:443
# Use separate log files for the SSL virtual host; note that LogLevel
# is not inherited from httpd.conf.
ErrorLog logs/ssl_error_log
TransferLog logs/ssl_access_log
LogLevel warn
# SSL Engine Switch:
# Enable/Disable SSL for this virtual host.
SSLEngine on
# SSL Cipher Suite:
# List the ciphers that the client is permitted to negotiate.
# See the mod_ssl documentation for a complete list.
SSLCipherSuite ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP
# 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/localhost.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/localhost.key
# Server Certificate Chain:
# Point SSLCertificateChainFile at a file containing the
# concatenation of PEM encoded CA certificates which form the
# certificate chain for the server certificate. Alternatively
# the referenced file can be the same as SSLCertificateFile
# when the CA certificates are directly appended to the server
# certificate for convinience.
#SSLCertificateChainFile /etc/pki/tls/certs/server-chain.crt
# Certificate Authority (CA):
# Set the CA certificate verification path where to find CA
# certificates for client authentication or alternatively one
# huge file containing all of them (file must be PEM encoded)
#SSLCACertificateFile /etc/pki/tls/certs/ca-bundle.crt
# SSL Engine Options:
# Set various options for the SSL engine.
# o FakeBasicAuth:
# Translate the client X.509 into a Basic Authorisation. This means that
# the standard Auth/DBMAuth methods can be used for access control. The
# user name is the `one line' version of the client's X.509 certificate.
# Note that no password is obtained from the user. Every entry in the user
# file needs this password: `xxj31ZMTZzkVA'.
# o ExportCertData:
# This exports two additional environment variables: SSL_CLIENT_CERT and
# SSL_SERVER_CERT. These contain the PEM-encoded certificates of the
# server (always existing) and the client (only existing when client
# authentication is used). This can be used to import the certificates
# into CGI scripts.
# o StdEnvVars:
# This exports the standard SSL/TLS related `SSL_*' environment variables.
# Per default this exportation is switched off for performance reasons,
# because the extraction step is an expensive operation and is usually
# useless for serving static content. So one usually enables the
# exportation for CGI and SSI requests only.
# o StrictRequire:
# This denies access when "SSLRequireSSL" or "SSLRequire" applied even
# under a "Satisfy any" situation, i.e. when it applies access is denied
# and no other module can change it.
# o OptRenegotiate:
# This enables optimized SSL connection renegotiation handling when SSL
# directives are used in per-directory context.
#SSLOptions +FakeBasicAuth +ExportCertData +StrictRequire
<Files ~ "\.(cgi|shtml|phtml|php3?)$">
SSLOptions +StdEnvVars
</Files>
<Directory "/var/www/cgi-bin">
SSLOptions +StdEnvVars
</Directory>
# SSL Protocol Adjustments:
# The safe and default but still SSL/TLS standard compliant shutdown
# approach is that mod_ssl sends the close notify alert but doesn't wait for
# the close notify alert from client. When you need a different shutdown
# approach you can use one of the following variables:
# o ssl-unclean-shutdown:
# This forces an unclean shutdown when the connection is closed, i.e. no
# SSL close notify alert is send or allowed to received. This violates
# the SSL/TLS standard but is needed for some brain-dead browsers. Use
# this when you receive I/O errors because of the standard approach where
# mod_ssl sends the close notify alert.
# o ssl-accurate-shutdown:
# This forces an accurate shutdown when the connection is closed, i.e. a
# SSL close notify alert is send and mod_ssl waits for the close notify
# alert of the client. This is 100% SSL/TLS standard compliant, but in
# practice often causes hanging connections with brain-dead browsers. Use
# this only for browsers where you know that their SSL implementation
# works correctly.
# Notice: Most problems of broken clients are also related to the HTTP
# keep-alive facility, so you usually additionally want to disable
# keep-alive for those clients, too. Use variable "nokeepalive" for this.
# Similarly, one has to force some clients to use HTTP/1.0 to workaround
# their broken HTTP/1.1 implementation. Use variables "downgrade-1.0" and
# "force-response-1.0" for this.
SetEnvIf User-Agent ".*MSIE.*" \
nokeepalive ssl-unclean-shutdown \
downgrade-1.0 force-response-1.0
# Per-Server Logging:
# The home of a custom SSL log file. Use this when you want a
# compact non-error SSL logfile on a virtual host basis.
CustomLog logs/ssl_request_log \
"%t %h %{SSL_PROTOCOL}x %{SSL_CIPHER}x \"%r\" %b"
</VirtualHost>
if you need anything else let me know!!
|

26th January 2006, 11:35 PM
|
 |
Registered User
|
|
Join Date: Apr 2005
Location: Chicago, IL, US
Age: 35
Posts: 100

|
|
|
whatever works for you, sir. it is your system. but now your users have to type "mail.mydomain.com/squirrelmail" which is way more characters than yourdomain.com/webmail" and people frequently misspell "squirrel"
but i am glad you got it going.
|

27th January 2006, 02:19 PM
|
 |
Registered User
|
|
Join Date: Nov 2005
Location: France - Lille
Posts: 406

|
|
Hi,
if you put a index page which redirect to the webmail dir in the doc root, they will be redirect automatically...
Or modify your Rewrite Rule...
__________________
My WebPage
RHCT for the moment !
|

14th February 2006, 03:54 AM
|
 |
Registered User
|
|
Join Date: Apr 2004
Posts: 1,186

|
|
hey guys! I just installed squirrelmail and got it all setup and happy. now i want to use ssl
so i followed the steps above and when i attempt to go to the http://myhost.com/webmail it goes to https but just sits forever and ever and then times out
I copied and pasted the config stuff from amessina into my configs (editing for my system of course) then restarted apache
it never actually loads the page.
https is open on port 443
my router is forwarding 443:tcp to my server
and i have even turned off all my firewalls
what am i missing??
|

14th February 2006, 10:11 AM
|
 |
Registered User
|
|
Join Date: Apr 2005
Location: Chicago, IL, US
Age: 35
Posts: 100

|
|
|
what do your apache ssl logs say?
|

14th February 2006, 10:45 AM
|
 |
Registered User
|
|
Join Date: Nov 2005
Location: France - Lille
Posts: 406

|
|
Quote:
|
Originally Posted by amessina
what do your apache ssl logs say?
|
Yep, check the ssl logs !!!
__________________
My WebPage
RHCT for the moment !
|

22nd August 2006, 09:59 PM
|
|
Registered User
|
|
Join Date: Aug 2005
Location: Portland, Oregon
Age: 33
Posts: 32

|
|
|
I used these instructions and it worked great. Only my the webmail part of my website is ssl, the rest unsecured.
|

23rd August 2006, 09:42 AM
|
 |
Registered User
|
|
Join Date: Nov 2005
Location: France - Lille
Posts: 406

|
|
Quote:
|
Originally Posted by Coarch
I used these instructions and it worked great. Only my the webmail part of my website is ssl, the rest unsecured.
|
Code:
# Rewrite Engine
RewriteEngine On
# Rewrite HTTP requests to HTTPS for secured areas
RewriteCond %{HTTPS} !=on
RewriteRule ^/(.*)$ https://yourserver.com/webmail/$1 [R=301,L]
__________________
My WebPage
RHCT for the moment !
|

2nd October 2006, 09:46 AM
|
 |
Registered User
|
|
Join Date: Oct 2004
Location: Leicester (UK)
Age: 43
Posts: 33

|
|
|
Hi
Can anyone tell me how to integrate this into virtual hosts? I have a single ip & need to host at least 2 websites while keeping Squirrelmail secure (Squirrelmail will only be used for 1 site).
farmorg
__________________
We are Linux users, you will be assimilated - resistance is futile.
|

2nd October 2006, 06:18 PM
|
 |
Registered User
|
|
Join Date: Oct 2004
Location: Leicester (UK)
Age: 43
Posts: 33

|
|
|
Ooops, sorry ppl, I didn't look very closely did I!
__________________
We are Linux users, you will be assimilated - resistance is futile.
|

3rd April 2008, 05:22 AM
|
 |
Registered User
|
|
Join Date: Jul 2006
Location: Sao Paulo, SP - Brazil
Age: 33
Posts: 698

|
|
Quote:
|
Originally Posted by amessina
the best way to do it is by allowing your users to type "http://yourserver.com/webmail" or simply "yourserver.com/webmail" and having apache rewrite the plain http:// address into an "https://" address. in your /etc/httpd/conf/httpd.conf, you will need:
Code:
# Rewrite Engine
RewriteEngine On
# Rewrite HTTP requests to HTTPS for secured areas
RewriteCond %{HTTPS} !=on
RewriteRule ^/webmail/(.*)$ https://yourserver.com/webmail/$1 [R=301,L]
Make sure that you remove the "squirrelmail.conf" file from your /etc/httpd/conf.d directory.
Then in your /etc/httpd/conf.d/ssl.conf, you will need:
Code:
# --- SquirrelMail Configuration --- #
Alias /webmail /usr/share/squirrelmail
<Directory /usr/share/squirrelmail>
Options FollowSymLinks
AllowOverride None
Order allow,deny
Allow from all
</Directory>
What this all does is make it that your server doesn't really offer the /webmail alias from the http port, but only through your https port, but it will allow your users to simply type "yourserver.com/webmail" in their address bars so they don't have to type out the https:// thing each time. your server will then rewrite their requests into secure requests that can then be served by your ssl virtual host.
|
This solution works great. But it seems to convert every address to https. What if I wanted to convert just the /webmail and leave the rest alone? Is it possible?
Thanks a lot!
EDIT: FORGET IT. NOW I SEE MY ERROR. SORRY!
Last edited by Duli; 3rd April 2008 at 05:26 AM.
|

3rd April 2008, 12:19 PM
|
 |
Registered User
|
|
Join Date: Apr 2005
Location: Chicago, IL, US
Age: 35
Posts: 100

|
|
|
# Rewrite HTTP requests to HTTPS for secured areas
RewriteCond %{HTTPS} !=on
RewriteRule ^/webmail/(.*)$ https://yourserver.com/webmail/$1 [R=301,L]
says that locations that start with "/webmail/" should be redirected to https. i'm not sure what you mean when you say that it converts "every address to https"
|
| Thread Tools |
Search this Thread |
|
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
Similar Threads
|
| Thread |
Thread Starter |
Forum |
Replies |
Last Post |
|
Securing a VPS
|
eXDee |
Security and Privacy |
12 |
23rd September 2009 08:41 PM |
|
Securing PHP
|
arimakidd |
Servers & Networking |
1 |
13th November 2007 07:56 AM |
|
Need help in securing /tmp
|
beyond |
Security and Privacy |
15 |
1st March 2005 01:45 PM |
Current GMT-time: 23:59 (Saturday, 25-05-2013)
|
|
 |
 |
 |
 |
|
|