Ich beschäftige mich gerade intensiv mit ReverseProxy und apache2.
Ich möchte Horde im LAN über http und nach außen über https erreichbar machen. Horde läuft auf einem eigenen Rechner und ich will ihn von Außen über einen ReverseProxy erreichbar machen.
Ich habe dazu einen vHost auf Port 80 lauschen, der die Anfragen auf einen zweiten vHost auf Port 443 lauschend Redirected:
Code: Alles auswählen
<VirtualHost *:80>
ServerName mymail.schuerz.at
RedirectPermanent / https://mymail.schuerz.at/
ErrorLog /var/log/apache2/horde_error.log
CustomLog /var/log/apache2/horde_access.log combined
</VirtualHost>
<VirtualHost *:443>
ServerAdmin admin@xundeenergie.at
ServerName webmail.domain.example
ProxyRequests Off
ProxyPreserveHost On
ProxyHTMLEnable On
#SetOutputFilter proxy-html
SetOutputFilter INFLATE;proxy-html;DEFLATE
ProxyPass / http://webmail.virgo:81/
ProxyPassReverse / http://webmail.virgo:81/
RequestHeader set X-Forwarded-Proto "https"
# SSL-stuff
SSLEngine on
SSLProtocol +ALL -SSLv3 -TLSv1
SSLCipherSuite ALL:!aNULL:!ADH:!eNULL:!LOW:!EXP:RC4+RSA:+HIGH:+MEDIUM
SSLCertificateFile /etc/apache2/ssl/certs/apache.crt
SSLCertificateKeyFile /etc/apache2/ssl/certs/private/apache.key
SSLCertificateChainFile /etc/ssl/certs/My-CA-Chain.pem
# Diffie-Helmann Parameters
#Generate the parameters
#cd /etc/ssl/certs
#openssl dhparam -out dhparam.pem 4096
# Add the following to your Apache config.
SSLOpenSSLConfCmd DHParameters "/etc/apache2/ssl/certs/dhparam.pem"
#AddType application/x-httpd-php .php
# <Location />
# Options FollowSymLinks
# AllowOverride None
# Require all denied
# AuthType Basic
# AuthBasicProvider ldap-xundeenergie-at
# AuthName "xundeenergie LDAP auth"
# Require valid-user
# Order allow,deny
# #Allow from 127.0.0.1 91.118.111.246 62.116.82.210 92.60.9.18 85.126.241.58
# Allow from 127.0.0.1
# Satisfy any
# Options Indexes FollowSymLinks
# </Location>
#DirectoryIndex index.php
ErrorLog /var/log/apache2/horde_error.log
CustomLog /var/log/apache2/horde_access.log combined
</VirtualHost>
Da ich Horde lokal ohne https im LAN anbieten will, hab ich Horde also auf Port 81 (derzeit noch auf dem selben Rechner) in Betrieb:
Code: Alles auswählen
<VirtualHost *:81>
ServerAdmin admin@xundeenergie.at
ServerName webmail.virgo
ServerAlias webmail.local
ServerPath /usr/share/horde
RedirectPermanent /.well-known/caldav /horde/rpc.php/
AddType application/x-httpd-php .php
Alias / /usr/share/horde/
SetEnv nokeepalive ssl-unclean-shutdown
DocumentRoot "/usr/share/horde"
<Directory "/usr/share/horde">
Options Indexes FollowSymLinks MultiViews
AllowOverride All
#AllowOverride Limit FileInfo
# Exclude file from password protection
SetEnvIf Request_URI "(rpc.php)$" allow
SetEnvIf Request_URI "(sapi/profile/client)$" allow
SetEnvIf Request_URI "(devinfo)$" allow
SetEnvIf Request_URI "(Microsoft-Server-ActiveSync)$" allow
# Access-stuff
Order allow,deny
Allow from all
# Set exclude all files with env=allow
Allow from env=allow
Satisfy any
# ActiveSync
RewriteEngine On
RewriteRule ^/Microsoft-Server-ActiveSync /rpc.php [PT,L,QSA]
RewriteRule .* - [E=HTTP_MS_ASPROTOCOLVERSION:%{HTTP:Ms-Asprotocolversion}]
RewriteRule .* - [E=HTTP_X_MS_POLICYKEY:%{HTTP:X-Ms-Policykey}]
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
# If horde dies while trying to handle large email file attachments, you are probably
# hitting PHP's memory limit. Raise that limit here, but use caution
# Set to your preference - memory_limit should be at least 32M and be greater than the
# value set for post_max_size
# php_value memory_limit 32M
# php_value post_max_size 20M
# php_value upload_max_filesize 10M
# horde.org's recommended PHP settings:
php_admin_flag safe_mode off
php_admin_flag magic_quotes_runtime off
php_flag session.use_trans_sid off
php_flag session.auto_start off
php_admin_flag file_uploads on
# Optional - required for weather block in Horde to function
php_admin_flag allow_url_fopen on
</Directory>
# Deny access to files that are not served directly by the webserver
<DirectoryMatch "^usr/share/horde/(.*/)?(config|lib|locale|po|scripts|templates)/(.*)?">
Order deny,allow
Deny from all
</DirectoryMatch>
# Deny access to the test.php files except from localhost
<LocationMatch "^/horde/(.*/)?test.php">
Order deny,allow
Deny from all
</LocationMatch>
DirectoryIndex index.php
ErrorLog /var/log/apache2/horde_error.log
CustomLog /var/log/apache2/horde_access.log combined
</VirtualHost>
Rufe ich http;//webmail.domain.example auf, wird ordnungsgemäß auf https://webmail.domain.example redirected.
Aber dann ist das Problem, dass das Design nicht passt und beim Login gibt es eine Warnung, dass die Logindaten über eine unverschlüsselte Verbindung übertragen würden... Obwohl der Browser anzeigt, dass die Seite korrekt ssl-Verschlüsselt ist.
Ich habe dann den übertragenen Quelltext der Login-Seite angeschaut und entdeckt, dass sowohl die <link>-Tags im Header als auch das Formular auf http://webmail.domain.example statt auf https://webmail.domain.example zeigt. Diese Adressen werden also trotz ProxyHTMLEnable On im Proxy-vHost nicht umgeschrieben. Diese Direktive sollte aber genau im Body enthaltene Adressen umschreiben...
Da ich noch zu wenig Erfahrung habe, frage ich jetzt einmal hier nach, was ich da falsch mache? Warum werden diese Adressen nicht umgeschrieben?
lg scientific