Sichere Konfiguration via Router mit vHosts vereinfachen

Alles, was den Apache betrifft, kann hier besprochen werden.

Sichere Konfiguration via Router mit vHosts vereinfachen

Postby ingoshome » 29. March 2006 15:38

Hallo liebe Leut,

Seit Tagen kämpfe ich mit einer Konfiguration, die doch eigentlich nicht so
schwierig sein kann. Auf vieles habe ich hier im Forum Antworten gefunden. Das eine
oder ander fehlt mir aber noch. Gerne möchte ich meine Idee (und Konfiguration) zur
Diskussion stellen und dazu auch fragen:

Idee:

Ich nehme das aktuelle XAMPP (1.5.1), lass die Konfiguration as-is und hänge per
Include meine eigene dran. Zunächst habe ich DokuWiki http://www.splitbrain.org/projects/dokuwiki
eingebunden und das funktioniert auch gleich sehr fein! (THANX to XAMPP!!)

Nun will ich damit ans Internet mit möglichst wenig Veränderung der Original-conf.
(Damit habe ich einen deutlich besseren Überblick und Erleichterung bei Updates!)

Also stelle ich mit sowas vor:

Browser:80 <-internet-> 80:router:8080 <-lan-> 8080:vHost/ProxyPassReverse:80 <-local-> 80:dokuwiki


An andere Anwendungen in XAMPP gelangt man so dann nicht - funktioniert auch soweit,
zumindest im LAN. Weiter bin ich noch nicht ;-)

Später möchte ich noch auf andere hosts in meinem kleinen Heim-Netzwerk zugreifen
und ins Internet bringen - das per unterschiedlichen DynDns-Domains bzw. durch Verwendung
von Wildcards.


zusammengefasst:

Internet - 80:Router:8080 - 8080:vHostApache/Proxy:80 - 80:apache/dokuwiki

- und eben später:

Internet - 80:Router:8080 - 8080:vHostApache/Proxy:80 - 80:otherServer


in Worten: Ich öffne Port 80 des Router und leite auf port 8080 von XAMPP/apache weiter,
wo nur vHosts/ReverseProxies lauschen. von dort leite ich gezieht auf andere Ports bzw.
Anwendungen oder auf andere Server weiter. Der eigentliche Port 80 von XAMPP/apache ist
von aussen nicht sichtbar.


Anwendungsfälle:

- Wiki für ein Projekt im Internet (eigens domain dafür) den Beteiligten bereitstellen

- Zugriff auf die http-Konfiguration meines Proxy zuhause

- und einiges mehr ...



Lösung:

httpd.conf (bis auf letzte Zeile original-belassen - nur ssl-include auskommentiert):

conf/httpd.conf:
Code: Select all
:
Include conf/httpd.conf.added


in conf/httpd.conf.added steht dann:


Code: Select all

#
# Delta to Original XAMPP httpd.conf
#
# Change:
#
# off: #Include conf/extra/httpd-ssl.conf
# add: Include conf/httpd.conf.added
#
# All other Delta's follow here:
#


### Modules ...


LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_http_module modules/mod_proxy_http.so

ProxyRequests off


### Default Host ...


NameVirtualHost *

<VirtualHost *>

    ServerName default
    DocumentRoot C:/programme/xampp/htdocs
    ErrorDocument 404 D:/data/inet/notfound/index.htm

</VirtualHost>


### For Routing by Router via 8080 ...


Listen 8080
NameVirtualHost *:8080

<VirtualHost *:8080>

    ServerName default
    DocumentRoot D:/data/inet/notfound
    ErrorDocument 404 index.htm

</VirtualHost>


<VirtualHost *:8080>

    ServerName wiki
    ServerAlias wiki.proxy.lan wiki.account.dyndns.org

    DocumentRoot D:/data/inet/notfound
    ErrorDocument 404 D:/data/inet/notfound/index.htm

    #nur das soll durchkommen:

    ProxyPass         /dokuwiki/ http://127.0.0.1:80/dokuwiki/
    ProxyPassReverse  /dokuwiki/ http://127.0.0.1:80/dokuwiki/

</VirtualHost>

<VirtualHost *:8080>

    ServerName polarion
    ServerAlias polarion.proxy.lan polarion.account.dyndns.org

    DocumentRoot D:/data/inet/notfound
    ErrorDocument 404 D:/data/inet/notfound/index.htm

    #nur das soll durchkommen:

    ProxyPass         /polarion/ http://127.0.0.1:80/polarion/
    ProxyPassReverse  /polarion/ http://127.0.0.1:80/polarion/

</VirtualHost>




In hosts stehen dann wo erforderlich entsprechende Einträge:

Code: Select all

192.168.1.1     polarion.proxy.lan
192.168.1.1   wiki.proxy.lan




Nun habe ich Fragen an euch, die Ihr zum grossen Teil ja schon reichlich Erfahrungen
gesammelt habt:

Fragen

Was ist von dem Ansatz an sich zu halten? Ist das eine vertretare Variante um a) Schutz vor
aussen zu erreichen und b) möglichst wenig an der XAMPP-Original-Konfiguration zu verändern?

