Konfigurieren von Debian+Apache als OWA-Reverse-Proxy in der DMZ
Wenn wir eine Exchange-Installation haben und OWA im Ausland veröffentlichen möchten, Wir sollten die Ports niemals direkt zu unserer Börse öffnen, dafür gibt es Proxys in der DMZ, die uns unsere OWA präsentieren werden. In diesem Fall werden wir einen Reverse Proxy mit DEBIAN und APACHE einrichten.
Um dies zu tun, gehen wir davon aus, dass wir in unserer DMZ ein Debian installiert haben, dessen Port 443 des WAN, das darauf zeigt und den Port passieren lässt 443 von unserem Server zum Exchange CAS des LANs.
Wir haben unseren Debian-Server aktualisiert
# apt-get aktualisieren
# apt-get-Aktualisierung
Wir haben Apache installiert
# apt-get install apache2 apache2-mpm-prefork
Wir schalten die benötigten Module frei
# A2Enmod Proxy
# a2enmod proxy_http
# A2Enmod-Stiftleisten
# a2enmod umschreiben
# a2enmod ssl
Wir starten Apache neu
# /etc/init.d/apache2 neu starten
Wir erstellen die Verzeichnisse für die Zertifikate
# mkdir /etc/apache2/ssl.crt
# mkdir /etc/apache2/ssl.key
Wir exportieren das Zertifikat von unserem Exchange-Server nach pfx. Klicken Sie mit der rechten Maustaste auf das Zertifikat und dann auf Zertifikat exportieren.
Wir geben ihm eine Route und einen Namen, Und wir haben ein Passwort darauf gesetzt und es in unser Linux eingegeben, zum Beispiel mit WinSCP.
Wir konvertieren unsere pfx in reinen Text
# openSSL PKCS12 -in mail.pfx -out correo.txt -nodes
Wir bearbeiten die correo.txt Datei und sehen die PRIVATER RSA-SCHLÜSSEL und ZERTIFIKAT.
Wir lagern sie selbstständig in 2 Email.crt Datei und correo.key
Movemos el certificado a su directorio
# mv correo.crt /etc/apache2/ssl.crt
Movemos la rsa key a su directorio
# mv correo.key mkdir /etc/apache2/ssl.key
Creamos la carpeta owa, aunque sera ficticia solo para la configuración pero no la usaremos.
# mkdir /var/www/owa
Creamos y editamos el fichero owa
# vim /etc/apache2/sites-available/owa
Introducimos la siguiente configuración para actuar como proxy:
NameVirtualHost *:80
<Virtueller Gastgeber *:80>
ServerName correo.tundra-it.com
ServerAdmin
in**@co****.com
DocumentRoot /var/www/owa
DirectoryIndex index.htm index.html
RedirectMatch ^/$ https://correo.tundra-it.com/owa
RedirectMatch ^/owa$ https://correo.tundra-it.com/owa
</Virtueller Gastgeber>
NameVirtualHost *:443
<Virtueller Gastgeber *:443>
ServerName correo.tundra-it.com
ServerAdmin
in**@co****.com
DocumentRoot /var/www/owa
DirectoryIndex index.htm index.html
# Set up SSL to work with this host
SSLEngine On
SSLProxyEngine On
SSLCertificateFile /etc/apache2/ssl.crt/correo.crt
SSLCertificateKeyFile /etc/apache2/ssl.key/correo.key
# Redirect to ‘/owa’ from ‘/’
RedirectMatch ^/$ /owa
RewriteEngine On
# Fix a problem when ‘%’ symbols are in the subject line of OWA email
# (the email subject is used in the web query)
RewriteMap percentsubject int:escape
RewriteCond $1 ^/owa/.*%.*$
RewriteRule (/owa/.*) ${percentsubject:$1} [P]
RequestHeader set Front-End-Https “On”
ProxyRequests Off
ProxyPreserveHost On
ProxyVia On
<Proxy *>
Order deny,allow
Von allen zulassen
</Proxy>
#Reverse Proxy para OWA
ProxyPass /owa https://correo.tundra-it.com/owa
ProxyPassReverse /owa https://correo.tundra-it.com/owa
ProxyPass /exchweb https://correo.tundra-it.com/exchweb
ProxyPassReverse /exchweb https://correo.tundra-it.com/exchweb
ProxyPass /public https://correo.tundra-it.com/public
ProxyPassReverse /public https://correo.tundra-it.com/public
ProxyPass /iisadmpwd https://correo.tundra-it.com/iisadmpwd
ProxyPassReverse /iisadmpwd https://correo.tundra-it.com/iisadmpwd
ProxyPass /oma https://correo.tundra-it.com/oma
ProxyPassReverse /oma https://correo.tundra-it.com/oma
ProxyPass /Microsoft-Server-ActiveSync https://correo.tundra-it.com/Microsoft-Server-ActiveSync
ProxyPassReverse /Microsoft-Server-ActiveSync https://correo.tundra-it.com/Microsoft-Server-ActiveSync
ErrorLog /var/log/apache2/mailus-ssl-error_log
CustomLog /var/log/apache2/mailus-ssl-access_log common
</Virtueller Gastgeber>
Activamos el sitio OWA
# a2ensite owa
Para no permitir el trafico DNS de la DMZ a los DNS de la LAN, introducimos el nombre del sitio local en el archivo hosts
# ECHO 192.168.169.231 correo.tundra-it.com >> /etc/hosts
Reiniciamos el Apacahe
# /etc/init.d/apache2 neu starten
Entramos desde el exterior