Migration vers directive Require d'Apache

This commit is contained in:
Brice Waegeneire 2021-03-08 18:11:05 +01:00
parent fffc4e4e30
commit 8a29658c7a
17 changed files with 33 additions and 50 deletions

View file

@ -498,8 +498,7 @@ loaded, and set up a virtual host with the following configuration:
ProxyRequests Off ProxyRequests Off
<Proxy *> <Proxy *>
Order deny,allow Require all granted
Allow from all
</Proxy> </Proxy>
ProxyPassReverse / http://127.0.0.1:5001 ProxyPassReverse / http://127.0.0.1:5001
@ -570,8 +569,7 @@ Now add the following lines to the apache configuration file for the
ProxyRequests Off ProxyRequests Off
<Proxy *> <Proxy *>
Order deny,allow Require all granted
Allow from all
</Proxy> </Proxy>
ProxyPass /wiki/ http://127.0.0.1:5001/ ProxyPass /wiki/ http://127.0.0.1:5001/

View file

@ -132,9 +132,8 @@ MaxSpareServers 30
MaxRequestsPerChild 100 MaxRequestsPerChild 100
<Directory /home/> <Directory /home/>
AllowOverride None AllowOverride None
Require all granted # Equivalent à "Require not env GoAway"
# "Require not env XXX" is not supported :( Require expr "-z %{reqenv:GoAway}"
Deny from env=GoAway
</Directory> </Directory>
<IfModule mod_ssl.c> <IfModule mod_ssl.c>
SSLProtocol all -SSLv2 -SSLv3 SSLProtocol all -SSLv2 -SSLv3
@ -154,7 +153,7 @@ ipaddr_whitelist.conf` à différents endroits dans la configuration
d'Apache sans dupliquer ces adresses : d'Apache sans dupliquer ces adresses :
~~~{.apache} ~~~{.apache}
Allow from 192.0.2.42 Require ip 192.0.2.42
~~~ ~~~
Pour la [gestion des droits](#gestion-des-droits) on ajoute dans le fichier `/etc/apache2/envvars` : Pour la [gestion des droits](#gestion-des-droits) on ajoute dans le fichier `/etc/apache2/envvars` :
@ -210,10 +209,8 @@ Exemple d'un VirtualHost basé sur un nom de domaine via
AuthUserFile /home/example/.htpasswd AuthUserFile /home/example/.htpasswd
require valid-user require valid-user
Deny from all
Include ipaddr_whitelist.conf Include ipaddr_whitelist.conf
Allow from 192.0.2.43 Require ip 192.0.2.43
Satisfy any
</Directory> </Directory>
AssignUserID www-example example AssignUserID www-example example
@ -481,7 +478,7 @@ ProxyPreserveHost On
ProxyPass /foo/ http://127.0.0.1:8080/bar ProxyPass /foo/ http://127.0.0.1:8080/bar
ProxyPassReverse /foo/ http://127.0.0.1:8080/bar ProxyPassReverse /foo/ http://127.0.0.1:8080/bar
<Proxy *> <Proxy *>
Allow from All Require all granted
</Proxy> </Proxy>
~~~ ~~~
@ -493,7 +490,7 @@ ProxyPreserveHost On
ProxyPass / http://192.0.2.17/ ProxyPass / http://192.0.2.17/
ProxyPassReverse / http://192.0.2.17/ ProxyPassReverse / http://192.0.2.17/
<Proxy *> <Proxy *>
Allow from All Require all granted
</Proxy> </Proxy>
~~~ ~~~
@ -505,7 +502,7 @@ ProxyPreserveHost On
ProxyPass / https://192.0.2.17/ ProxyPass / https://192.0.2.17/
ProxyPassReverse / https://192.0.2.17/ ProxyPassReverse / https://192.0.2.17/
<Proxy *> <Proxy *>
Allow from All Require all granted
</Proxy> </Proxy>
~~~ ~~~
@ -515,7 +512,7 @@ S'il y a besoin d'appliquer des règles spécifiques tel que des Alias avant que
Alias /dossier/ /home/$USER/dossier/ Alias /dossier/ /home/$USER/dossier/
<Directory /home/$USER/dossier/> <Directory /home/$USER/dossier/>
Options +SymLinksIfOwnerMatch +Indexes Options +SymLinksIfOwnerMatch +Indexes
Allow from All Require all granted
</Directory> </Directory>
ProxyPreserveHost On ProxyPreserveHost On
@ -531,7 +528,7 @@ Le module
[mod_remoteip](https://httpd.apache.org/docs/2.4/mod/mod_remoteip.html)(**mod_rpaf** en Wheezy) [mod_remoteip](https://httpd.apache.org/docs/2.4/mod/mod_remoteip.html)(**mod_rpaf** en Wheezy)
permet d'utiliser la 1ère adresse IP située permet d'utiliser la 1ère adresse IP située
dans un entête HTTP type *X-Forwarded-For* pour les logs Apache et dans un entête HTTP type *X-Forwarded-For* pour les logs Apache et
directives **mod_access** (Allow/Deny From). directives "Require" de**mod_authz_host**.
Voici un exemple d'utilisation en Wheezy pour un reverse-proxy avec Voici un exemple d'utilisation en Wheezy pour un reverse-proxy avec
@ -616,8 +613,7 @@ Exemple avec un service HTTP local :
Options IncludesNoExec Options IncludesNoExec
AddOutputFilter Includes html AddOutputFilter Includes html
AddHandler type-map var AddHandler type-map var
Order allow,deny Require all granted
Allow from all
LanguagePriority en cs de es fr it nl sv pt-br ro LanguagePriority en cs de es fr it nl sv pt-br ro
ForceLanguagePriority Prefer Fallback ForceLanguagePriority Prefer Fallback
</Directory> </Directory>
@ -1154,10 +1150,9 @@ manuelle ou automatique.
ExtendedStatus On ExtendedStatus On
<Location /server-status-XXXX> <Location /server-status-XXXX>
SetHandler server-status SetHandler server-status
Deny from all
Include ipaddr_whitelist.conf Include ipaddr_whitelist.conf
Allow from 192.0.2.43 Require ip 192.0.2.43
Allow from 127.0.0.1 Require ip 127.0.0.1
</Location> </Location>
</IfModule> </IfModule>
~~~ ~~~
@ -1297,8 +1292,7 @@ de la racine apache, car cela concernera tout les vhosts.
ErrorDocument XXX /YYYYYY/page.html ErrorDocument XXX /YYYYYY/page.html
Alias /YYYYYY /var/www/ Alias /YYYYYY /var/www/
<Directory /var/www/> <Directory /var/www/>
Order allow,deny Require all granted
Allow from all
DirectoryIndex page.html DirectoryIndex page.html
</Directory> </Directory>
~~~ ~~~

View file

@ -97,12 +97,12 @@ Listen *:631
<Location /> <Location />
Order allow,deny Order allow,deny
Allow from 192.0.32.0/24 Require ip 192.0.32.0/24
</Location> </Location>
~~~ ~~~
Il faut ensuite ajouter `Allow from 192.0.32.0/24` pour les sections et actions souhaitées. Il faut ensuite ajouter `Require ip 192.0.32.0/24` pour les sections et actions souhaitées.
Pour les sections et actions critiques, une authentification supplémentaire est nécessaire. Pour les sections et actions critiques, une authentification supplémentaire est nécessaire.
Cela se base sur les utilisateurs Unix, pour autoriser un utilisateur on l'ajoutera dans le groupe `lpadmin` : Cela se base sur les utilisateurs Unix, pour autoriser un utilisateur on l'ajoutera dans le groupe `lpadmin` :

View file

@ -254,8 +254,6 @@ Exemple de VirtualHost :
ProxyPreserveHost On ProxyPreserveHost On
<Proxy *> <Proxy *>
#Order deny,allow
#Allow from all
Require all granted Require all granted
</Proxy> </Proxy>
@ -331,4 +329,4 @@ C'est peut-être un problème de cache. Essayez de le reconstruire avec :
$ bin/gerrit.sh stop $ bin/gerrit.sh stop
$ java -jar bin/gerrit.war reindex --index accounts $ java -jar bin/gerrit.war reindex --index accounts
$ bin/gerrit.sh start $ bin/gerrit.sh start
~~~ ~~~

View file

@ -127,7 +127,7 @@ Par exemple avec un authentification LDAP :
WSGIScriptAlias / /home/hg/hgweb.wsgi WSGIScriptAlias / /home/hg/hgweb.wsgi
<Directory /> <Directory />
Allow from all Require all granted
Options ExecCGI FollowSymlinks Options ExecCGI FollowSymlinks
</Directory> </Directory>

View file

@ -94,8 +94,7 @@ Voici une configuration d'un VirtualHost Apache pour proxyfié Jenkins en https
ServerAdmin webmaster@localhost ServerAdmin webmaster@localhost
<Directory proxy:http://localhost:8080/*> <Directory proxy:http://localhost:8080/*>
Order deny,allow Require all granted
Allow from all
</Directory> </Directory>
ProxyRequests Off ProxyRequests Off
@ -158,4 +157,4 @@ Il faut configurer le ProxyPass avec l'option _nocanon_ comme ceci :
RequestHeader set X-Forwarded-Port "443" RequestHeader set X-Forwarded-Port "443"
</Location> </Location>
~~~ ~~~

View file

@ -64,7 +64,7 @@ Enfin, pour voir les icones Awstats, on rajoutera le fichier _/etc/apache2/cron.
~~~ ~~~
Alias /awstats-icon/ /usr/share/awstats/icon/ Alias /awstats-icon/ /usr/share/awstats/icon/
<Directory /usr/share/awstats/icon/> <Directory /usr/share/awstats/icon/>
Allow from all Require all granted
</Directory> </Directory>
~~~ ~~~

View file

@ -44,7 +44,6 @@ Configuration :
Alias /.well-known/acme-challenge /var/lib/letsencrypt/.well-known/acme-challenge Alias /.well-known/acme-challenge /var/lib/letsencrypt/.well-known/acme-challenge
<Directory "/var/lib/letsencrypt/.well-known/acme-challenge"> <Directory "/var/lib/letsencrypt/.well-known/acme-challenge">
Options -Indexes Options -Indexes
Allow from all
Require all granted Require all granted
</Directory> </Directory>
~~~ ~~~

View file

@ -174,7 +174,7 @@ ScriptAlias /munin-cgi/munin-cgi-graph /usr/lib/munin/cgi/munin-cgi-graph
SetHandler cgi-script SetHandler cgi-script
</IfModule> </IfModule>
</IfModule> </IfModule>
Allow from all Require all granted
</Location> </Location>
~~~ ~~~

View file

@ -122,8 +122,7 @@ Ou Apache :
ProxyPreserveHost On ProxyPreserveHost On
<Proxy *> <Proxy *>
Order deny,allow Require all granted
Allow from all
</Proxy> </Proxy>
AllowEncodedSlashes NoDecode AllowEncodedSlashes NoDecode

View file

@ -345,7 +345,7 @@ Et voici un VirtualHost minimal pour Apache :
DocumentRoot /home/foo/www/current DocumentRoot /home/foo/www/current
<Directory /home/redmine/www/current> <Directory /home/redmine/www/current>
Allow from all Require all granted
Options -MultiViews Options -MultiViews
</Directory> </Directory>

View file

@ -85,7 +85,6 @@ Configuration du VHost :
AuthUserFile /home/svn/.htpasswd AuthUserFile /home/svn/.htpasswd
AuthzSVNAccessFILE /home/svn/.authz AuthzSVNAccessFILE /home/svn/.authz
Require valid-user Require valid-user
Allow from all
</Location> </Location>
~~~ ~~~
@ -114,7 +113,6 @@ Et la configuration suivante :
AuthLDAPGroupAttribute memberUid # Chercher l'attribut memberUid au lieu de uniqueMember AuthLDAPGroupAttribute memberUid # Chercher l'attribut memberUid au lieu de uniqueMember
AuthLDAPGroupAttributeIsDN off # Ne pas chercher un DN complet (uid=user,dc=example,dc=com) dans l'attribut memberUid mais uniquement l'uid AuthLDAPGroupAttributeIsDN off # Ne pas chercher un DN complet (uid=user,dc=example,dc=com) dans l'attribut memberUid mais uniquement l'uid
Require ldap-group cn=svn,ou=group,dc=example,dc=com Require ldap-group cn=svn,ou=group,dc=example,dc=com
Allow from all
</Location> </Location>
~~~ ~~~

View file

@ -20,8 +20,7 @@ Si cela ne fonctionne pas vérifier que vous avez dans le vhost par défaut.
ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/ ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
AllowOverride None AllowOverride None
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
Order allow,deny Require all granted
Allow from all
~~~ ~~~
## Configuration ## Configuration

View file

@ -88,7 +88,7 @@ Fonctionne pour les URL *unsafe*, ici sur le port 8890 :
ProxyPass /unsafe http://127.0.0.1:8890/unsafe ProxyPass /unsafe http://127.0.0.1:8890/unsafe
ProxyPassReverse /unsafe http://127.0.0.1:8890/unsafe ProxyPassReverse /unsafe http://127.0.0.1:8890/unsafe
<Proxy *> <Proxy *>
Allow from All Require all granted
</Proxy> </Proxy>
~~~ ~~~
@ -100,4 +100,4 @@ On peut générer un fichier de conf comme ceci :
thumbor-config >/etc/thumbor.d/thumbor.conf thumbor-config >/etc/thumbor.d/thumbor.conf
~~~ ~~~
Il s'agit d'un script Python entièrement commenté. Il s'agit d'un script Python entièrement commenté.

View file

@ -282,7 +282,7 @@ Voici un VirtualHost type :
ProxyPass / http://127.0.0.1:8080/ ProxyPass / http://127.0.0.1:8080/
ProxyPassReverse / http://127.0.0.1:8080/ ProxyPassReverse / http://127.0.0.1:8080/
<Proxy http://127.0.0.1:8080/> <Proxy http://127.0.0.1:8080/>
Allow from all Require all granted
</Proxy> </Proxy>
</IfModule> </IfModule>
</VirtualHost> </VirtualHost>
@ -399,4 +399,4 @@ Le vhost doit forcer l'envoi du header Content-Length, il ne le fait pas toujour
~~~ ~~~
SetEnv proxy-sendcl SetEnv proxy-sendcl
~~~ ~~~

View file

@ -91,7 +91,7 @@ S'il ne vous est pas possible de mettre à jour Wordpress, une solution est de b
~~~ ~~~
<Files "xmlrpc.php"> <Files "xmlrpc.php">
Deny from all Require all denied
</Files> </Files>
~~~ ~~~
@ -254,8 +254,7 @@ Avec Apache :
~~~ ~~~
<Directory /home/SITE/www/wp-content/uploads/> <Directory /home/SITE/www/wp-content/uploads/>
<FilesMatch "\.php$"> <FilesMatch "\.php$">
Order allow,deny Require all denied
Deny from all
</FilesMatch> </FilesMatch>
</Directory> </Directory>
~~~ ~~~

View file

@ -15,7 +15,7 @@
<http://symfony.com/doc/current/setup/web_server_configuration.html> <http://symfony.com/doc/current/setup/web_server_configuration.html>
Les applications Symfony contiennent souvent des fichiers `.htaccess` avec des directives `DirectoryIndex`, `Options -MultiViews`, `Rewrite*`, `Deny`. Les applications Symfony contiennent souvent des fichiers `.htaccess` avec des directives `DirectoryIndex`, `Options -MultiViews`, `Rewrite*`, `Require`.
Il est donc plutôt conseillé d'utiliser [Apache](HowtoApache) en général. Il est donc plutôt conseillé d'utiliser [Apache](HowtoApache) en général.
La configuration Apache du VirtualHost doit donc contenir au minimum : La configuration Apache du VirtualHost doit donc contenir au minimum :