Problem: Wenn ich das ganz so mit Standard-Port 80 mache, gibt es beim Einstieg in manche
Anwendungen mit denen ich bisher probiert habe oder bei bestimmten Operationen (z.B. [Save] bei
dokuwiki]) Redirect's auf (z.B. index.jsp) auf den Original-Port und die lokale Adresse des
Servers (also einfach am proxy vorbei). Wenn ich xampp/Apache mit einem anderen Port (z.B. 81)
laufen lass, dann tritt dieses Problem nicht auf. Woran kann das liegen bzw. wie lässt sich
das Problem mit speziell Port 80 abschaffen?

Welche weiteren Sicherheits-Massnahmen wären wichtige oder empfehlenswert?

Was mir auch nich fehlt: Kann ich irgendwie eine User-Verwaltung einschalten, die den Anwender
zu beginn bereits nach einem Login fragt? (also schon bevor das erste Durchreichen über einen der
vHost-Proxies statfindet?


Vielen Dank schon mal, wenn jemand helfen kann - Für jede Meinung oder zusätzliche Ideen zu
diesem Ansatz bin ich sehr dankbar.


lg!ingo
ingoshome
 
Posts: 6
Joined: 26. March 2006 18:19
Location: DE-München

Neuer Stand:

Postby ingoshome » 07. April 2006 17:03

Nun - inzwischen ist die Sache bei mir etwas vorangeschritten. Mit Hilfe des
Supports zu einer der Anwendungen, die ich laufen lasse kam ich auf
zusammengefasst folgendes (hier wird auch noch der Problematik Rechnung
getragen, dass manche Anwendungen auf ihren direkten Aufruf - redirecten).

Das Interessante daran ist - wie oben bereits gefordert - dass man dazu
die Original-XAMPP-Konfiguration praktisch unangetastet lässt und dennoch
kein Sicherheitsproblem haben dürfte.

Ich halte mich mit der Zusammenfassung kurz und übersetze sie nicht,
da es ohnehin nicht eine grosse Schar Interessenten zu geben scheint:

Plugging in Polarion to another apache an route it to the internet (using dyndns)

Pincipal:

- a primary apache on any machine is connectd to the internet in any way doing anything.
- a secondary apache is running polarion - the primary routes to it. (Prox/Gateway)
- the primary apache does all the nescessary user- and security-aspects (not: polarion-login)

the primary server keeps all non-polarion requests away from the polarion-Server.

Caution: polarion MUST use the same port locally that the internet-browser uses - like that:

Code: Select all
 
  browser => polarion.ddns:80 (named by ddns)
  <-- internet -->
  80 => router => primaryServer:81 (named statically or by IP)
  <-- lan -->
  81 : primary server => polarionServer:80 (named by hosts-file)
  <-- local or lan -->
  80 : polarionServer/apache2polarion


the important aspects of the Configuration follow:

Configure Dyndns (polarion.ddns further used for polarion.my-account.dyndns.org)

- Use Standard Dynmaic Host at DynDns.org and set Wildcard to 'Y'
- Ensure that the DynDns-Update does not disable the Wildcard setting.


Configure the router (or use a routing computer doing the same)

- enable port 80 from the internet and route it to port 81 of the primaryServer


Configure the primaryServer

Port 81 is used assuming that 80 is configured for other purpose (i.e. for Polarion if
Polarion is running on the same computer)

Via Port 81 and VirtualHosts the primaryServer opens selectivly applications running
at server:port as a Gateway

Add to httpd.conf (or better use includes) of the primary(Apache)Server

Code: Select all
 
Listen 81
NameVirtualHost *:81
 
# -- hide everything first --
<VirtualHost *:81>
    ServerName default
    DocumentRoot x:/notfound
    ErrorDocument 404 /404.htm
</VirtualHost>

# -- Gateway to Polarion --
<VirtualHost *:81>
    ServerName polarion
    ServerAlias polarion.ddns
    DocumentRoot x:/notfound
    <Proxy *>
      AuthName Login
      AuthType Basic
      AuthUserFile x:/..../.htpasswd
      Require valid-user
    </Proxy>
    ProxyPass         /polarion/ http://polarion.ddns/polarion/
    ProxyPassReverse  /polarion/ http://polarion.ddns/polarion/
    ProxyPass         / http://polarion.ddns/polarion/
    ProxyPassReverse  / http://polarion.ddns/polarion/
</VirtualHost>

# -- Gateways to other applications in the equivalent way follow --
 
# ...


Add to windows/system32/drivers/etc/hosts (primaryServer)

Code: Select all
 
???.???.???.???   polarion.ddns # local (!) polarion-server-ip


Configure Polarion (secondaryServer)

adapt in c:/polarion/polarion/configuration/install.tags

Code: Select all
 
host.name=polarion.ddns


Add to windows/system32/drivers/etc/hosts (secondaryServer if it's another computer)

Code: Select all
 
???.???.???.???   polarion.ddns # local (!) polarion-server-ip



Note & Remember:

! Polarion must run on the same port locally as is used to access from the internet (here 80)
! polarion.ddns means: polarion.acountname.dyndns.td
! the host name in the ProxyPass-Directives (polarion.ddns) MUST be the same that the browser uses
ingoshome
 
Posts: 6
Joined: 26. March 2006 18:19
Location: DE-München


Return to Apache

Who is online

Users browsing this forum: No registered users and 46 guests