Anomalie #2064
Log Apache incorrect derrière un reverse proxy
Description
Lorsqu'Apache est derrière un reverse proxy, les logs ont l'adresse IP du reverse proxy et non l'adresse IP de l'utilisateur.
Pour cela, il est possible d'utilise le module rpaf d'Apache.
Pour cela, il faut ajouter le paquet "libapache2-mod-rpaf" à web-pkg et ajouter 2 questions :
- activer_web_behind_revproxy
- web_behind_revproxy_ip
Modification du dictionnaire 20_web.xml :
--- /root/20_web.xml 2011-09-15 20:22:18.458319935 +0200 +++ /usr/share/eole/creole/dicos/20_web.xml 2011-09-15 21:25:55.558291257 +0200 @@ -14,6 +14,7 @@ <file name='/etc/apache2/sites-enabled/apache-scribe.conf'/> <file name='/etc/apache2/sites-enabled/Vhost.conf'/> <file name='/etc/apache2/sites-enabled/Vhost-ssl.conf'/> + <file name='/etc/apache2/mods-enabled/rpaf.conf' rm='True' filelist='rpaf'/> <file name='/etc/php5/apache2/php.ini' del_comment=';'/> <!-- remonter des logs vers la maitre --> <file name='/etc/rsyslog.d/50-default.conf' source="50-default-conteneur.conf" container_only="True"/> @@ -36,6 +37,10 @@ <variable name='web_redirection' type='string' description='Application web par défaut (redirection)' > <value>/</value> </variable> + <variable name='activer_web_behind_revproxy' type='oui/non' description="Le serveur web est derrière un reverse proxy"> + <value>non</value> + </variable> + <variable name='web_behind_revproxy_ip' type='ip' description="Adresse IP du serveur reverse proxy"/> </family> <family name='apache' mode='expert'> <variable name='apache_plus' type='oui/non' description="Ajout d'applications web supplémentaire" > @@ -76,6 +81,7 @@ <check name='valid_alias' target='web_redirection'/> <check name='obligatoire' target='web_url'/> + <check name='obligatoire' target='web_behind_revproxy_ip'/> <auto name='calc_container' target='adresse_ip_web'> <param>container_ip_web</param> @@ -83,6 +89,11 @@ <group master='apache_dir'> <slave>apache_alias</slave> </group> + <condition name='hidden_if_in' source='activer_web_behind_revproxy'> + <param>non</param> + <target type="filelist">rpaf</target> + <target type='variable'>web_behind_revproxy_ip</target> + </condition> <condition name='hidden_if_in' source='activer_apache'> <param>non</param> <target type="servicelist">apache</target>
Modification du dictionnaire 25_nginx.xml :
--- /root/25_nginx.xml 2011-09-15 20:30:21.958326337 +0200 +++ /usr/share/eole/creole/dicos/25_nginx.xml 2011-09-15 21:09:31.331637019 +0200 @@ -49,6 +49,13 @@ <value></value> </variable> </family> + <family name='applications web' hidden='True'> + <!-- creer si n'existe pas et cache--> + <variable name='activer_web_behind_revproxy' type='oui/non' redefine='True' hidden='True'> + <value>oui</value> + </variable> + <variable name='web_behind_revproxy_ip' type='ip' redefine='True' hidden='True'/> + </family> <separators> <separator name='revprox_sso'>Redirection de services particuliers</separator> <separator name='revprox_activate_http'>Redirection HTTP et HTTPS</separator> @@ -90,6 +97,13 @@ <target type='variable'>revprox_https</target> <target type='variable'>revprox_url</target> </condition> + <condition name='hidden_if_in' source='activer_web_behind_revproxy'> + <param>oui</param> + <target type='variable'>web_behind_revproxy_ip</target> + </condition> + <auto name='calc_container' target='web_behind_revproxy_ip'> + <param>adresse_ip_br0</param> + </auto> </constraints> <!--************************************************************************************************* --> <help>
Le template rpaf.conf :
<IfModule mod_rpaf.c> RPAFenable On RPAFsethostname On RPAFproxy_ips %%web_behind_revproxy_ip </IfModule>
Related issues
Associated revisions
log Apache derrière un reverse proxy : partie web (fixes #2064)
log Apache derrière un reverse proxy : partie revprox (fixes #2064) + fix tabs
modif 25_nging.xml (fixes #2064)
History
#1 Updated by Joël Cuissinat over 11 years ago
- Target version set to Mises à jour 2.3 - 02 RC
#2 Updated by Joël Cuissinat over 11 years ago
- Status changed from Nouveau to Résolu
- % Done changed from 0 to 100
Appliqué par commit commit:"aaaa69d46dac36e5d03704a8ef18e36c019d90c5".
#3 Updated by Joël Cuissinat over 11 years ago
- Project changed from conf-scribe to conf-amon
#4 Updated by Joël Cuissinat over 11 years ago
Appliqué par commit 4429a50e7b29d5841327108dc57ce9fe131481af.
#5 Updated by Emmanuel GARETTE over 11 years ago
- Status changed from Résolu to Accepté
- Distribution set to EOLE 2.3
Il y a un soucis dans le dico 25_nginx.xml :/
Il faut que ca soit un hidden_if_not_in ou il faut que le param soit "non" :
<condition name='hidden_if_in' source='activer_web_behind_revproxy'> <param>oui</param> <target type='variable'>web_behind_revproxy_ip</target> </condition>
#6 Updated by Fabrice Barconnière over 11 years ago
- Status changed from Accepté to Résolu
Appliqué par commit 17d4cd398ecde51773f113185bb365b5aafe2ec7.
#7 Updated by Fabrice Barconnière over 11 years ago
- Status changed from Résolu to Fermé
#8 Updated by Joël Cuissinat over 11 years ago
- Status changed from Fermé to Résolu
- Target version changed from Mises à jour 2.3 - 02 RC to Mises à jour 2.3 - 02 Stable
Je ne suis pas d'accord que l'on ferme cette demande alors que le paquet n'a même pas été refait depuis le dernier commit !
#9 Updated by Emmanuel GARETTE over 11 years ago
- Status changed from Résolu to Nouveau
Il manque le fichier rpaf.load dans mod-enabled.
Il faudrait utilisé la commande a2enmod rpaf. Le soucis c'est que le fichier est templatisé dans mod-enabled et non dans site-availabled. La commande a2enmod n'aime visiblement pas.
#10 Updated by Fabrice Barconnière over 11 years ago
- Target version changed from Mises à jour 2.3 - 02 Stable to Mises à jour 2.3 - 03 RC
- % Done changed from 100 to 50
#11 Updated by Joël Cuissinat over 11 years ago
- Status changed from Nouveau to Résolu
- Assigned To set to Fabrice Barconnière
- % Done changed from 50 to 100
#12 Updated by Fabrice Barconnière over 11 years ago
- Status changed from Résolu to Fermé