Files
Dag-Erling Smørgrav 2fef18ff59 certctl: Unstickify (un)trusted certificates
Ever since certctl was rewritten in C, the rehash command has reingested
TRUSTDESTDIR / UNTRUSTDESTDIR in addition to TRUSTPATH / UNTRUSTPATH.
This seemed like a good idea at the time but was, in retrospect, a
mistake, as it means a (un)trusted certificate remains (un)trusted
forever (or at least until it expires) even if it is removed from
(UN)TRUSTPATH.  Among other issues, it causes ports QA to fail for any
port that either installs certificates or depends on a port that does.

Although this behavior was undocumented, the change may surprise users
who have added certificates manually, so update the manual page to point
it out and add prominent warnings to the trust and untrust commands.

PR:		290078
MFC after:	1 week
Reviewed by:	kevans, bcr
Differential Revision:	https://reviews.freebsd.org/D56617
2026-05-06 00:30:52 +02:00

180 lines
5.1 KiB
Plaintext

.\"
.\" SPDX-License-Identifier: BSD-2-Clause
.\"
.\" Copyright 2018 Allan Jude <[email protected]>
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted providing that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in the
.\" documentation and/or other materials provided with the distribution.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
.\" STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
.\" IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
.\" POSSIBILITY OF SUCH DAMAGE.
.\"
.Dd April 24, 2026
.Dt CERTCTL 8
.Os
.Sh NAME
.Nm certctl
.Nd "tool for managing trusted and untrusted TLS certificates"
.Sh SYNOPSIS
.Nm
.Op Fl lv
.Ic list
.Nm
.Op Fl lv
.Ic untrusted
.Nm
.Op Fl BnUv
.Op Fl D Ar destdir
.Op Fl M Ar metalog
.Ic rehash
.Nm
.Op Fl nv
.Ic untrust Ar
.Nm
.Op Fl nv
.Ic trust Ar
.Sh DESCRIPTION
The
.Nm
utility manages the list of TLS Certificate Authorities that are trusted by
applications that use OpenSSL.
.Pp
The following options are available:
.Bl -tag -width 4n
.It Fl B
Do not generate a bundle.
This option is only valid in conjunction with the
.Ic rehash
command.
.It Fl D Ar destdir
Specify the DESTDIR (overriding values from the environment).
.It Fl d Ar distbase
Specify the DISTBASE (overriding values from the environment).
.It Fl l
When listing installed (trusted or untrusted) certificates, show the
full path and distinguished name for each certificate.
.It Fl M Ar metalog
Specify the path of the METALOG file
.Po
default:
.Pa ${DESTDIR}/METALOG
.Pc .
This option is only valid in conjunction with the
.Ic rehash
command.
.It Fl n
Dry-run mode.
Do not actually perform any actions except write the metalog.
.It Fl v
Verbose mode.
Print detailed information about each action taken.
.It Fl U
Unprivileged mode.
Do not attempt to set the ownership of created files.
This option is only valid in conjunction with the
.Fl M
option and the
.Ic rehash
command.
.El
.Pp
Primary command functions:
.Bl -tag -width untrusted
.It Ic list
List all currently trusted certificates.
.It Ic untrusted
List all currently untrusted certificates.
.It Ic rehash
Rebuild the list of trusted certificates by scanning all directories
in
.Ev TRUSTPATH
and all untrusted certificates in
.Ev UNTRUSTPATH .
A copy of each trusted certificate is placed in
.Ev TRUSTDESTDIR
and each untrusted certificate in
.Ev UNTRUSTDESTDIR .
In addition, a bundle containing the trusted certificates is placed in
.Ev BUNDLE .
.It Ic untrust
Add the specified file to the untrusted list.
Note that the next
.Ic rehash
will remove it unless a copy of it is also placed somewhere in a
directory included in
.Ev UNTRUSTPATH .
.It Ic trust
Add the specified file to the trusted list, unless it is already
untrusted.
Note that the next
.Ic rehash
will remove it unless a copy of it is also placed somewhere in a
directory included in
.Ev TRUSTPATH .
.El
.Sh ENVIRONMENT
.Bl -tag -width UNTRUSTDESTDIR
.It Ev DESTDIR
Absolute path to an alternate destination directory to operate on
instead of the file system root, e.g.
.Dq Li /tmp/install .
.It Ev DISTBASE
Additional path component to include when operating on certificate directories.
This must start with a slash, e.g.
.Dq Li /base .
.It Ev LOCALBASE
Location for local programs.
Defaults to the value of the user.localbase sysctl which is usually
.Pa /usr/local .
.It Ev TRUSTPATH
List of paths to search for trusted certificates.
Default:
.Pa ${DESTDIR}${DISTBASE}/usr/share/certs/trusted
.Pa ${DESTDIR}${LOCALBASE}/share/certs/trusted
.Pa ${DESTDIR}${LOCALBASE}/share/certs
.It Ev UNTRUSTPATH
List of paths to search for untrusted certificates.
Default:
.Pa ${DESTDIR}${DISTBASE}/usr/share/certs/untrusted
.Pa ${DESTDIR}${LOCALBASE}/share/certs/untrusted
.It Ev TRUSTDESTDIR
Destination directory for symbolic links to trusted certificates.
Default:
.Pa ${DESTDIR}${DISTBASE}/etc/ssl/certs
.It Ev UNTRUSTDESTDIR
Destination directory for symbolic links to untrusted certificates.
Default:
.Pa ${DESTDIR}${DISTBASE}/etc/ssl/untrusted
.It Ev BUNDLE
File name of bundle to produce.
Default:
.Pa ${DESTDIR}${DISTBASE}/etc/ssl/cert.pem
.El
.Sh SEE ALSO
.Xr openssl 1
.Sh HISTORY
.Nm
first appeared in
.Fx 12.2 .
.Sh AUTHORS
.An -nosplit
The original shell implementation was written by
.An Allan Jude Aq Mt [email protected] .
The current C implementation was written by
.An Dag-Erling Sm\(/orgrav Aq Mt [email protected] .