Skip to content

Commit

Permalink
Only include system certs without cert bundle
Browse files Browse the repository at this point in the history
Users should be able to fully control which certificates are used for
DNS over TLS. Therefore we only include the default system certificates
if no certificate bundle has been specified with the -C option.
  • Loading branch information
Carsten Beckmann committed Nov 13, 2023
1 parent d2896bd commit 76f8ac7
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 11 deletions.
21 changes: 12 additions & 9 deletions forwarder.c
Original file line number Diff line number Diff line change
Expand Up @@ -235,15 +235,18 @@ forwarder_ub_ctx_init(struct pfresolved *env)
fatalx("%s: ub_ctx_set_tls failed: %s", __func__,
ub_strerror(res));

/* include root certs from /etc/ssl/cert.pem */
if ((res = ub_ctx_set_option(ctx, "tls-system-cert:", "yes")) != 0)
fatalx("%s: ub_ctx_set_option tls-system-cert failed: %s",
__func__, ub_strerror(res));

if (env->sc_cert_bundle && (res = ub_ctx_set_option(ctx,
"tls-cert-bundle:", env->sc_cert_bundle)) != 0)
fatalx("%s: ub_ctx_set_option tls-cert-bundle failed: %s",
__func__, ub_strerror(res));
if (env->sc_cert_bundle) {
if ((res = ub_ctx_set_option(ctx, "tls-cert-bundle:",
env->sc_cert_bundle)) != 0)
fatalx("%s: ub_ctx_set_option tls-cert-bundle "
"failed: %s", __func__, ub_strerror(res));
} else {
/* include root certs from /etc/ssl/cert.pem */
if ((res = ub_ctx_set_option(ctx, "tls-system-cert:",
"yes")) != 0)
fatalx("%s: ub_ctx_set_option tls-system-cert "
"failed: %s", __func__, ub_strerror(res));
}
}

if (env->sc_dnssec_level > DNSSEC_NONE) {
Expand Down
3 changes: 1 addition & 2 deletions pfresolved.8
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,7 @@ Unsigned query results will be discarded.
.It Fl T
Enable DNS-over-TLS.
The system certificates will be automatically included and used for
authentication.
An additional certificate bundle can be specified using
authentication unless a certificate bundle is specified using
.Fl C .
.It Fl v
Produce more verbose output.
Expand Down

0 comments on commit 76f8ac7

Please sign in to comment.