<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Caneblu.com &#187; ssl</title>
	<atom:link href="http://www.caneblu.com/tag/ssl/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.caneblu.com</link>
	<description>Solo un altro blog targato WordPress</description>
	<lastBuildDate>Mon, 10 May 2010 20:32:40 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Protect OWA with Apache proxy</title>
		<link>http://www.caneblu.com/2009/01/protect-owa-with-apache-proxy/</link>
		<comments>http://www.caneblu.com/2009/01/protect-owa-with-apache-proxy/#comments</comments>
		<pubDate>Thu, 15 Jan 2009 14:47:03 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Apache]]></category>
		<category><![CDATA[howto]]></category>
		<category><![CDATA[mod_proxy]]></category>
		<category><![CDATA[outlook web access]]></category>
		<category><![CDATA[owa]]></category>
		<category><![CDATA[proxy]]></category>
		<category><![CDATA[ssl]]></category>

		<guid isPermaLink="false">http://www.caneblu.com/?p=60</guid>
		<description><![CDATA[OWA, [outlook web access] is a webmail interface of Exchange server. Run on IIS server and for this and other reasons (you can find several worms and exploits warnings) is not a good idea to expose webmail and consequently the mail server, to Internet. Microsoft sell ISA [Internet Security Access] a firewall and proxy software. [...]]]></description>
			<content:encoded><![CDATA[<p>OWA, [outlook web access] is a webmail interface of Exchange server. Run on IIS server and for this and other reasons (you can find several worms and exploits warnings) is not a good idea to expose webmail and consequently the mail server, to Internet. Microsoft sell ISA [Internet Security Access] a firewall and proxy software.</p>
<p>But there is a cheap solution using Apache 2.0 and mod_ssl plus mod_proxy, this article explain step by step how to make a protection of OWA. Also we need a self-signed or valid certificate in PEM format for SSL encryption. In OWA there is no need https.</p>
<p>We stick some information, 192.168.0.100 is the Exchange Server called <strong>exchange.lan</strong><br />
192.168.0.50  is the proxy Apache accessible from internet at ip a.b.c.d. with external DNS resolved as  <strong>webmail.mydomain.com</strong></p>
<p>Let&#8217;s start configure mod_ssl and mod_proxy on Apache web server, first we check if you have already installed this modules.<br />
From command line put this command<strong>: a2enmod -l</strong></p>
<p>The result will be similar to</p>
<p><em>actions alias auth_basic authn_file authz_host authz_groupfile authz_default authz_user authn_dbm autoindex cgi dir env expires include log_config mime negotiation setenvif ssl suexec userdir php5 proxy headers proxy_http proxy_ftp proxy_connect</em></p>
<p>The goal is to obtain in list the following loaded modules: <strong>ssl, proxy, proxy_http, proxy_connect and headers</strong></p>
<p>with command <strong>a2enmod -q ssl</strong> a2enmod -q proxy etc you add automatically the modules (usually this modules are provided with Apache package) as a load module when Apache webserver starts.</p>
<p>In SuSE Enterprise we have also changed the directive APACHE_SERVER_FLAGS with the parameters &#8220;SSL !NOSSL&#8221;. The directive can be changed within Yast -&gt; System -&gt;Config Editor, Network/WWW  or directly to \etc\sysconfig\apache2 file.</p>
<p>Now second step is made appropriate changes in Apache configuration, with virtual host.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
</pre></td><td class="code"><pre class="apache" style="font-family:monospace;">&nbsp;
&lt;pre lang=<span style="color: #7f007f;">&quot;apache&quot;</span> line=<span style="color: #7f007f;">&quot;1&quot;</span>&gt;
&nbsp;
&lt;<span style="color: #000000; font-weight:bold;">IfDefine</span> SSL&gt;
&lt;<span style="color: #000000; font-weight:bold;">IfDefine</span> !NOSSL&gt;
&nbsp;
&lt;<span style="color: #000000; font-weight:bold;">VirtualHost</span> *:<span style="color: #ff0000;">443</span>&gt;
&nbsp;
<span style="color: #00007f;">DocumentRoot</span> <span style="color: #7f007f;">&quot;/srv/www/htdocs&quot;</span>
<span style="color: #00007f;">ServerName</span> webmail.mydomain.com
RequestHeader set Front-End-Https <span style="color: #7f007f;">&quot;On&quot;</span>
<span style="color: #00007f;">ProxyRequests</span> <span style="color: #0000ff;">Off</span>
ProxyPreserveHost <span style="color: #0000ff;">On</span>
<span style="color: #00007f;">ServerAdmin</span> support@mydomain.com
<span style="color: #00007f;">ErrorLog</span> /var/log/apache2/webmailssl_error_log
<span style="color: #00007f;">TransferLog</span> /var/log/apache2/webmailssl_access_log
<span style="color: #00007f;">CustomLog</span> /var/log/apache2/ssl_request_log   ssl_combined
&nbsp;
SSLEngine <span style="color: #0000ff;">on</span>
SSLCipherSuite <span style="color: #00007f;">ALL</span>:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP:+eNULL
&nbsp;
SSLCertificateFile /etc/apache2/ssl.crt/owaserver.crt
SSLCertificateKeyFile /etc/apache2/ssl.key/owaserver.key
&nbsp;
<span style="color: #00007f;">SetEnvIf</span> User-Agent <span style="color: #7f007f;">&quot;.*MSIE.*&quot;</span> \
	 <span style="color: #0000ff;">nokeepalive</span> ssl-unclean-shutdown \
	 downgrade-<span style="color: #ff0000;">1.0</span> force-response-<span style="color: #ff0000;">1.0</span>
&nbsp;
&lt;<span style="color: #000000; font-weight:bold;">Location</span> /exchange&gt;
<span style="color: #00007f;">ProxyPass</span>  http://webmail.mydomain.com/exchange
<span style="color: #00007f;">ProxyPassReverse</span> http://webmail.mydomain.com/exchange
<span style="color: #00007f;">SetEnv</span> force-proxy-request-<span style="color: #ff0000;">1.0</span> <span style="color: #ff0000;">1</span>
<span style="color: #00007f;">SetEnv</span> proxy-<span style="color: #0000ff;">nokeepalive</span> <span style="color: #ff0000;">1</span>
SSLRequireSSL
&lt;/<span style="color: #000000; font-weight:bold;">Location</span>&gt;
&nbsp;
&lt;<span style="color: #000000; font-weight:bold;">Location</span> /exchweb&gt;
<span style="color: #00007f;">ProxyPass</span> http://webmail.mydomain.com/exchweb
<span style="color: #00007f;">ProxyPassReverse</span> http://webmail.mydomain.com/exchweb
<span style="color: #00007f;">SetEnv</span> force-proxy-request-<span style="color: #ff0000;">1.0</span> <span style="color: #ff0000;">1</span>
<span style="color: #00007f;">SetEnv</span> proxy-<span style="color: #0000ff;">nokeepalive</span> <span style="color: #ff0000;">1</span>
SSLRequireSSL
&lt;/<span style="color: #000000; font-weight:bold;">Location</span>&gt;
&nbsp;
&lt;<span style="color: #000000; font-weight:bold;">Location</span> /public&gt;
<span style="color: #00007f;">ProxyPass</span> http://webmail.mydomain.com/public
<span style="color: #00007f;">ProxyPassReverse</span> http://webmail.mydomain.com/public
<span style="color: #00007f;">SetEnv</span> force-proxy-request-<span style="color: #ff0000;">1.0</span> <span style="color: #ff0000;">1</span>
<span style="color: #00007f;">SetEnv</span> proxy-<span style="color: #0000ff;">nokeepalive</span> <span style="color: #ff0000;">1</span>
SSLRequireSSL
&lt;/<span style="color: #000000; font-weight:bold;">Location</span>&gt;
&nbsp;
&lt;/<span style="color: #000000; font-weight:bold;">VirtualHost</span>&gt;                                  
&nbsp;
&lt;/<span style="color: #000000; font-weight:bold;">IfDefine</span>&gt;
&lt;/<span style="color: #000000; font-weight:bold;">IfDefine</span>&gt;</pre></td></tr></table></div>

</pre>
<p><em>ProxyPreserveHost</em> pass the original host header supplied by client to the server (exchange)<br />
<em>RequestHeader</em> force to use the https:// instead of http:// is required for terminated the request SSL tunnel at reverse proxy and using clear HTTP text between the proxy and OWA<br />
<em>SSLcertificate</em> files (.crt and .key PEM format) require a certificate self-signed or buy from organizations because client authentication is passed in clear to OWA, and this is a best practice for encrypt authentication between client and proxy.</p>
<p>Now the directive most interesting:</p>

<div class="wp_syntax"><div class="code"><pre class="apache" style="font-family:monospace;">&nbsp;
&lt;<span style="color: #000000; font-weight:bold;">Location</span> /exchange&gt;
<span style="color: #00007f;">ProxyPass</span>  http://webmail.mydomain.com/exchange
<span style="color: #00007f;">ProxyPassReverse</span> http://webmail.mydomain.com/exchange
<span style="color: #00007f;">SetEnv</span> force-proxy-request-<span style="color: #ff0000;">1.0</span> <span style="color: #ff0000;">1</span>
<span style="color: #00007f;">SetEnv</span> proxy-<span style="color: #0000ff;">nokeepalive</span> <span style="color: #ff0000;">1</span>
SSLRequireSSL
&lt;/<span style="color: #000000; font-weight:bold;">Location</span>&gt;</pre></div></div>

<p>for OWA we need to proxy /exchange /exchweb and /public.<br />
With SetEnv force-proxy-request-1.0 and SetEnv proxy-nokeepalive you can bypass some troubles as reported on Apache documentation</p>
<blockquote><p>[Protocol Adjustments]<br />
<a rel="nofollow" href="http://httpd.apache.org/docs/2.2/mod/mod_proxy.html" target="_blank">http://httpd.apache.org/docs/2.2/mod/mod_proxy.html</a></p>
<p>For circumstances where you have a application server which doesn't<br />
implement keepalives or HTTP/1.1 properly, there are 2 environment<br />
variables which when set send a HTTP/1.0 with no keepalive. These are set<br />
via the SetEnv directive.</p></blockquote>
<p>Now we have only tell on proxy server where is webmail.mydomain.com. Open your /etc/hosts files and append at the end of file</p>
<p>192.168.0.100 webmail.mydomain.com</p>
<p>All is done, start your Apache webserver and connect (from outside) to your https://webmail.mydomain.com/exchange if all are ok you must see a popup requesting credentials.</p>
<p>Finally a little tricky, if you want redirect your users from http://mydomain.com to https://mydomain.com/exchange you can use into your virtual host directive this configuration. Simply change the <em>RedirectMatch </em>directive as your needs.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
</pre></td><td class="code"><pre class="apache" style="font-family:monospace;">&nbsp;
&lt;<span style="color: #000000; font-weight:bold;">VirtualHost</span> *:<span style="color: #ff0000;">80</span>&gt;
    <span style="color: #00007f;">ServerAdmin</span> support@mydomain.com
    <span style="color: #00007f;">ServerName</span> webmail.mydomain.com
    <span style="color: #00007f;">ErrorLog</span> /var/log/apache2/webmail.error_log
    <span style="color: #00007f;">CustomLog</span> /var/log/apache2/webmail.access_log combined
    <span style="color: #00007f;">ServerSignature</span> <span style="color: #0000ff;">On</span>
&nbsp;
    <span style="color: #00007f;">RedirectMatch</span> permanent /$ https://webmail.mydomain.com/exchange
    <span style="color: #00007f;">RedirectMatch</span> permanent (/.*) https://webmail.mydomain.com$<span style="color: #ff0000;">1</span>
&nbsp;
&lt;/<span style="color: #000000; font-weight:bold;">VirtualHost</span>&gt;</pre></td></tr></table></div>

]]></content:encoded>
			<wfw:commentRss>http://www.caneblu.com/2009/01/protect-owa-with-apache-proxy/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
