mar 23

WebDAV (Web enabled Distributed Authoring and Versioning) , fournit un environnement partagé aux utilisateurs pour éditer/gérer leurs fichiers sur les serveurs Web. Techniquement, DAV est une extension du protocole http. Ca ressemble un peu beaucoup au FTP et est disponible sous les principales plateformes OS.

Installation

On suppose qu’Apache2 est déjà installé sur le système cible.

Il faut installer les modules dav qui sont fournis par Apache2 mais pas activés par défaut.
On les active en créant un lien symbolique vers /etc/apache2/mods-enabled

cd /etc/apache2/mods-enabled
n -s ../mods-available/dav* .

Configuration Apache2

On ajoute un virtualhost par exemple en modifiant le fichier/etc/apache2/sites-available/default.

<VirtualHost *:80>
ServerName wpub.mondomaine
ServerAlias wpub.mondomaine
ServerAdmin webmaster@mondomaine
DocumentRoot /var/www/wpub

<Directory /var/www/wpub>
Options Indexes FollowSymLinks
#AllowOverride All
AllowOverride AuthConfig
Order allow,deny
allow from all
DAV on
AuthName “Stockage WebDAV”
AuthType Basic
AuthUserFile /etc/apache2/htpasswd-webdav
Require valid-user
<Limit GET PUT POST DELETE PROPFIND PROPPATCH MKCOL COPY MOVE LOCK UNLOCK>
</Limit>
<LimitExcept GET>
Require valid-user
</LimitExcept>
</Directory>

</VirtualHost>

nov 25

Activation du mode SSL pour Apache

a2enmod ssl

Création des certificats

On va créer un certificat autosigné pour un site désormais célèbre toto.
Pour cela, on crée un répertoire du genre __sslconf__.

testing:~# mkdir sslconf

testing:~# cd sslconf/

testing:~/sslconf# openssl req -config /etc/ssl/openssl.cnf -new -out toto.csr

Generating a 1024 bit RSA private key
…++++++
writing new private key to ‘privkey.pem’
Enter PEM pass phrase:
Verifying - Enter PEM pass phrase:
—–
You are about to be asked to enter information that will be incorporated
into your certificate request.
What you are about to enter is what is called a Distinguished Name or a DN.
There are quite a few fields but you can leave some blank
For some fields there will be a default value,
If you enter ‘.’, the field will be left blank.
—–
Country Name (2 letter code) [AU]:FR
State or Province Name (full name) [Some-State]:PARIS
Locality Name (eg, city) []:PARIS
Organization Name (eg, company) [Internet Widgits Pty Ltd]:MOI
Organizational Unit Name (eg, section) []:
Common Name (eg, YOUR name) []:MOI
Email Address []:moi@moi.fr

Please enter the following ‘extra’ attributes
to be sent with your certificate request
A challenge password []:
An optional company name []:

Une fois terminée cette opération, on obtient alors deux nouveaux fichiers comme indiqué ci-dessous.

testing:~/sslconf# ls -l
total 2
-rw-r–r– 1 root root 660 2007-02-20 19:37 toto.csr
-rw-r–r– 1 root root 963 2007-02-20 19:37 privkey.pem

Maintenant, on doit créer une “pass phrase”.

testing:~/sslconf# openssl rsa -in privkey.pem -out toto.key
Enter pass phrase for privkey.pem:
writing RSA key

On se crée un certificat valable pour 3650 jours!!

testing:~/sslconf# openssl x509 -in toto.csr -out toto.crt -req -signkey toto.key -days 3650

Signature ok

subject=/C=FR/ST=PARIS/L=PARIS/O=MOI/CN=MOI/emailAddress=moi@moi.fr

Getting Private key

testing:~/sslconf# openssl x509 -in toto.crt -out toto.der.crt -outform DER

Copie des certificats pour Apache

testing:~/sslconf# cp toto.crt toto.key /etc/apache2/

Configuration APACHE

# Modifier le fichier /etc/apache2/ports.conf

On rajoute la ligne “Listen 443″ à ce fichier pour obtenir

Listen 80
Listen 443

# reste a modifier le fichier /etc/apache2/mods-available/ssl.conf

on rajoute au debut les deux lignes suivantes :

SSLCertificateFile /etc/apache2/toto.crt

SSLCertificateKeyFile /etc/apache2/toto.key

On relance Apache et le tour est joué.