WebDAV sur Apache avec LDAP : Différence entre versions
De wikiGite
| Ligne 1 : | Ligne 1 : | ||
| − | <center>''' | + | <center>'''Mise en œuvre d'un serveur WebDAV sous Apache avec LDAP et SSL'''</center> |
| − | |||
| − | + | = PROCEDURE A REVOIR, TESTEE SEULEMENT AVEC HTPASSWD, EN HTTP = | |
| − | |||
| − | |||
<big>'''Procédure adaptée'''</big> | <big>'''Procédure adaptée'''</big> | ||
| − | + | [[Utilisateur:Fsoyer|Fso]] 29 septembre 2008 à 11:48 (CEST) | |
= Installation = | = Installation = | ||
| Ligne 17 : | Ligne 14 : | ||
Charger le module WebDAV | Charger le module WebDAV | ||
| − | + | a2enmod dav | |
| − | + | a2enmod dav_fs | |
| + | a2enmod dav_lock | ||
| + | a2enmod rewrite | ||
| + | dav_fs charge par défaut le module dav. | ||
| − | === | + | === Déclarer WebDAV === |
| − | On crée d'abord un répertoire pour | + | On crée d'abord un répertoire pour les partages : |
| − | + | mkdir /home/pub | |
| + | Dans /etc/apache2/sites-enabled/000-default, remplacer "NameVirtualHost *" par : | ||
| + | NameVirtualHost *:80 | ||
| + | NameVirtualHost *:443 | ||
| + | DAVMinTimeout 600 | ||
| + | DAVDepthInfinity On | ||
| + | Attention, à partir du moment où on a activé SSL, tous les VirtualHosts doivent être assignés soit au port 80 soit au port 443. | ||
| + | |||
| + | Créer le fichier /etc/apache2/sites-availables/webdav : | ||
| + | # To force redirect to SSL VH, uncomment : | ||
| + | #<VirtualHost *:80> | ||
| + | # ServerName mondomaine | ||
| + | # RewriteEngine on | ||
| + | # RewriteCond %{HTTPS} !=on [NC] | ||
| + | # RewriteRule ^.*$ https://%{SERVER_NAME}%{REQUEST_URI} [R,L] | ||
| + | #</VirtualHost> | ||
| + | |||
| + | <VirtualHost *:443> | ||
| + | ServerName mondomaine | ||
| + | ServerAdmin webmaster@mondomaine | ||
| + | SSLEngine On | ||
| + | # If we have a real certificat, give the Authority : | ||
| + | #SSLCACertificateFile /etc/ssl/certs/cacert_class3.crt | ||
| + | SSLCertificateFile /etc/apache2/ssl/mondomaine.crt | ||
| + | SSLCertificateKeyFile /etc/apache2/ssl/mondomaine.key | ||
| + | DocumentRoot /var/www | ||
| + | <Directory /> | ||
| + | Options -Indexes FollowSymLinks | ||
| + | AllowOverride none | ||
| + | </Directory> | ||
| + | DAVLockDB /var/lib/apache2/DAVLockDB | ||
| + | Alias /pub /home/pub/ | ||
| + | <Location /pub> | ||
| + | DAV On | ||
| + | AuthType Basic | ||
| + | AuthName "WebDAV" | ||
| + | AuthBasicProvider ldap | ||
| + | AuthLDAPURL "ldap://127.0.0.1/ou=people,[your base here]” | ||
| + | AuthLDAPRemoteUserIsDN off | ||
| + | ForceType text/plain | ||
| + | Require valid-user | ||
| + | Require ldap-filter &(uid=*) | ||
| + | </Location> | ||
| + | ErrorLog syslog | ||
| + | LogLevel warn | ||
| + | CustomLog /var/log/apache2/access_dav.log combined | ||
| + | </VirtualHost> | ||
| + | |||
| + | ---------------------- ANCIENNE VERSION | ||
Puis dans /etc/apache2/conf/dav.conf | Puis dans /etc/apache2/conf/dav.conf | ||
<Directory /var/www/dav/> | <Directory /var/www/dav/> | ||
| Ligne 43 : | Ligne 91 : | ||
On créé le fichier de mots de passe avec un user test | On créé le fichier de mots de passe avec un user test | ||
#htpasswd -c /var/www/dav/passwd.dav test | #htpasswd -c /var/www/dav/passwd.dav test | ||
| − | + | -------------------- | |
C'est maintenant accessible via navigateur et connexion WebDAV (linux, XP...) | C'est maintenant accessible via navigateur et connexion WebDAV (linux, XP...) | ||
== A suivre : connexion LDAP, et SSL == | == A suivre : connexion LDAP, et SSL == | ||
Version du 8 décembre 2008 à 17:58
Sommaire
PROCEDURE A REVOIR, TESTEE SEULEMENT AVEC HTPASSWD, EN HTTP
Procédure adaptée Fso 29 septembre 2008 à 11:48 (CEST)
Installation
Apache, OpenSSL
voir procédure Apache2 SSL sur Debian Etch
WebDAV
Le module est déjà installé avec apache2.
Charger le module WebDAV
a2enmod dav a2enmod dav_fs a2enmod dav_lock a2enmod rewrite
dav_fs charge par défaut le module dav.
Déclarer WebDAV
On crée d'abord un répertoire pour les partages :
mkdir /home/pub
Dans /etc/apache2/sites-enabled/000-default, remplacer "NameVirtualHost *" par :
NameVirtualHost *:80 NameVirtualHost *:443 DAVMinTimeout 600 DAVDepthInfinity On
Attention, à partir du moment où on a activé SSL, tous les VirtualHosts doivent être assignés soit au port 80 soit au port 443.
Créer le fichier /etc/apache2/sites-availables/webdav :
# To force redirect to SSL VH, uncomment :
#<VirtualHost *:80>
# ServerName mondomaine
# RewriteEngine on
# RewriteCond %{HTTPS} !=on [NC]
# RewriteRule ^.*$ https://%{SERVER_NAME}%{REQUEST_URI} [R,L]
#</VirtualHost>
<VirtualHost *:443>
ServerName mondomaine
ServerAdmin webmaster@mondomaine
SSLEngine On
# If we have a real certificat, give the Authority :
#SSLCACertificateFile /etc/ssl/certs/cacert_class3.crt
SSLCertificateFile /etc/apache2/ssl/mondomaine.crt
SSLCertificateKeyFile /etc/apache2/ssl/mondomaine.key
DocumentRoot /var/www
<Directory />
Options -Indexes FollowSymLinks
AllowOverride none
</Directory>
DAVLockDB /var/lib/apache2/DAVLockDB
Alias /pub /home/pub/
<Location /pub>
DAV On
AuthType Basic
AuthName "WebDAV"
AuthBasicProvider ldap
AuthLDAPURL "ldap://127.0.0.1/ou=people,[your base here]”
AuthLDAPRemoteUserIsDN off
ForceType text/plain
Require valid-user
Require ldap-filter &(uid=*)
</Location>
ErrorLog syslog
LogLevel warn
CustomLog /var/log/apache2/access_dav.log combined
</VirtualHost>
ANCIENNE VERSION
Puis dans /etc/apache2/conf/dav.conf
<Directory /var/www/dav/>
Options Indexes MultiViews
AllowOverride None
Order allow,deny
allow from all
DAV On
# Si on a des messages "HTTP redirect" à la connexion linux, ajouter :
DavDepthInfinity On
SetEnv redirect-carefully 1
AuthType Basic
AuthName "webdav"
AuthUserFile /var/www/dav/passwd.dav
Require valid-user
</Directory>
On créé le fichier de mots de passe avec un user test
#htpasswd -c /var/www/dav/passwd.dav test
C'est maintenant accessible via navigateur et connexion WebDAV (linux, XP...)
