
Je peaufine la configuration de base de mon petit serveur HTTPS (stunnel4 + micro-httpd)
Voici ce qui me pose question dans les "status" des services :
Code : Tout sélectionner
stunnel4.service
....
s_connect: connect ::1:80: Connection refused (111)
Code : Tout sélectionner
stunnel@micro-httpd.service - TLS tunnel for network daemons - per-config-file service
Loaded: loaded (/lib/systemd/system/stunnel@.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code)......
...
[!] Binding service [micro-httpd] failed
Sorties complètes :
Code : Tout sélectionner
# systemctl status stunnel*
● stunnel4.service - LSB: Start or stop stunnel 4.x (TLS tunnel for network daemons)
Loaded: loaded (/etc/init.d/stunnel4; generated)
Active: active (running) since Sat 2022-10-22 22:47:16 UTC; 14h ago
Docs: man:systemd-sysv-generator(8)
Process: 104221 ExecStart=/etc/init.d/stunnel4 start (code=exited, status=0/SUCCESS)
Process: 104278 ExecReload=/etc/init.d/stunnel4 reload (code=exited, status=0/SUCCESS)
Tasks: 2 (limit: 2279)
Memory: 2.0M
CPU: 794ms
CGroup: /system.slice/stunnel4.service
└─104236 /usr/bin/stunnel4 /etc/stunnel/micro-httpd.conf
Oct 23 12:53:47 server1.dezix.fr stunnel[104236]: LOG3[185]: SSL_accept: ../ssl/statem/statem_srvr.c:1779: error:142090C1:SSL routines:tls_early_post_process_client_hello:no shared cipher
Oct 23 12:53:47 server1.dezix.fr stunnel[104236]: LOG5[185]: Connection reset: 0 byte(s) sent to TLS, 0 byte(s) sent to socket
Oct 23 12:53:47 server1.dezix.fr stunnel[104236]: LOG5[186]: Service [micro-httpd] accepted connection from 87.236.176.169:48523
Oct 23 12:53:47 server1.dezix.fr stunnel[104236]: LOG3[186]: SSL_accept: ../ssl/statem/extensions_srvr.c:697: error:141CF06C:SSL routines:tls_parse_ctos_key_share:bad key share
Oct 23 12:53:47 server1.dezix.fr stunnel[104236]: LOG5[186]: Connection reset: 0 byte(s) sent to TLS, 0 byte(s) sent to socket
Oct 23 12:56:38 server1.dezix.fr stunnel[104236]: LOG5[187]: Service [micro-httpd] accepted connection from 45.11.57.48:50844
Oct 23 12:56:38 server1.dezix.fr stunnel[104236]: LOG3[187]: s_connect: connect ::1:80: Connection refused (111)
Oct 23 12:56:38 server1.dezix.fr stunnel[104236]: LOG5[187]: s_connect: connected 127.0.0.1:80
Oct 23 12:56:38 server1.dezix.fr stunnel[104236]: LOG5[187]: Service [micro-httpd] connected remote server from 127.0.0.1:38810
Oct 23 12:56:38 server1.dezix.fr stunnel[104236]: LOG5[187]: Connection closed: 583 byte(s) sent to TLS, 290 byte(s) sent to socket
● stunnel.target - TLS tunnels for network services - per-config-file target
Loaded: loaded (/lib/systemd/system/stunnel.target; enabled; vendor preset: enabled)
Active: active since Sun 2022-10-09 09:48:05 UTC; 2 weeks 0 days ago
Oct 09 09:48:05 server1.dezix.fr systemd[1]: Reached target TLS tunnels for network services - per-config-file target.
● stunnel@micro-httpd.service - TLS tunnel for network daemons - per-config-file service
Loaded: loaded (/lib/systemd/system/stunnel@.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Sat 2022-10-22 22:53:44 UTC; 14h ago
Docs: man:stunnel4(8)
Process: 104317 ExecStart=/usr/bin/stunnel4 /etc/stunnel/micro-httpd.conf (code=exited, status=1/FAILURE)
Main PID: 104317 (code=exited, status=1/FAILURE)
CPU: 16ms
Oct 22 22:53:44 server1.dezix.fr stunnel4[104317]: [ ] Setting accept socket options (FD=9)
Oct 22 22:53:44 server1.dezix.fr stunnel4[104317]: [ ] Option SO_REUSEADDR set on accept socket
Oct 22 22:53:44 server1.dezix.fr stunnel4[104317]: [.] Binding service [micro-httpd] to :::443: Address already in use (98)
Oct 22 22:53:44 server1.dezix.fr stunnel4[104317]: [!] Binding service [micro-httpd] failed
Oct 22 22:53:44 server1.dezix.fr stunnel4[104317]: [ ] Deallocating section defaults
Oct 22 22:53:44 server1.dezix.fr stunnel4[104317]: [ ] Unbinding service [micro-httpd]
Oct 22 22:53:44 server1.dezix.fr stunnel4[104317]: [ ] Service [micro-httpd] closed
Oct 22 22:53:44 server1.dezix.fr stunnel4[104317]: [ ] Deallocating section [micro-httpd]
Oct 22 22:53:44 server1.dezix.fr systemd[1]: stunnel@micro-httpd.service: Main process exited, code=exited, status=1/FAILURE
Oct 22 22:53:44 server1.dezix.fr systemd[1]: stunnel@micro-httpd.service: Failed with result 'exit-code'.
Code : Tout sélectionner
# Extrait de journalctl -xe
Oct 23 12:52:59 server1.dezix.fr stunnel[104236]: LOG5[175]: Service [micro-httpd] accepted connection from 86.236.203.237:54820
Oct 23 12:52:59 server1.dezix.fr stunnel[104236]: LOG3[175]: s_connect: connect ::1:80: Connection refused (111)
Oct 23 12:52:59 server1.dezix.fr stunnel[104236]: LOG5[175]: s_connect: connected 127.0.0.1:80
Oct 23 12:52:59 server1.dezix.fr stunnel[104236]: LOG5[175]: Service [micro-httpd] connected remote server from 127.0.0.1:57440
Oct 23 12:52:59 server1.dezix.fr systemd[1]: Started micro-httpd (127.0.0.1:57440).
░░ Subject: A start job for unit micro-httpd@10494-127.0.0.1:80-127.0.0.1:57440.service has finished successfully
░░ Defined-By: systemd
░░ Support: https://www.debian.org/support
░░
░░ A start job for unit micro-httpd@10494-127.0.0.1:80-127.0.0.1:57440.service has finished successfully.
░░
░░ The job identifier is 1875322.
Oct 23 12:53:04 server1.dezix.fr systemd[1]: micro-httpd@10494-127.0.0.1:80-127.0.0.1:57440.service: Succeeded.
░░ Subject: Unit succeeded
░░ Defined-By: systemd
░░ Support: https://www.debian.org/support
░░
░░ The unit micro-httpd@10494-127.0.0.1:80-127.0.0.1:57440.service has successfully entered the 'dead' state.
Oct 23 12:53:04 server1.dezix.fr stunnel[104236]: LOG5[175]: Connection closed: 557 byte(s) sent to TLS, 0 byte(s) sent to socket
Dans la configuration TLS du service : /etc/stunnel/micro-httpd.conf
j'ai remplacé la cible de la redirection du port 443 : connect = 80
par ces 2 paramètres:
connect = dezix.fr:80
connect = www.dezix.fr:80
suivi par :
Code : Tout sélectionner
# systemctl reload stunnel4
# systemctl restart stunnel@micro-httpd
cela a supprimé : s_connect: connect ::1:80: Connection refused (111)
Mais le status de stunnel@micro-httpd.service continue à afficher :
Active: failed (Result: exit-code) since ....
Code : Tout sélectionner
# systemctl status stunnel*
● stunnel4.service - LSB: Start or stop stunnel 4.x (TLS tunnel for network daemons)
Loaded: loaded (/etc/init.d/stunnel4; generated)
Active: active (running) since Sat 2022-10-22 22:47:16 UTC; 14h ago
Docs: man:systemd-sysv-generator(8)
Process: 104221 ExecStart=/etc/init.d/stunnel4 start (code=exited, status=0/SUCCESS)
Process: 106847 ExecReload=/etc/init.d/stunnel4 reload (code=exited, status=0/SUCCESS)
Tasks: 2 (limit: 2279)
Memory: 2.1M
CPU: 880ms
CGroup: /system.slice/stunnel4.service
└─104236 /usr/bin/stunnel4 /etc/stunnel/micro-httpd.conf
Oct 23 13:22:11 server1.dezix.fr stunnel[104236]: LOG5[main]: Binding service [micro-httpd] to :::443: Address already in use (98)
Oct 23 13:22:11 server1.dezix.fr stunnel[104236]: LOG5[main]: Reading configuration from file /etc/stunnel/micro-httpd.conf
Oct 23 13:22:11 server1.dezix.fr stunnel[104236]: LOG5[main]: UTF-8 byte order mark detected
Oct 23 13:22:11 server1.dezix.fr stunnel[104236]: LOG5[main]: FIPS mode disabled
Oct 23 13:22:11 server1.dezix.fr stunnel[104236]: LOG5[main]: Configuration successful
Oct 23 13:22:11 server1.dezix.fr stunnel[104236]: LOG5[main]: Binding service [micro-httpd] to :::443: Address already in use (98)
Oct 23 13:22:29 server1.dezix.fr stunnel[104236]: LOG5[194]: Service [micro-httpd] accepted connection from 86.236.203.237:43348
Oct 23 13:22:29 server1.dezix.fr stunnel[104236]: LOG5[194]: s_connect: connected 51.178.81.74:80
Oct 23 13:22:29 server1.dezix.fr stunnel[104236]: LOG5[194]: Service [micro-httpd] connected remote server from 51.178.81.74:57020
Oct 23 13:22:29 server1.dezix.fr stunnel[104236]: LOG5[194]: Connection closed: 4976 byte(s) sent to TLS, 223 byte(s) sent to socket
● stunnel.target - TLS tunnels for network services - per-config-file target
Loaded: loaded (/lib/systemd/system/stunnel.target; enabled; vendor preset: enabled)
Active: active since Sun 2022-10-09 09:48:05 UTC; 2 weeks 0 days ago
Oct 09 09:48:05 server1.dezix.fr systemd[1]: Reached target TLS tunnels for network services - per-config-file target.
● stunnel@micro-httpd.service - TLS tunnel for network daemons - per-config-file service
Loaded: loaded (/lib/systemd/system/stunnel@.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Sun 2022-10-23 13:22:21 UTC; 3min 28s ago
Docs: man:stunnel4(8)
Process: 106884 ExecStart=/usr/bin/stunnel4 /etc/stunnel/micro-httpd.conf (code=exited, status=1/FAILURE)
Main PID: 106884 (code=exited, status=1/FAILURE)
CPU: 16ms
Oct 23 13:22:21 server1.dezix.fr stunnel4[106884]: [ ] Setting accept socket options (FD=9)
Oct 23 13:22:21 server1.dezix.fr stunnel4[106884]: [ ] Option SO_REUSEADDR set on accept socket
Oct 23 13:22:21 server1.dezix.fr stunnel4[106884]: [.] Binding service [micro-httpd] to :::443: Address already in use (98)
Oct 23 13:22:21 server1.dezix.fr stunnel4[106884]: [!] Binding service [micro-httpd] failed
Oct 23 13:22:21 server1.dezix.fr stunnel4[106884]: [ ] Deallocating section defaults
Oct 23 13:22:21 server1.dezix.fr stunnel4[106884]: [ ] Unbinding service [micro-httpd]
Oct 23 13:22:21 server1.dezix.fr stunnel4[106884]: [ ] Service [micro-httpd] closed
Oct 23 13:22:21 server1.dezix.fr stunnel4[106884]: [ ] Deallocating section [micro-httpd]
Oct 23 13:22:21 server1.dezix.fr systemd[1]: stunnel@micro-httpd.service: Main process exited, code=exited, status=1/FAILURE
Oct 23 13:22:21 server1.dezix.fr systemd[1]: stunnel@micro-httpd.service: Failed with result 'exit-code'.
Je ne sais pas si l'état : Active: failed (Result: exit-code) de stunnel@micro-httpd.service
est normal dans la mesure où le serveur est inactif en attente de la prochaine requête,
ou si quelque-chose est mal ficelé malgré le bon fonctionnement (apparent) du site ?
Merci pour vos avis

-