banane31
Goto Top

Lets Encrypt SSL mit Apache2

Hallo zusammen,

da StartSSL ja leider nicht mehr vertraut wird, habe ich mir nun eine Alternative gesucht und bin bei Lets Encrypt gelandet.

Ich bin nach dieser Anleitung vorgegangen:
https://linux-scout.de/webserver/lets-encrypt-unter-debian-fuer-apache2- ...

Leider bekomme ich eine Fehlermeldung beim Anfordern

Zum System:
Debian 8.6.0
8GB RAM
Xeon E5-2630v4 (2vCore)

Auf dem Server liegen diverse Domains und Subdomains.

abc.de
abc.net
abc.org
xyz.de
blog.xyz.de
forum.xyz.de
webmail.xyz.de

Aufgebaut ist das ganze so:

/etc/apache2/sites-available
abc_de.conf
abc_net.conf
forum_xyz_de.conf

die Seiten liegen dann alle im Unterverzeichnis /var/www/abc_de etc.

Nun kommt bei dem Anfordern eines Zertifikates die Meldung:

We were unable to find a vhost with a ServerName or Address of abc_de
Which virtual host would you like to choose?
(note: conf files with multiple vhosts are not yet supported)
1: 000-default.conf | Multiple Names | | Enabled
2: 000-default-le-ssl.conf | Multiple Names | HTTPS | Enabled
3: default-ssl.conf | | HTTPS |
Select the appropriate number [1-3] then [enter] (press 'c' to cancel): c
No vhost exists with servername or alias of:abc_de (or it's in a file with multiple vhosts, which Certbot can't parse yet). No vhost was selected. Please specify ServerName or ServerAlias in the Apache config, or split vhosts into separate files.
Falling back to default vhost *:443...

Hier kommt meine .conf Datei leider nicht zur Auswahl.
Was ,uiss ich hier anpassen bzw. ändern?
Ich möchte nicht alles in einer .conf Datei stehen haben...

Gruß

Content-Key: 330427

Url: https://administrator.de/contentid/330427

Ausgedruckt am: 19.03.2024 um 07:03 Uhr

Mitglied: SlainteMhath
SlainteMhath 24.02.2017 um 08:56:05 Uhr
Goto Top
Moin,

Auf dem Server liegen diverse Domains und Subdomains.

ich nehme an es liegt an
(note: conf files with multiple vhosts are not yet supported)

Also: pro Vhost eine .conf basteln (is eh sauberer) und dann sollte das klappen.

lg,
Slainte
Mitglied: marinux
marinux 24.02.2017 um 08:57:02 Uhr
Goto Top
Hallo,

füge deinen confs jeweils die ServerName Direktive (http://httpd.apache.org/docs/2.2/de/mod/core.html#servername) hinzu.

Gruß
Mitglied: Voiper
Voiper 24.02.2017 um 08:58:58 Uhr
Goto Top
Wie sieht denn deine .conf Datei aus? ServerName und ServerAlias korrekt eingetragen?

Gruß, V
Mitglied: banane31
banane31 24.02.2017 um 09:02:42 Uhr
Goto Top
Hallo,

danke für die Antworten..
@SlainteMhath
Die Config Dateien sind soweit ja sepperiert.

@marinuxx hier mal eine Config.
user@web:/etc/apache2/sites-available$ cat abc_de.conf
<VirtualHost *:80>
ServerAdmin admin@abc.de
ServerName www.abc.de
ServerAlias abc_de
Redirect "/" "https://www.abc.de/"
DocumentRoot /var/www/abc_de
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
LogLevel notice
CustomLog /var/log/apache2/access.log combined
ErrorLog /var/log/apache2/error.log
ServerSignature On
</VirtualHost>


<VirtualHost *:443>
SSLEngine on
SSLCertificateFile /abc_de.crt
SSLCertificateKeyFile /abc_de.key
SSLCertificateChainFile /StartSSL-ROOT-CA.crt

ServerAdmin admin@abc.de
ServerName www.abc.de
ServerAlias abc.de
DocumentRoot /var/www/abc_de
</VirtualHost>
Mitglied: Voiper
Voiper 24.02.2017 um 09:19:26 Uhr
Goto Top
Tippfehler? We were unable to find a vhost with a ServerName or Address of abc_de t.

Was macht das t da hinten dran?
Mitglied: banane31
banane31 24.02.2017 um 09:21:47 Uhr
Goto Top
Zitat von @Voiper:

Tippfehler? We were unable to find a vhost with a ServerName or Address of abc_de t.

Was macht das t da hinten dran?

Tippfehler.
Bitte ich zu entschuldigen. Ist im Beitrag korrigiert. Ist irgendwie dazwischen gerutscht.
Mitglied: Voiper
Voiper 24.02.2017 um 09:28:39 Uhr
Goto Top
Ok. Hätte ja im Command stehen können ;)
Mitglied: Voiper
Voiper 24.02.2017 um 09:43:53 Uhr
Goto Top
Blöde Frage: Enabled sind deine Seiten aber?
Mitglied: banane31
banane31 24.02.2017 um 09:53:53 Uhr
Goto Top
Ja die Seiten sind enabled und auch soweit eigentlich via https erreichbar. Nur aktuell unter einem StartSSL Zertifikat.
Mitglied: Voiper
Voiper 24.02.2017 um 09:59:33 Uhr
Goto Top
Schalte mal den https sektor aus bevor du das Zertifikat erstellst (Und den redirect). Soweit ich mich recht erinnere, wird initial auf http geprüft.
Mitglied: banane31
banane31 24.02.2017 um 10:11:15 Uhr
Goto Top
Die Seite ist nun via http erreichbar.
Allerdings immernoch das selbe Problem.


