Nextcloud SSL gond

A problémám a következő: Nextcloud telepítve proxmox VM-ben. Innen. (Egyébként szuper munka, ha valakinek kell egy előkonfigurált natív nextcloud vm, jó szívvel ajánlom. A post install script is zseniális!) A VM importálása és a telepítés is simán zajlott. Http-n tökéletesen üzemel. Szerettem volna saját tanúsítvánnyal validálni. Ehhez ezt a leírást követtem. Feltöltöttem a megfelelő könyvtárakba a pem és a key fájlokat, módosítottam a default-ssl.conf állományt. Majd amikor újraindítottam az apache2 service-t akkor ezt kapom:

Jun 06 10:48:53 nextcloud systemd[1]: Starting apache2.service - The Apache HTTP Server...
Jun 06 10:48:53 nextcloud apachectl[2031]: AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1. Set the 'ServerName' directive globally to suppress this message
Jun 06 10:48:53 nextcloud systemd[1]: apache2.service: Control process exited, code=exited, status=1/FAILURE
Jun 06 10:48:53 nextcloud systemd[1]: apache2.service: Failed with result 'exit-code'.
Jun 06 10:48:53 nextcloud systemd[1]: Failed to start apache2.service - The Apache HTTP Server.
root@nextcloud:~# systemctl start apache2.service 
Job for apache2.service failed because the control process exited with error code.
See "systemctl status apache2.service" and "journalctl -xeu apache2.service" for details.

Itt ugye az a helyzet, hogy saját fix ip-n van a szolgáltatás (illetve van FQDN is), de ő a 127.0.1.1 címen keresi. Vagy más a hiba?

Mit kell tennem, hogy működjön?

Mi a hivatalos módja egy gépen a saját cert importálásának?

Köszönöm!

Hozzászólások

Első körben futtatnék egy 

apachectl configtest -et

Fedora 41, Thinkpad x280

Köszönöm.

root@nextcloud:~# apachectl configtest
AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1. Set the 'ServerName' directive globally to suppress this message
Syntax OK

A hiba valóban valahol itt van...

“The basic tool for the manipulation of reality is the manipulation of words. If you can control the meaning of words, you can control the people who must use them.”

― Philip K. Dick

Bocsi. Melyik konfigfileba/változóba kell betennem a fqdn-t?

Szerk. Fontos! Módosítottam a config.php fájlt. Mert anélkül nem indult http-n a site! Ott egy array-ba kellett felvennem a fix ip-t.

“The basic tool for the manipulation of reality is the manipulation of words. If you can control the meaning of words, you can control the people who must use them.”

― Philip K. Dick

Igen!

