Contenu | Rechercher | Menus

Annonce

Si vous avez des soucis pour rester connecté, déconnectez-vous puis reconnectez-vous depuis ce lien en cochant la case
Me connecter automatiquement lors de mes prochaines visites.

À propos de l'équipe du forum.

#1 Le 12/06/2007, à 12:07

obiwankennedy

[Résolu]:Problème: Apache 2 sur 80 et 443 avec Virtualhost.

Voilà je cherche à sécuriser une partie de mon site.


Donc voilà, j'ai mon serveur web sur le port 80 qui marche sans problème.
j'ai installé un subversion et un dav . j'ai suivi l'article de la doc :http://doc.ubuntu-fr.org/tutoriel/secur … 2_avec_ssl
Le but de mon travail est de pouvoir accéder à mon site normalement mais si je tape "http://mon_site/svn"
je sois redirigé vers "https://monsite/"
la redirection marche apparemment mais le souci est que à l'adresse https://monsite/ firefox m'affiche "connexion échouée".

J'ai testé en utilisant

openssl s_client -connect ip_locale_serveur:443

j'ai tape la requête suivante

GET /  HTTP/1.1
host: monsite

J'ai bien eu en retour l'index de mon dossier svn.


je vous montre le code de mon site-enabled

<VirtualHost 192.168.0.9:80>
        ServerAdmin *******
        ServerName *****.homelinux.org

        DocumentRoot /var/www/site1/
        <Directory />
                Options FollowSymLinks
                AllowOverride None
        </Directory>
        <Directory /var/www/site1>
                Options Indexes FollowSymLinks MultiViews
                AllowOverride All
                Order allow,deny
                allow from all
                # This directive allows us to have apache2's default start page
                # in /apache2-default/, but still have / go to the right place
                #RedirectMatch ^/$ /apache2-default/
        </Directory>

        ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
        <Directory "/usr/lib/cgi-bin">
                AllowOverride None
                Options ExecCGI -MultiViews +SymLinksIfOwnerMatch
                Order allow,deny
                Allow from all
        </Directory>

        ErrorLog /var/log/apache2/error.log

        # Possible values include: debug, info, notice, warn, error, crit,
        # alert, emerg.
        LogLevel warn

        CustomLog /var/log/apache2/access.log combined
        ServerSignature On

    Alias /doc/ "/usr/share/doc/"
    <Directory "/usr/share/doc/">
Options Indexes MultiViews FollowSymLinks
        AllowOverride None
        Order deny,allow
        Deny from all
        Allow from 127.0.0.0/255.0.0.0 ::1/128
    </Directory>

        Alias /phpmyadmin/ "/var/www/phpmyadmin/"
        <Directory "/var/www/phpmyadmin/">
        AllowOverride None
        Order deny,allow
        Deny from all
        Allow from 192.168.0.0/255.255.255.0
        Allow from 127.0.0.1/255.255.255.0
        </Directory>

        Alias /phpPgAdmin/ "/var/www/phpPgAdmin/"
        <Directory "/var/www/phpPgAdmin/">
                AllowOverride None
                Order deny,allow
                Deny from all
                Allow from 192.168.0.0/255.255.255.0
        </Directory>

        redirect /svn https://renaudguezennec.homelinux.org


</VirtualHost>
<VirtualHost 192.168.0.9:443>
        ServerName renaudguezennec.homelinux.org
        NameVirtualHost  192.168.0.9:443

        DocumentRoot /var/www/svn
        <Directory "/var/www/svn/">
            AllowOverride None
            Order deny,allow
            Deny from all
            Allow from 192.168.0.0/255.255.255.0
       </Directory>
       SSLEngine on
       SSLCertificateFile /etc/apache2/server.crt
       SSLCertificateKeyFile /etc/apache2/server.key
</VirtualHost>

pour finir, dans les logs d'erreurs d'apache2, j'ai ceci

