Apache + SSL = Fehler. ;)

Apache, Lighttpd, nginx, Cherokee
Post Reply
banshee
Posts: 11
Joined: 2005-06-16 20:19
 

Apache + SSL = Fehler. ;)

Post by banshee »

Moin, mein Apache mag irgendwie kein SSL schlucken. Die httpd.conf müsste eigentlich korrekt sein, die Zertifikate sind angelegt, trotzdem willer nich.


# rcapache2 startssl
Starting httpd2 (prefork) (98)Address already in use: make_sock: could not bind to address xx.xx.xx.xx:443
no listening sockets available, shutting down
Unable to open logs
startproc: exit status of parent of /usr/sbin/httpd2-prefork: 1
failed

netstat -p -a | grep 443 ergibt auch keinen Output.
Scheinbar lauscht dort nix. ;)

Hier der entsprechende vHost Eintrag der httpd.conf:

<VirtualHost xxx.xxx.xxx.xx>

ServerName yyy.net
ServerAlias xxx.yyy.net
DocumentRoot "/home/htdocs/xxx/"
SSLEngine on
SSLCipherSuite ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+eNULL
SSLCertificateFile /etc/apache2/ssl.crt/server.crt
SSLCertificateFile /etc/apache2/ssl.key/server.key


<Directory "/home/htdocs/xxx/">
allow from all
Options +Indexes
</Directory>

</VirtualHost>

Bin leicht ratlos... die Fehlermeldung besagt ja schließlich, dass der Socket nicht mehr frei ist. Allerdings lauscht auf dem Socket rein gar nix.

Jemand ne Idee?
theton
Posts: 31
Joined: 2006-01-24 11:56
Location: Berlin
Contact:
 

Re: Apache + SSL = Fehler. ;)

Post by theton »

Hast du das Folgende in der Konfiguration?

<IfDefine SSL>
Listen 80
Listen 443
</IfDefine>

Ausserdem muss es dann

<VirtualHost xxx.xxx.xxx.xxx:443>
DocumentRoot "/home/htdocs/xxx/"
SSLEngine on
SSLCipherSuite ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+eNULL
SSLCertificateFile /etc/apache2/ssl.crt/server.crt
SSLCertificateKeyFile /etc/apache2/ssl.key/server.key
...
</VirtualHost>

heissen. Kann sein, dass du dann bei den anderen VirtualHosts ":80" an die IP anhaengen musst, sofern du named VirtualHosts benutzt.
User avatar
Joe User
Project Manager
Project Manager
Posts: 11191
Joined: 2003-02-27 01:00
Location: Hamburg
Contact:
 

Re: Apache + SSL = Fehler. ;)

Post by Joe User »

Normalerweise sollte der SSL-Abschnitt ähnlich dem Folgendem aufgebaut sein:

Code: Select all

<IfDefine SSL>
    Listen 443
    AddType application/x-x509-ca-cert .crt
    AddType application/x-pkcs7-crl .crl
    SSLRandomSeed startup builtin
    SSLRandomSeed connect builtin
    SSLPassPhraseDialog builtin
    SSLSessionCache shm:/var/cache/apache2/ssl_scache(512000)
    SSLSessionCacheTimeout 300
    SSLMutex file:/var/cache/apache2/ssl_mutex
    <VirtualHost _default_:443>
        ServerName www.domain.tld
        ServerAdmin webmaster@domain.tld
        DocumentRoot "/var/www/localhost/htdocs/"
        <Directory "/var/www/localhost/htdocs/">
            Options -All +FollowSymLinks
            AllowOverride AuthConfig FileInfo Indexes Limit Options
            Order allow,deny
            Allow from all
        </Directory>
        ErrorLog logs/ssl_error_log
        TransferLog logs/ssl_access_log
        SSLEngine on
        SSLCipherSuite ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP:+eNULL
        SSLCertificateFile conf/ssl/apache.crt
        SSLCertificateKeyFile conf/ssl/apache.key
        <Files ~ ".(cgi|shtml|pl|php?)$">
            SSLOptions +StdEnvVars
        </Files>
        ScriptAlias /cgi-bin/ "/var/www/localhost/cgi-bin/"
        <Directory "/var/www/localhost/cgi-bin/">
            SSLOptions +StdEnvVars
            Options -All +ExecCGI
            AllowOverride None
            Order allow,deny
            Allow from all
        </Directory>
        SetEnvIf User-Agent ".*MSIE.*" nokeepalive ssl-unclean-shutdown downgrade-1.0 force-response-1.0
        CustomLog logs/ssl_request_log "%t %h %{SSL_PROTOCOL}x %{SSL_CIPHER}x "%r" %b"
    </VirtualHost>