root@nextcloud:~# cat /var/www/nextcloud/config/config.php 
<?php
$CONFIG = array (
  'passwordsalt' => 'tcZ+jknkjhbjbj',
  'secret' => '9H+wp8ez',
  'trusted_domains' => 
  array (
    0 => 'localhost',
    1 => '10.210.64.25',
    2 => 'docs.domainnevem.hu',
  ),

Ez lehet a hiba?

“The basic tool for the manipulation of reality is the manipulation of words. If you can control the meaning of words, you can control the people who must use them.”

― Philip K. Dick

Ez egy warning, kell legyen valami nagyobb gond is (mondjuk attól még meg kell fixálni). Ugye az error.log-ot is nézed?

Szerk: példa

$ grep ServerName /usr/local/etc/apache2/httpd.conf
# ServerName gives the name and port that the server uses to identify itself.
ServerName f33-bonanza:80

$ grep f33-bonanza /etc/hosts
50.75.100.125     f33-bonanza bonanza f33

Egyébként Ubuntu Serveren van. Itt nincs httpd.conf állomány. És most, hogy ezt leírtam eszembe jutott, hogy az /etc/apache2/sites-available/nextcloud_tls_self _signed.conf állomány legutolsó sorában találtam elérési utat, amit nem írtam saját cert névre. Tehát még ezt megpróbálom...

“The basic tool for the manipulation of reality is the manipulation of words. If you can control the meaning of words, you can control the people who must use them.”

― Philip K. Dick

Jó, hát nyilván a disztributor kötelességének érzi, hogy mindent felkavarjon, de ettől még valamelyik fájlban benne van a ServerName.
 

$ apachectl -t -D DUMP_INCLUDES
Included configuration files:
  (*) /usr/local/etc/apache2/httpd.conf
    (1037) /usr/local/etc/apache2/ssl.conf

Ezt a hibaüzenetet nekem is kiírja a konténerben lévő Nextcloud, de ettől függetlenül teszi a dolgát.

nextcloud     | AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 172.19.0.4. Set the 'ServerName' directive globally to suppress this message

Igen, nálam is. Az érdekesség, hogy ettől függetlenül a service fut és működik. 

“The basic tool for the manipulation of reality is the manipulation of words. If you can control the meaning of words, you can control the people who must use them.”

― Philip K. Dick

Nézd meg, hogy mit ad ki a hostname -f parancs. Ha nem FQDN-t, akkor az /etc/hosts file-ba a 127.0.0.1 bejegyzéshez írd hozzá a teljes nevet.

root@nextcloud:~# hostname -f
nextcloud
cat /etc/hosts
10.210.64.25 docs.domainnevem.hu
10.210.64.25 docs
127.0.0.1 docs.domainnevem.hu
#127.0.1.1 nextcloud

“The basic tool for the manipulation of reality is the manipulation of words. If you can control the meaning of words, you can control the people who must use them.”

― Philip K. Dick

Mindegy, hogy melyikhez irod, jo a 127.0.0.1-hez is a lenyeg az hogy EGY SORBAN legyen, es a sorrend az FQDN ROVIDNEV. Nem forditva, nem kulon bejegyzeskent, kotelezon ez a szintaxis.

Igy garantaltan mukodik

Az apache-nak meg nem reload hanem restart kell, mert most ki van konyokolve.

Blog | @hron84

valahol egy üzemeltetőmaci most mérgesen toppant a lábával 

via @snq-

Alakul. 

Could not reliably determine the server's fully qualified domain name, using 2001:738:80b:d8fb:be24:11ff:fe46:78bc. Set the 'ServerName' directive globally to suppress this message
Syntax OK

Most hol is kellene beállítanom a ServerName-t?

Szerk. A hosts fájlban kikommenteltem az ipv6-os sorokat, de így sem megy...

“The basic tool for the manipulation of reality is the manipulation of words. If you can control the meaning of words, you can control the people who must use them.”

― Philip K. Dick

Talán ezzel előrébb jutnánk?

root@nextcloud:~# apache2ctl -S
AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 2001:738:80b:d8fb:be24:11ff:fe46:78bc. Set the 'ServerName' directive globally to suppress this message
VirtualHost configuration:
*:80                   is a NameVirtualHost
         default server 2001:738:80b:d8fb:be24:11ff:fe46:78bc (/etc/apache2/sites-enabled/000-default.conf:1)
         port 80 namevhost 2001:738:80b:d8fb:be24:11ff:fe46:78bc (/etc/apache2/sites-enabled/000-default.conf:1)
         port 80 namevhost 2001:738:80b:d8fb:be24:11ff:fe46:78bc (/etc/apache2/sites-enabled/nextcloud_http_domain_self_signed.conf:1)
*:443                  2001:738:80b:d8fb:be24:11ff:fe46:78bc (/etc/apache2/sites-enabled/nextcloud_tls_domain_self_signed.conf:6)
ServerRoot: "/etc/apache2"
Main DocumentRoot: "/var/www/html"

“The basic tool for the manipulation of reality is the manipulation of words. If you can control the meaning of words, you can control the people who must use them.”

― Philip K. Dick

Szerintem nem az FQDN a probléma, az csak egy warning szokott lenni, attól még futna.

Amit feltöltöttél cert-et, az fullchain vagy csak egy sima (szerver) cert? Ugyanis a CA certek között nincsenek ott az intermediate certek általában, így a cert ellenőrzése nem fog sikerülni, ha csak egy sima certet töltöttél fel és azt nem egy ismert root CA, hanem egy intermediate állította ki. Ezen már elbukhat az indulás.

Igen. Köszönöm mindkettőtöknek. Valószínüleg ez lesz. Nem töltöttem intermediate certet. Kaptam egy wildcard certet (szerintem root) és azt töltöttem fel simán. Most merre lenne érdemes elindulni?

“The basic tool for the manipulation of reality is the manipulation of words. If you can control the meaning of words, you can control the people who must use them.”

― Philip K. Dick

> Most merre lenne érdemes elindulni?

Megvizsgálni az *.cert file tartalmát. `openssl x509 -text` egy jó kezdet. (Ami azt illeti, a cert-ben nincs semmi titok, azt kiteheted valami publikus helyre.)

Részletesebben:
1. ha a cert tartalma bináris szemét, akkor der2pem konverzió (openssl x509 -in derfile -inform der -out pemfile)
2. ha több "--BEGIN" rész van benne, akkor minden ilyen részt külön kell megvizsgálni, és remélhetőleg összeáll a darabokból a lánc
3. egy cert-et az openssl x509 -in pemfile -noout -text >pemfile.txt paranccsal lehet olvasható formára alakítani.

Tippre elbökődik valahol az apache2 konfig.

Lehet még az is hogy egyszerű szintaktikai hiba, bár akkor a configtest ki kéne szúrja.

Én azt javasolnám hogy próbálj meg egy üres (statikus) apache2-t felkonfigolni https-re. 

Ha az már megy akkor gyógyítanám rá a nextcloudra.

Elgondolkoznék azon is, hogy a https termination-t:

- a webserverben/nextcloudban közvetlenül csinálom 
- reverse proxyként eléteszem. Ezt akár ugyanazzal az instance-al de külön virtualhosttal is meg lehet oldani

Tippre te most az első megközelítést próbálod összehozni.

zászló, zászló, szív

Igen. Jól tippelsz. Egy önálló VM a Proxmox szerveren és azon belül próbálok https-t varázsolni.

“The basic tool for the manipulation of reality is the manipulation of words. If you can control the meaning of words, you can control the people who must use them.”

― Philip K. Dick

Tippre elbökődik valahol az apache2 konfig.

Lehet még az is hogy egyszerű szintaktikai hiba, bár akkor a configtest ki kéne szúrja.

Én azt javasolnám hogy próbálj meg egy üres (statikus) apache2-t felkonfigolni https-re. 

Ha az már megy akkor gyógyítanám rá a nextcloudra.

Elgondolkoznék azon is, hogy a https termination-t:

- a webserverben/nextcloudban közvetlenül csinálom 
- reverse proxyként eléteszem. Ezt akár ugyanazzal az instance-al de külön virtualhosttal is meg lehet oldani

Tippre te most az első megközelítést próbálod összehozni.

zászló, zászló, szív

Szerkesztve: 2025. 06. 10., k – 22:07

Ha jól veszem ki a szavaidból nem teljesen tiszta a certificate-k működése, mi az root CA, intermediate CA stb. 

Nagyon lesarkítva pár alap fogalom,  a teljesség igénye nélkül.

A root CA (Certificate Authority) az a legfelsőbb szintű tanúsítvány tulajdonos. Ő jogosult ezzel más tanúsítványokat kiállítani. Ha megbízható tanúsítványról beszélünk (ezeket telepítik az OS-ek alapból), akkor ezzel már nincs dolog. mert rendelkezésre áll. Természetesen a publikus része ezzel aláírni senki sem tud. 

Intemediate CA (köztes tanúsítvány): Olyan CA, amelyet egy másik - többnyire root CA-val - van kiállítva. Ez a CA beépül a tanúsítvány láncba a root CA és a tényleges tanúsítvány (cert közé). Ilyet szoktak venni nagyobb cégek. Itt nincs használatban.

A certificate (tanusítvány) van a lánc végén ami egy domain-ra vonatkozik egy vagy több host résszel, illetve wildcard (bármilyen host az adott domainen belül) 

Most akkor lássuk ezek után a konkrét eseted. Az általad linkelt fórum téma a Let'sEncrypt által aláírt ingyenes tanúsítványra vonatkozna. Javaslom olvass utána a Let'sEncrypt oldalán a hogyan tudsz certificatet előállítani és hogyan kell hozzáadni az adott operációs rendszeren futó webszerverhez. 

(Valószínűleg az általad elsőnek linkelt oldalon is van egy leírás,  de ahhoz ki kell nyitni a TCP/80-as és a TCP/443-as portot az Internet felől  https://docs.hanssonit.se/s/W6fMouPiqQz3_Mog/virtual-machines-vm/d/W6fM…)

Sokan a certbot eszközt használják a tanúsítvány kezeléshez. Itt tudsz meg többet a működésről és a használatról.  https://certbot.eff.org/

A certificate-ket az adott OS-hez igazodó könyvtárakba kell (erősen javasolt) tárolni.

Ha minden a helyén van akkor be kell konfigurálni az TLS certificate-et az adott domainhez (és nem a globális konfigurációnál)

Szükség lehet globális szinten engedélyezni az TLS támogatást. a2enmod parancs segíthet.

Ha az Apache konfiguráció rendben van akkor apache2ctl configtest paranccsal ellenőrizhető a konfiguráció helyessége Apache újraindítás előtt. 

Ha az újraindítás sikertelen, akkor journalctl -xeu apache2 kiadja a logokat, ahol meg tudod nézni mit jelez hibának. 

Ha fut az Apache, akkor a curl vagy openssl paranccsal megjtudod nézni mi a gond a certificate beállítással. 

Ezek alapján meg kell tudni javítani.