[Tue Jun 12 19:28:33 2007] [warn] RSA server certificate is a CA certificate (BasicConstraints: CA == TRUE !?)
[Tue Jun 12 19:28:33 2007] [warn] RSA server certificate is a CA certificate (BasicConstraints: CA == TRUE !?)
[Tue Jun 12 19:28:33 2007] [notice] Apache/2.2.3 (Debian) DAV/2 SVN/1.4.2 PHP/5.2.0-8+etch4 mod_ssl/2.2.3 OpenSSL/0.9.8c configured -- resuming normal operations

Cordialement

Dernière modification par obiwankennedy (Le 07/07/2008, à 02:17)


Dans mes logiciels, j'écris ton nom.
SGNGD: SvgGd is Not GD
Rolisteam

Hors ligne

#2 Le 12/06/2007, à 14:24

davidB21

Re : [Résolu]:Problème: Apache 2 sur 80 et 443 avec Virtualhost.

Bonjour,

Je ne suis pas sûr de moi, mais bon ça ne coûte rien d'essayer: comme tu es en SSL, tes virtualhosts sont donc basés sur l'IP, alors pourquoi tu as cette ligne :

NameVirtualHost  192.168.0.9:443

?
fais un essai sans, et sans oublier de bien redémarrer Apache (sudo /etc/init.d/apache2 force-reload).

Hors ligne

#3 Le 12/06/2007, à 19:58

obiwankennedy

Re : [Résolu]:Problème: Apache 2 sur 80 et 443 avec Virtualhost.

J'ai réglé le problème je sais pas trop comment.
J'ai ajouté des règles dans mon fichier hosts. Et la ligne

NameVirtualHost  192.168.0.9:443

a été mise tout en haut. du fichier de conf et ça passe.


Dans mes logiciels, j'écris ton nom.
SGNGD: SvgGd is Not GD
Rolisteam

Hors ligne

#4 Le 14/06/2007, à 09:23

jean-charles

Re : [Résolu]:Problème: Apache 2 sur 80 et 443 avec Virtualhost.

Bjr,
On peut en savoir plus, notamment montrer les fichiers de config, car j'ai un pbme similaire...

Merci d'avance.

Jean-charles.

#5 Le 14/06/2007, à 09:34

obiwankennedy

Re : [Résolu]:Problème: Apache 2 sur 80 et 443 avec Virtualhost.

Voilà, mon fichier de apache2/site-enabled/000-default.conf

NameVirtualHost  192.168.0.9:443
<VirtualHost 192.168.0.9:80>
        ServerAdmin *****
        ServerName ******.homelinux.org
#NameVirtualHost  192.168.0.9:80

        DocumentRoot /var/www/site1/
        <Directory />
                Options FollowSymLinks
                AllowOverride None
        </Directory>
        <Directory /var/www/site1>
                Options Indexes FollowSymLinks MultiViews
                AllowOverride All
                Order allow,deny
                allow from all
                # This directive allows us to have apache2's default start page
                # in /apache2-default/, but still have / go to the right place
                #RedirectMatch ^/$ /apache2-default/
        </Directory>

        ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
        <Directory "/usr/lib/cgi-bin">


                AllowOverride None
                Options ExecCGI -MultiViews +SymLinksIfOwnerMatch
                Order allow,deny
                Allow from all
        </Directory>

        ErrorLog /var/log/apache2/error.log

        # Possible values include: debug, info, notice, warn, error, crit,
        # alert, emerg.
        LogLevel warn

        CustomLog /var/log/apache2/access.log combined
        ServerSignature On

    Alias /doc/ "/usr/share/doc/"
    <Directory "/usr/share/doc/">
        Options Indexes MultiViews FollowSymLinks
        AllowOverride None
        Order deny,allow
        Deny from all
        Allow from 127.0.0.0/255.0.0.0 ::1/128
    </Directory>
 Alias /phpmyadmin/ "/var/www/phpmyadmin/"
        <Directory "/var/www/phpmyadmin/">
        AllowOverride None
        Order deny,allow
        Deny from all
        Allow from 192.168.0.0/255.255.255.0
        Allow from 127.0.0.1/255.255.255.0
        </Directory>

        Alias /phpPgAdmin/ "/var/www/phpPgAdmin/"
        <Directory "/var/www/phpPgAdmin/">
                AllowOverride None
                Order deny,allow
                Deny from all
                Allow from 192.168.0.0/255.255.255.0
                Allow from 127.0.0.1/255.255.255.0
        </Directory>
        Alias /html/ "/var/www/site1/html/"
        <Directory "/var/www/site1/html">
             AllowOverride All
             Order allow,deny
             Allow from all
        </Directory>