</IfDefine>
Was spucken folgende Befehle aus?

Code: Select all

ps auxf | grep apache
ps auxf | grep httpd
lsof -i :443
PayPal.Me/JoeUserFreeBSD Remote Installation
Wings for LifeWings for Life World Run

„If there’s more than one possible outcome of a job or task, and one
of those outcomes will result in disaster or an undesirable consequence,
then somebody will do it that way.“ -- Edward Aloysius Murphy Jr.
banshee
Posts: 11
Joined: 2005-06-16 20:19
 

Re: Apache + SSL = Fehler. ;)

Post by banshee »

apache:

Code: Select all

root     25985  0.0  2.3 46788 5924 ?        Ss   Jan27   0:03 /usr/sbin/httpd2-prefork -f /etc/apache2/httpd.conf
wwwrun    9537  0.0  3.5 48864 8820 ?        S    00:00   0:00  _ /usr/sbin/httpd2-prefork -f /etc/apache2/httpd.conf
wwwrun    9538  0.0  3.3 48460 8368 ?        S    00:00   0:00  _ /usr/sbin/httpd2-prefork -f /etc/apache2/httpd.conf
wwwrun    9539  0.0  3.4 48748 8636 ?        S    00:00   0:00  _ /usr/sbin/httpd2-prefork -f /etc/apache2/httpd.conf
wwwrun    9540  0.0  3.5 48828 8796 ?        S    00:00   0:01  _ /usr/sbin/httpd2-prefork -f /etc/apache2/httpd.conf
wwwrun    9541  0.0  3.4 48760 8680 ?        S    00:00   0:01  _ /usr/sbin/httpd2-prefork -f /etc/apache2/httpd.conf
wwwrun    9548  0.0  3.5 48764 8764 ?        S    00:00   0:00  _ /usr/sbin/httpd2-prefork -f /etc/apache2/httpd.conf
wwwrun    9551  0.0  3.4 48600 8572 ?        S    00:00   0:00  _ /usr/sbin/httpd2-prefork -f /etc/apache2/httpd.conf
wwwrun    9552  0.0  3.3 48460 8372 ?        S    00:00   0:00  _ /usr/sbin/httpd2-prefork -f /etc/apache2/httpd.conf
wwwrun    9634  0.1  3.4 48536 8452 ?        S    00:24   0:00  _ /usr/sbin/httpd2-prefork -f /etc/apache2/httpd.conf

httpd:

Code: Select all

root     25985  0.0  2.3 46788 5924 ?        Ss   Jan27   0:03 /usr/sbin/httpd2-prefork -f /etc/apache2/httpd.conf
wwwrun    9537  0.0  3.5 48864 8820 ?        S    00:00   0:00  _ /usr/sbin/httpd2-prefork -f /etc/apache2/httpd.conf
wwwrun    9538  0.0  3.3 48460 8368 ?        S    00:00   0:00  _ /usr/sbin/httpd2-prefork -f /etc/apache2/httpd.conf
wwwrun    9539  0.0  3.4 48748 8636 ?        S    00:00   0:00  _ /usr/sbin/httpd2-prefork -f /etc/apache2/httpd.conf
wwwrun    9540  0.0  3.5 48828 8796 ?        S    00:00   0:01  _ /usr/sbin/httpd2-prefork -f /etc/apache2/httpd.conf
wwwrun    9541  0.0  3.4 48760 8680 ?        S    00:00   0:01  _ /usr/sbin/httpd2-prefork -f /etc/apache2/httpd.conf
wwwrun    9548  0.0  3.5 48764 8764 ?        S    00:00   0:00  _ /usr/sbin/httpd2-prefork -f /etc/apache2/httpd.conf
wwwrun    9551  0.0  3.4 48600 8572 ?        S    00:00   0:00  _ /usr/sbin/httpd2-prefork -f /etc/apache2/httpd.conf
wwwrun    9552  0.0  3.3 48460 8372 ?        S    00:00   0:00  _ /usr/sbin/httpd2-prefork -f /etc/apache2/httpd.conf
wwwrun    9634  0.1  3.4 48536 8452 ?        S    00:24   0:00  _ /usr/sbin/httpd2-prefork -f /etc/apache2/httpd.conf
lsof -i :443 spuckt gar nix aus. ;)