user@web:~/letsencrypt# ./letsencrypt-auto --rsa-key-size 4096 -d www.abc.de -d abc.de
Saving debug log to /var/log/letsencrypt/letsencrypt.log
Obtaining a new certificate
Performing the following challenges:
tls-sni-01 challenge for www.abc.de
tls-sni-01 challenge for abc.de

We were unable to find a vhost with a ServerName or Address of www.abc.de.
Which virtual host would you like to choose?
(note: conf files with multiple vhosts are not yet supported)
1: 000-default.conf | Multiple Names | | Enabled
2: 000-default-le-ssl.conf | Multiple Names | HTTPS | Enabled
3: default-ssl.conf | | HTTPS |
Select the appropriate number [1-3] then [enter] (press 'c' to cancel):

Was mich halt wundert, dass ich in der Auswahl (1-3) nicht meine eigenen .conf Dateien erhalte/sehe.
Mitglied: Voiper
Voiper 24.02.2017 um 10:17:28 Uhr
Goto Top
Das ist echt merkwürdig. Was du noch versuchen kannst, ist den ServerAlias auch auf www.abc.de zu setzen

Also ServerAlias www.abc.de abc.de
Mitglied: SlainteMhath
Lösung SlainteMhath 24.02.2017 um 11:02:45 Uhr
Goto Top
@slain
AAArg... bitte vergewaltige den Namen nicht... das mindeste was sein muss ist Slainte! Slain.. geht gar nicht.. pff

Die Config Dateien sind soweit ja sepperiert.
Nö ist sie nicht, wie hier zu sehen:
@marinuxx hier mal eine Config.
user@web:/etc/apache2/sites-available$ cat abc_de.conf
<VirtualHost *:80>
[...]
</VirtualHost>

<VirtualHost *:443>
[...]
</VirtualHost>

(note: conf files with multiple vhosts are not yet supported

Auf Deutsch: keine conf Files mit mehreren VirtualHost!! Also, neuer Versuch bitte .)
Mitglied: banane31
banane31 24.02.2017 um 11:05:17 Uhr
Goto Top
@SlainteMhath

Namen angepasst ;)

Also nur eine .conf mit Bindung Port 80 und gut. Dann let's try
Mitglied: banane31
banane31 24.02.2017 um 11:07:59 Uhr
Goto Top
OK sieht besser aus, wenn nur eine Bindung existiert.
Aber ich stehe dann bei etwas anderem auf dem Schlauch....

Benötige ich dann 2 Configs für eine Webseite?
Weil ich möchte die http auf https redirecten. lege also meine configs neu an

1x abc_de_http.conf
1x abc_de_https.conf

Korrekt?
Mitglied: Voiper
Voiper 24.02.2017 um 11:09:31 Uhr
Goto Top
du kannst den einen block auskommentieren, zertifikat erstellen und dann deine config wieder nutzen. Wird dann aber problematisch, wenn du den Renew per cron laufen lassen möchtest. In dem Fall benötigst du zwei configs face-smile
Mitglied: marinux
marinux 24.02.2017 um 11:09:50 Uhr
Goto Top
Ja, und in der http conf machst du den redirect auf https.
Mitglied: banane31
banane31 24.02.2017 um 11:28:27 Uhr
Goto Top
Ja bezüglich dem renew muss ich mal schauen, wie ich das automatisiert bekomme face-smile
Gibt es ja bestimmt diverse Anleitungen zu im Netz.
Werde dann einfach 2 Configs pro Webseite anlegen und gut face-smile

Bleibt nur noch die Frage offen:
Wenn ich von http auf https ein redirect mache, bringen mir auch die 2 Configs nichts für Let's Encrypt, da die ja via http connecten wollen...?
Mitglied: SlainteMhath
SlainteMhath 24.02.2017 aktualisiert um 11:30:48 Uhr
Goto Top
Namen angepasst ;)
Danke face-smile

Benötige ich dann 2 Configs für eine Webseite?
1x abc_de_http.conf
1x abc_de_https.conf
Ja genau. Wobei du den http-VHost mE reduzieren kannst auf

<VirtualHost *:80>
  ServerName www.abc.de
  ServerAlias abc_de
  Redirect "/" "https://www.abc.de/"  
</VirtualHost>
Mitglied: Voiper
Voiper 24.02.2017 um 11:36:27 Uhr
Goto Top
Ja genau. Wobei du den http-VHost mE reduzieren kannst auf

> <VirtualHost *:80>
>   ServerName www.abc.de
>   ServerAlias abc_de
>   Redirect "/" "https://www.abc.de/"  
> </VirtualHost>
> 


Korrekt. Mehr braucht es nicht. Der Rest kommt in die HTTPS-Config.