Pull request: 5189-run-bad-cert

Merge in DNS/adguard-home from 5189-run-bad-cert to master

Closes #5189.

Squashed commit of the following:

commit 9e6ac6218163c7408200ce5fd591e8e6f5181f00
Author: Eugene Burkov <E.Burkov@AdGuard.COM>
Date:   Thu Nov 24 19:17:43 2022 +0300

    all: imp chlog again

commit 5870aee8efc3213feffbe1e61b2f5b411a69ece7
Author: Eugene Burkov <E.Burkov@AdGuard.COM>
Date:   Thu Nov 24 18:57:54 2022 +0300

    all: imp chlog

commit ec0d4b6ead14a6a6698d4a27819e679b2d4c7a0b
Author: Eugene Burkov <E.Burkov@AdGuard.COM>
Date:   Thu Nov 24 18:43:04 2022 +0300

    home: rm fatal on tls init errors
This commit is contained in:
Eugene Burkov 2022-11-25 15:41:54 +03:00
parent 9c4bed31e7
commit 53a366ed46
3 changed files with 11 additions and 3 deletions

View File

@ -27,6 +27,9 @@ See also the [v0.107.20 GitHub milestone][ms-v0.107.20].
### Fixed
- The TLS initialization errors preventing AdGuard Home from starting ([#5189]).
Instead, AdGuard Home disables encryption and shows an error message on the
encryption settings page in the UI, which was the intended previous behavior.
- URLs of some vetter blocklists.

View File

@ -514,7 +514,8 @@ func run(opts options, clientBuildFS fs.FS) {
Context.tls, err = newTLSManager(config.TLS)
if err != nil {
log.Fatalf("initializing tls: %s", err)
log.Error("initializing tls: %s", err)
onConfigModified()
}
Context.web, err = initWeb(opts, clientBuildFS)

View File

@ -40,7 +40,9 @@ type tlsManager struct {
conf tlsConfigSettings
}
// newTLSManager initializes the TLS configuration.
// newTLSManager initializes the manager of TLS configuration. m is always
// non-nil while any returned error indicates that the TLS configuration isn't
// valid. Thus TLS may be initialized later, e.g. via the web UI.
func newTLSManager(conf tlsConfigSettings) (m *tlsManager, err error) {
m = &tlsManager{
status: &tlsConfigStatus{},
@ -50,7 +52,9 @@ func newTLSManager(conf tlsConfigSettings) (m *tlsManager, err error) {
if m.conf.Enabled {
err = m.load()
if err != nil {
return nil, err
m.conf.Enabled = false
return m, err
}
m.setCertFileTime()