BTW: Der SSL Abschnitt wo genau? in der httpd.conf? (dort trag ich die ganzen vhosts ein. mag mich jemand schlagen, aber so empfinde ich es am angenehmsten. ^^

Danke schon mal für die schnelle Reaktion. ;)
User avatar
Joe User
Project Manager
Project Manager
Posts: 11191
Joined: 2003-02-27 01:00
Location: Hamburg
Contact:
 

Re: Apache + SSL = Fehler. ;)

Post by Joe User »

Code: Select all

/etc/init.d/apache2 stop
/etc/init.d/apache2 start
banshee wrote:BTW: Der SSL Abschnitt wo genau? in der httpd.conf?
In der httpd.conf direkt vor Deine *:80er vHosts. Du musst zudem die notwendigen Module laden und -D SSL beim Starten übergeben (YaST). Desweiteren musst Du den Abschnitt an Dein System anpassen...
PayPal.Me/JoeUserFreeBSD Remote Installation
Wings for LifeWings for Life World Run

„If there’s more than one possible outcome of a job or task, and one
of those outcomes will result in disaster or an undesirable consequence,
then somebody will do it that way.“ -- Edward Aloysius Murphy Jr.
theton
Posts: 31
Joined: 2006-01-24 11:56
Location: Berlin
Contact:
 

Re: Apache + SSL = Fehler. ;)

Post by theton »

Ich wuerds mal mit

apachectl startssl

versuchen. :)
Dein Apache wird naemlich garnicht mit SSL gestartet. Muesste dann naemlich in der Prozessliste etwa so aussehen:

Code: Select all

8262 ?        S      0:00 /usr/sbin/httpd -f /etc/httpd/httpd.conf -D SSL
Schliesslich steht in der Konfiguration <IfDefine SSL> und wenn man es nicht definiert, wird es auch nicht benutzt.
banshee
Posts: 11
Joined: 2005-06-16 20:19
 

Re: Apache + SSL = Fehler. ;)

Post by banshee »

Dass der Indianer, sofern ich SSL haben will, auch mit der entsprechenden Option bzw. (is ja suse. :D) mit rcapache2 startssl gestartet werden muss war mir schon klar. Ganz so DAU wie das hier ggf. ankommen mag bin ich dann doch nicht. Nur so ein wenig. :D

Joe, auch wenn ich den von dir geposteten IFDEFINE Teil in die httpd.conf übernehme, nachdem ich ihn angepasst habe, passiert nüx, bzw. spuckt er folgende Fehlermeldung raus:

Code: Select all

# rcapache2 startssl
Starting httpd2 (prefork) startproc:  exit status of parent of /usr/sbin/httpd2-prefork: 1
                                                                     failed
#
Immerhin meckert er nicht mehr, dass er nicht auf den Socket schon belegt sei...


Hier mal die httpd.conf

Code: Select all

#
# /etc/apache2/httpd.conf 
#
Include /etc/apache2/uid.conf
Include /etc/apache2/server-tuning.conf
ErrorLog /var/log/apache2/error_log
Include /etc/apache2/sysconfig.d/loadmodule.conf
Include /etc/apache2/listen.conf
Include /etc/apache2/mod_log_config.conf
Include /etc/apache2/sysconfig.d/global.conf
Include /etc/apache2/mod_status.conf
Include /etc/apache2/mod_info.conf
Include /etc/apache2/mod_usertrack.conf
Include /etc/apache2/mod_autoindex-defaults.conf
TypesConfig /etc/apache2/mime.types
DefaultType text/plain
Include /etc/apache2/mod_mime-defaults.conf
Include /etc/apache2/errors.conf
Include /etc/apache2/ssl-global.conf
<Directory />
    Options None
    AllowOverride None
    Order deny,allow
    Deny from all
