D3R S3H@
08.03.13, 10:24
Hallo zusammen,
ich kämpfe da mit einem seltsamen Problem. Ich habe folgenden Konfiguration:
Stunnel --> HAProxy --> Apaches
Alles klappt bis auf Joomla Seiten welche vollständig auf SSL laufen sollen. In der unten angehängten Konfiguration bekomme ich wenn ich in Jommla auf "force_ssl" einschalten nur noch einen Infinity Loop "303 See Other". Festgestellt habe ich das es nicht direkt mit SSL zu tun hat aber mit aktivieren SEF (also schöne URLs in Joomla). Dann schreibt Joomla anscheinend jede anfrage selbst um und der Client landet im Loop. Theoretisch müßte ich aber das force SSL in Joomla garnicht aktivieren wenn ich vorne im HAPRoxy alles auf https umleite. Wenn ich also in Joomla force SSL abschalte ist die Seite dann nur teileweise über https! Das mag der IE nicht so gerne hinnehmen und warnt. Im Firebug sehe ich das es GET Anfragen mit nur HTTP gibt unter Location selbst dann HTTPS. Hat jemand von euch eine Idee? In letzter Konsequens kann ich nur Joomla Core hacken um diese Loops zu unterbinden.
STunnel:
key=/opt/stunnel/etc/stunnel/cert.key
cert=/opt/stunnel/etc/stunnel/group-cert.pem
setuid=stunnel
setgid=stunnel
pid=/opt/stunnel/var/run/stunnel.pid
output = /var/log/stunnel.log
debug=0
TIMEOUTclose=0
socket=l:TCP_NODELAY=1
socket=r:TCP_NODELAY=1
[standby_ssl]
accept=192.168.1.94:443
connect=127.0.0.1:88
xforwardedfor=yes
HAProxy:
global
user haproxy
group haproxy
chroot /opt/haproxy
pidfile /var/run/haproxy.pid
stats socket /tmp/haproxy
daemon
defaults
log global
option contstats
option redispatch
option dontlognull
retries 5
option abortonclose
timeout client 60s # Client and server timeout must match the longest
timeout server 60s # time we may wait for a response from the server.
timeout queue 60s # Don't queue requests too long if saturated.
timeout connect 10s # There's no reason to change this one.
timeout http-request 30s # A complete request may never take that long.
timeout tarpit 1m
backlog 10000
######################## STANDBY ########################
frontend haproxy_nonssl
bind 192.168.1.94:80
mode http
option httpclose
option http-server-close
#option httplog
maxconn 5000
option forwardfor header X-Client-IP
option forwardfor except 192.168.1.94
reqadd X-Forwarded-Proto:\ http
# http://www.test.de auf HTTPS umleiten
acl http_test_www hdr(host) www.test.de
redirect prefix https://www.test.de if http_test_www
default_backend apaches
frontend haproxy_ssl
#stunnel 192.168.1.94:443
bind 127.0.0.1:88
mode http
option httplog
option httpclose
option http-server-close
maxconn 5000
option forwardfor header X-Client-IP
option forwardfor except 127.0.0.1
reqadd X-Forwarded-Proto:\ https
default_backend apaches_ssl
################################################## ###########################
# Backends
################################################## ###########################
### APACHES ###
backend apaches
mode http
balance roundrobin
option httpchk HEAD /check.txt HTTP/1.0
server apache1 192.168.94.41:80 check inter 5000 maxconn 1000
server apache2 192.168.94.42:80 check inter 5000 maxconn 1000
backend apaches_ssl
mode http
balance roundrobin
option httpchk HEAD /check.txt HTTP/1.0
server apache1 192.168.1.41:80 check inter 5000 maxconn 1000
server apache2 192.168.1.42:80 check inter 5000 maxconn 1000
Apache vHost:
<VirtualHost *:80>
# test.de
ServerAdmin webmaster@test.de
DocumentRoot "/u/www-test"
ServerName test.de
ServerAlias www.test.de
#ErrorLog logs/test.de-error_log
CustomLog logs/test.de-access_log combined env=!dontlog
DirectoryIndex index.php
<Directory "/u/www-test">
Options FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
Require all granted
</Directory>
RewriteEngine on
## Umleitungen
RewriteCond %{HTTP_HOST} ^test\.de$
RewriteRule ^(.*)$ http://www.test.de/$1 [R=301,L]
ProxyPassMatch ^/(.*\.php(/.*)?)$ fcgi://127.0.0.1:9000/u/www-test/$1
</VirtualHost>
<VirtualHost *:443>
# test.de
SSLEngine On
SSLProxyEngine on
SSLProtocol All
ServerAdmin webmaster@test.de
DocumentRoot "/u/www-test"
ServerName test.de
ServerAlias www.test.de
#ErrorLog logs/test.de-error_log
CustomLog logs/test.de-access_log combined env=!dontlog
DirectoryIndex index.php
<Directory "/u/www-test">
Options FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
Require all granted
</Directory>
RewriteEngine on
## Umleitungen
#RewriteCond %{HTTP_HOST} ^test\.de$
#RewriteRule ^(.*)$ https://www.test.de/$1 [R=301,L]
ProxyPassMatch ^/(.*\.php(/.*)?)$ fcgi://127.0.0.1:9000/u/www-test/$1
</VirtualHost>
Joomla Config:
var $sef = '1';
var $sef_rewrite = '1';
var $sef_suffix = '1';
var $force_ssl = '0';
ich kämpfe da mit einem seltsamen Problem. Ich habe folgenden Konfiguration:
Stunnel --> HAProxy --> Apaches
Alles klappt bis auf Joomla Seiten welche vollständig auf SSL laufen sollen. In der unten angehängten Konfiguration bekomme ich wenn ich in Jommla auf "force_ssl" einschalten nur noch einen Infinity Loop "303 See Other". Festgestellt habe ich das es nicht direkt mit SSL zu tun hat aber mit aktivieren SEF (also schöne URLs in Joomla). Dann schreibt Joomla anscheinend jede anfrage selbst um und der Client landet im Loop. Theoretisch müßte ich aber das force SSL in Joomla garnicht aktivieren wenn ich vorne im HAPRoxy alles auf https umleite. Wenn ich also in Joomla force SSL abschalte ist die Seite dann nur teileweise über https! Das mag der IE nicht so gerne hinnehmen und warnt. Im Firebug sehe ich das es GET Anfragen mit nur HTTP gibt unter Location selbst dann HTTPS. Hat jemand von euch eine Idee? In letzter Konsequens kann ich nur Joomla Core hacken um diese Loops zu unterbinden.
STunnel:
key=/opt/stunnel/etc/stunnel/cert.key
cert=/opt/stunnel/etc/stunnel/group-cert.pem
setuid=stunnel
setgid=stunnel
pid=/opt/stunnel/var/run/stunnel.pid
output = /var/log/stunnel.log
debug=0
TIMEOUTclose=0
socket=l:TCP_NODELAY=1
socket=r:TCP_NODELAY=1
[standby_ssl]
accept=192.168.1.94:443
connect=127.0.0.1:88
xforwardedfor=yes
HAProxy:
global
user haproxy
group haproxy
chroot /opt/haproxy
pidfile /var/run/haproxy.pid
stats socket /tmp/haproxy
daemon
defaults
log global
option contstats
option redispatch
option dontlognull
retries 5
option abortonclose
timeout client 60s # Client and server timeout must match the longest
timeout server 60s # time we may wait for a response from the server.
timeout queue 60s # Don't queue requests too long if saturated.
timeout connect 10s # There's no reason to change this one.
timeout http-request 30s # A complete request may never take that long.
timeout tarpit 1m
backlog 10000
######################## STANDBY ########################
frontend haproxy_nonssl
bind 192.168.1.94:80
mode http
option httpclose
option http-server-close
#option httplog
maxconn 5000
option forwardfor header X-Client-IP
option forwardfor except 192.168.1.94
reqadd X-Forwarded-Proto:\ http
# http://www.test.de auf HTTPS umleiten
acl http_test_www hdr(host) www.test.de
redirect prefix https://www.test.de if http_test_www
default_backend apaches
frontend haproxy_ssl
#stunnel 192.168.1.94:443
bind 127.0.0.1:88
mode http
option httplog
option httpclose
option http-server-close
maxconn 5000
option forwardfor header X-Client-IP
option forwardfor except 127.0.0.1
reqadd X-Forwarded-Proto:\ https
default_backend apaches_ssl
################################################## ###########################
# Backends
################################################## ###########################
### APACHES ###
backend apaches
mode http
balance roundrobin
option httpchk HEAD /check.txt HTTP/1.0
server apache1 192.168.94.41:80 check inter 5000 maxconn 1000
server apache2 192.168.94.42:80 check inter 5000 maxconn 1000
backend apaches_ssl
mode http
balance roundrobin
option httpchk HEAD /check.txt HTTP/1.0
server apache1 192.168.1.41:80 check inter 5000 maxconn 1000
server apache2 192.168.1.42:80 check inter 5000 maxconn 1000
Apache vHost:
<VirtualHost *:80>
# test.de
ServerAdmin webmaster@test.de
DocumentRoot "/u/www-test"
ServerName test.de
ServerAlias www.test.de
#ErrorLog logs/test.de-error_log
CustomLog logs/test.de-access_log combined env=!dontlog
DirectoryIndex index.php
<Directory "/u/www-test">
Options FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
Require all granted
</Directory>
RewriteEngine on
## Umleitungen
RewriteCond %{HTTP_HOST} ^test\.de$
RewriteRule ^(.*)$ http://www.test.de/$1 [R=301,L]
ProxyPassMatch ^/(.*\.php(/.*)?)$ fcgi://127.0.0.1:9000/u/www-test/$1
</VirtualHost>
<VirtualHost *:443>
# test.de
SSLEngine On
SSLProxyEngine on
SSLProtocol All
ServerAdmin webmaster@test.de
DocumentRoot "/u/www-test"
ServerName test.de
ServerAlias www.test.de
#ErrorLog logs/test.de-error_log
CustomLog logs/test.de-access_log combined env=!dontlog
DirectoryIndex index.php
<Directory "/u/www-test">
Options FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
Require all granted
</Directory>
RewriteEngine on
## Umleitungen
#RewriteCond %{HTTP_HOST} ^test\.de$
#RewriteRule ^(.*)$ https://www.test.de/$1 [R=301,L]
ProxyPassMatch ^/(.*\.php(/.*)?)$ fcgi://127.0.0.1:9000/u/www-test/$1
</VirtualHost>
Joomla Config:
var $sef = '1';
var $sef_rewrite = '1';
var $sef_suffix = '1';
var $force_ssl = '0';