<Location /html>
               AuthType Basic
               AuthName "Subversion Repository"
               AuthUserFile /etc/apache2/dav_svn.passwd
               Require valid-user
        </location>



        redirect /svn https://renaudguezennec.homelinux.org


</VirtualHost>
<VirtualHost 192.168.0.9:443>
        ServerName renaudguezennec.homelinux.org
#       NameVirtualHost  192.168.0.9:443

        DocumentRoot /var/www/repository
        <Directory "/var/www/repository/">
        Options Indexes FollowSymLinks MultiViews
            AllowOverride None
            Order allow,deny
            Allow from all
        </Directory>

        SSLEngine on
        SSLCertificateFile /etc/apache2/server.cert
        SSLCertificateKeyFile /etc/apache2/server.key

<Location />
        DAV svn
        SVNPath /home/renaud/repository
        AuthType Basic
        AuthName "Subversion Repository"
        AuthUserFile /etc/apache2/dav_svn.passwd
        Require valid-user
</location>
</VirtualHost>

et mon fichier hosts de mon serveur, la 3eme regle je l'ai mise aussi sur mon client mais bon je pense pas que sa change grand chose.

127.0.0.1       localhost
127.0.0.1       HomeOne
192.168.0.9 renaudguezennec.homelinux.org
[...]

Dernière modification par obiwankennedy (Le 07/07/2008, à 02:18)


Dans mes logiciels, j'écris ton nom.
SGNGD: SvgGd is Not GD
Rolisteam

Hors ligne

#6 Le 14/06/2007, à 09:58

davidB21

Re : [Résolu]:Problème: Apache 2 sur 80 et 443 avec Virtualhost.

Et voilà mon fichier de conf pour un site de test en local :

<VirtualHost 127.0.1.3:80>
	ServerName david-laptop.net
	ServerAdmin me@david-laptop.net
	
	DocumentRoot /home/david/www
	
	<Directory /home/david/www/>
		Options Indexes FollowSymLinks MultiViews
		AllowOverride All
		Order allow,deny
		allow from all
	</Directory>

	# Possible values include: debug, info, notice, warn, error, crit,
	# alert, emerg.
	LogLevel debug

	# ErrorLog
	ErrorLog "|/usr/sbin/rotatelogs /home/david/log/apache/error.log 86400"

	# Rotate log files every 24 hours
	CustomLog "|/usr/sbin/rotatelogs /home/david/log/apache/access.log 86400" vhost_combined

	# Rewrite log, only useful for debugging?
	RewriteLog "|/usr/sbin/rotatelogs /home/david/log/apache/rewrite.log 86400"
	
	ServerSignature Off

</VirtualHost>

<VirtualHost 127.0.1.3:443>
        ServerName david-laptop.net
        ServerAdmin me@david-laptop.net

	SSLEngine On
	
	#   Server Certificate:
	SSLCertificateFile /etc/apache2/ssl/david-laptop.net.crt
	#   Server Private Key:
	SSLCertificateKeyFile /etc/apache2/ssl/david-laptop.net.key
	
        DocumentRoot /home/david/www

        <Directory /home/david/www/>
                Options Indexes FollowSymLinks MultiViews
                AllowOverride All
                Order allow,deny
                allow from all
        </Directory>

	# ErrorLog
        ErrorLog "|/usr/sbin/rotatelogs /home/david/log/apache/error.log 86400"

        # Rotate log files every 24 hours
        CustomLog "|/usr/sbin/rotatelogs /home/david/log/apache/access_ssl.log 86400" vhost_ssl
        # Rewrite log, only useful for debugging?
        RewriteLog "|/usr/sbin/rotatelogs /home/david/log/apache/rewrite.log 86400"

        ServerSignature Off
</VirtualHost>

Comme obiwan j'ai modifié mon fichier /etc/hosts pour que la résolution du nom de domaine se fasse.

Hors ligne