</Directory>

AccessFileName .htaccess
<Files ~ "^.ht">
    Order allow,deny
    Deny from all
</Files>

DirectoryIndex index.html index.html.var index.htm index.php index.php3
Include /etc/apache2/default-server.conf
Include /etc/apache2/sysconfig.d/include.conf
Include /etc/apache2/vhosts.d/*.conf

<IfDefine SSL>
    Listen 443
    AddType application/x-x509-ca-cert .crt
    AddType application/x-pkcs7-crl .crl
    SSLRandomSeed startup builtin
    SSLRandomSeed connect builtin
    SSLPassPhraseDialog builtin
    SSLSessionCache shm:/var/cache/apache2/ssl_scache(512000)
    SSLSessionCacheTimeout 300
    SSLMutex file:/var/cache/apache2/ssl_mutex
    <VirtualHost xxx.xxx.xxx.xxx:443>
        ServerAdmin webmaster@xxx.de
        DocumentRoot "/home/htdocs/"
        <Directory "/home/htdocs/">
            Options -All +FollowSymLinks
            AllowOverride AuthConfig FileInfo Indexes Limit Options
            Order allow,deny
            Allow from all
        </Directory>
        ErrorLog logs/ssl_error_log
        TransferLog logs/ssl_access_log
        SSLEngine on
        SSLCipherSuite ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP:+eNULL
        SSLCertificateFile ssl.crt/apache.crt
        SSLCertificateKeyFile ssl.key/apache.key
        <Files ~ ".(cgi|shtml|pl|php?)$">
            SSLOptions +StdEnvVars
        </Files>
        ScriptAlias /cgi-bin/ "/home/htdocs/cgi-bin/"
        <Directory "/home/htdocs/cgi-bin/">
            SSLOptions +StdEnvVars
            Options -All +ExecCGI
            AllowOverride None
            Order allow,deny
            Allow from all
        </Directory>
        SetEnvIf User-Agent ".*MSIE.*" nokeepalive ssl-unclean-shutdown downgrade-1.0 force-response-1.0
        CustomLog logs/ssl_request_log "%t %h %{SSL_PROTOCOL}x %{SSL_CIPHER}x "%r" %b"
    </VirtualHost>
</IfDefine> 







<VirtualHost xxx.xxx.xxx.xxx:433>

		ServerName xxx.net
		ServerAlias yyy.xxx.net
		ServerAdmin webmaster@xxx.net
		DocumentRoot "/home/htdocs/xxx/"
		SSLEngine on
		SSLCipherSuite ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+eNULL
		SSLCertificateFile /etc/apache2/ssl.crt/server.crt
		SSLCertificateFile /etc/apache2/ssl.key/server.key


        <Directory "/home/htdocs/xxx/">
					allow from all
					Options +Indexes
				</Directory>

</VirtualHost>


(Die restlichen 50 vHosts hab ich mal rausgenommen. ;))

Irgendwas falsch?
Last edited by banshee on 2006-01-31 00:55, edited 2 times in total.
User avatar
Joe User
Project Manager
Project Manager
Posts: 11191
Joined: 2003-02-27 01:00
Location: Hamburg
Contact:
 

Re: Apache + SSL = Fehler. ;)

Post by Joe User »

banshee wrote:Dürfte ich dir ggf. meine httpd. conf per mail schicken?
Lege sie bitte zum Download bereit, dann können Dir auch Andere helfen...
PayPal.Me/JoeUserFreeBSD Remote Installation
Wings for LifeWings for Life World Run

„If there’s more than one possible outcome of a job or task, and one
of those outcomes will result in disaster or an undesirable consequence,
then somebody will do it that way.“ -- Edward Aloysius Murphy Jr.
banshee
Posts: 11
Joined: 2005-06-16 20:19
 

Re: Apache + SSL = Fehler. ;)

Post by banshee »

Lege sie bitte zum Download bereit, dann können Dir auch Andere helfen...
Siehe oben.
User avatar
Joe User
Project Manager
Project Manager
Posts: 11191
Joined: 2003-02-27 01:00
Location: Hamburg
Contact:
 

Re: Apache + SSL = Fehler. ;)

Post by Joe User »

Hast Du eine oder mehrere IP-Adresse(n)? Du darfst pro IP nur einen SSL-vHost definieren, aktuell sind es mindestens zwei. An welchen Dateien in /etc/apache2 hast Du noch Ã?nderungen vorgenommen?
PayPal.Me/JoeUserFreeBSD Remote Installation
Wings for LifeWings for Life World Run

„If there’s more than one possible outcome of a job or task, and one
of those outcomes will result in disaster or an undesirable consequence,
then somebody will do it that way.“ -- Edward Aloysius Murphy Jr.
User avatar
isotopp
Posts: 471
Joined: 2003-08-21 10:21
Location: Berlin
Contact:
 

Re: Apache + SSL = Fehler. ;)

Post by isotopp »

banshee wrote:# rcapache2 startssl
Starting httpd2 (prefork) (98)Address already in use: make_sock: could not bind to address xx.xx.xx.xx:443
Could not bind to address bei einem bind(2) system call kommt von EINVAL Fehler. EINVAL bedeutet entweder: "Der Port ist schon gebunden" (lsof wird Dir sagen, ob das der Fall ist), oder "Die IP ist keine lokale IP dieser Maschine" (kann nur passieren, wenn es kein Bind "*" ist).

Nach Deiner Darstellung wahrscheinlich also ein Typo in der IP.
banshee
Posts: 11
Joined: 2005-06-16 20:19
 

Re: Apache + SSL = Fehler. ;)

Post by banshee »

Alles klar... ;) Dadurch, dass ich nur noch einen VHost mit SSL definiert habe, lässt sich der Apache auch im SSL Mode starten. Schon mal ein Schritt in die richtige Richtung... allerdings kann ich nun nicht auf die Daten zugreifen.

Hier nochmal der genaue Auszug aus der httpd.conf:

Code: Select all

124 <IfDefine SSL>
    125     Listen 443
    126     AddType application/x-x509-ca-cert .crt
    127     AddType application/x-pkcs7-crl .crl
    128     SSLRandomSeed startup builtin
    129     SSLRandomSeed connect builtin
    130     SSLPassPhraseDialog builtin
    131     SSLSessionCache shm:/var/cache/apache2/ssl_scache(512000)
    132     SSLSessionCacheTimeout 300
    133     SSLMutex file:/var/cache/apache2/ssl_mutex
    134     <VirtualHost 217.160.110.35:443>
    135         ServerAdmin webmaster@xxx.de
    136         ServerName xxx.de
    137         DocumentRoot "/home/htdocs/xxx/htdocs/blogg/"
    138         <Directory "/home/htdocs/xxx/htdocs/blogg/">
    139             Options -All +FollowSymLinks
    140             AllowOverride AuthConfig FileInfo Indexes Limit Options
    141             Order allow,deny
    142             Allow from all
    143         </Directory>
    144         ErrorLog /home/htdocs/xxx/logs/error.log
    145         TransferLog /home/htdocs/xxx/logs/access.log
    146         SSLEngine on
    147         SSLCipherSuite ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:        +SSLv2:+EXP:+eNULL
    148         SSLCertificateFile /etc/apache2/ssl.crt/server.crt
    149         SSLCertificateKeyFile /etc/apache2/ssl.key/server.key
    150         <Files ~ ".(cgi|shtml|pl|php?)$">
    151             SSLOptions +StdEnvVars
    152         </Files>
    153         ScriptAlias /cgi-bin/ "/home/htdocs/o-host.de/cgi-bin/"
    154         <Directory "/home/htdocs/xxx/cgi-bin/">
    155             SSLOptions +StdEnvVars
    156             Options -All +ExecCGI
    157             AllowOverride None
    158             Order allow,deny
    159             Allow from all
    160         </Directory>
    161         SetEnvIf User-Agent ".*MSIE.*" nokeepalive ssl-unclean-shutdo        wn downgrade-1.0 force-response-1.0
    162         CustomLog logs/ssl_request_log "%t %h %{SSL_PROTOCOL}x %{SSL_        CIPHER}x "%r" %b"
    163     </VirtualHost>
    164 </IfDefine>

Post Reply