Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F178010188
D62085.1795754531.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Authored By
Unknown
Size
2 KB
Referenced Files
None
Subscribers
None
D62085.1795754531.diff
View Options
diff --git a/share/man/man7/build.7 b/share/man/man7/build.7
--- a/share/man/man7/build.7
+++ b/share/man/man7/build.7
@@ -25,7 +25,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.Dd June 18, 2026
+.Dd October 23, 2026
.Dt BUILD 7
.Os
.Sh NAME
@@ -754,6 +754,18 @@
.Pa ${OBJROOT}/repo/ .
This can also be set in
.Xr src-env.conf 5 .
+.It Va SECUREBOOT_CERT
+Path to the
+.Pa .pem
+certificate that should be used to
+.Xr efisign 8
+loader artifacts.
+.It Va SECUREBOOT_KEY
+Path to the private
+.Pa .key
+that should be used to
+.Xr efisign 8
+loader artifacts.
.It Va STRIPBIN
Command to use at install time when stripping binaries.
Be sure to add any additional tools required to run
diff --git a/share/man/man7/secureboot.7 b/share/man/man7/secureboot.7
--- a/share/man/man7/secureboot.7
+++ b/share/man/man7/secureboot.7
@@ -19,12 +19,25 @@
policies that are enabled when secureboot is enforced.
.Ss Setup
Secureboot requires loader to be signed.
-For example:
+Appropriate keys can be generated using an example script provided by
+.Xr efisign 8 :
.Bd -literal
$ sh /usr/share/examples/efisign/uefikeys personal
-$ uefisign -c personal.pem -k personal.key -o loader.efi loader.efi.unsigned
.Ed
.Pp
+Signing is integrated into the
+.Xr build 7 .
+Setting
+.Ev SECUREBOOT_KEY
+and
+.Ev SECUREBOOT_CERT
+in your
+.Pa /etc/src.conf
+will result in a signed
+.Xr loader.efi 8
+during
+.Cm buildworld .
+.Pp
In an ideal world, loader is in turn requiring signatures for all of the files
that it loads, as well.
Deployment of
@@ -38,6 +51,7 @@
The are currently no policies enabled by the kernel when secureboot is enforced.
.Sh SEE ALSO
.Xr veriexec 4 ,
+.Xr build 7 ,
.Xr efisign 8 ,
.Xr loader.efi 8 ,
.Xr veriexec 8
diff --git a/stand/efi/loader/Makefile b/stand/efi/loader/Makefile
--- a/stand/efi/loader/Makefile
+++ b/stand/efi/loader/Makefile
@@ -137,7 +137,25 @@
CLEANFILES+= ${LOADER}.efi
-${LOADER}.efi: ${PROG}
+.if !empty(SECUREBOOT_KEY)
+.if empty(SECUREBOOT_CERT)
+.error "SECUREBOOT_CERT must also be set."
+.endif
+
+SECUREBOOT_SIGN_CMD?= efisign -c ${SECUREBOOT_CERT} -k ${SECUREBOOT_KEY}
+
+LOADER_PROG= ${LOADER}.efi.unsigned
+${LOADER}.efi: ${LOADER_PROG} ${SECUREBOOT_KEY} ${SECUREBOOT_CERT}
+ @if ! ${SECUREBOOT_SIGN_CMD} -o ${LOADER}.efi ${LOADER_PROG}; then \
+ 1>&2 echo "Failed to sign ${LOADER_PROG}"; \
+ rm ${LOADER}.efi; \
+ exit 1; \
+ fi
+.else
+LOADER_PROG= ${LOADER}.efi
+.endif
+
+${LOADER_PROG}: ${PROG}
@if ${NM} ${.ALLSRC} | grep ' U '; then \
echo "Undefined symbols in ${.ALLSRC}"; \
exit 1; \
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Nov 27, 4:42 AM (19 h, 41 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
42035169
Default Alt Text
D62085.1795754531.diff (2 KB)
Attached To
Mode
D62085: loader: efi: add build support for signing loader.efi
Attached
Detach File
Event Timeline