mirror of
https://github.com/systemd/systemd.git
synced 2025-02-25 21:57:32 +03:00
ukify: add default .sbat section for addons
In order to ensure addons can always be revoked via SBAT, and it is not left out by mistake, have a default metadata entry if none is specified by the caller. https://github.com/rhboot/shim/blob/main/SBAT.md
This commit is contained in:
parent
f644ea3ed7
commit
c67d5a027d
@ -50,6 +50,7 @@
|
|||||||
<varname>Splash=</varname>/<option>--splash=</option>,
|
<varname>Splash=</varname>/<option>--splash=</option>,
|
||||||
<varname>PCRPKey=</varname>/<option>--pcrpkey=</option>,
|
<varname>PCRPKey=</varname>/<option>--pcrpkey=</option>,
|
||||||
<varname>Uname=</varname>/<option>--uname=</option>,
|
<varname>Uname=</varname>/<option>--uname=</option>,
|
||||||
|
<varname>SBAT=</varname>/<option>--sbat=</option>,
|
||||||
and <option>--section=</option>
|
and <option>--section=</option>
|
||||||
below.</para>
|
below.</para>
|
||||||
|
|
||||||
@ -369,6 +370,27 @@
|
|||||||
</varlistentry>
|
</varlistentry>
|
||||||
</variablelist>
|
</variablelist>
|
||||||
</refsect2>
|
</refsect2>
|
||||||
|
|
||||||
|
<refsect2>
|
||||||
|
<title>[Addon:<replaceable>NAME</replaceable>] section</title>
|
||||||
|
|
||||||
|
<para>Currently, these options only apply when building PE addons.</para>
|
||||||
|
|
||||||
|
<variablelist>
|
||||||
|
<varlistentry>
|
||||||
|
<term><varname>SBAT=<replaceable>TEXT</replaceable>|<replaceable>@PATH</replaceable></varname></term>
|
||||||
|
<term><option>--sbat=<replaceable>TEXT</replaceable>|<replaceable>@PATH</replaceable></option></term>
|
||||||
|
|
||||||
|
<listitem><para>SBAT metadata associated with the addon. SBAT policies are useful to revoke whole
|
||||||
|
groups of addons with a single, static policy update that does not take space in DBX/MOKX. If not
|
||||||
|
specified manually, a default metadata entry consisting of
|
||||||
|
<literal>uki.addon.systemd,1,UKI Addon,uki.addon.systemd,1,https://www.freedesktop.org/software/systemd/man/systemd-stub.html</literal>
|
||||||
|
will be used, to ensure it is always possible to revoke addons. For more information on SBAT see
|
||||||
|
<ulink url="https://github.com/rhboot/shim/blob/main/SBAT.md">Shim's documentation.</ulink></para>
|
||||||
|
</listitem>
|
||||||
|
</varlistentry>
|
||||||
|
</variablelist>
|
||||||
|
</refsect2>
|
||||||
</refsect1>
|
</refsect1>
|
||||||
|
|
||||||
<refsect1>
|
<refsect1>
|
||||||
@ -464,11 +486,13 @@ Phases=enter-initrd:leave-initrd
|
|||||||
--secureboot-private-key=sb.key \
|
--secureboot-private-key=sb.key \
|
||||||
--secureboot-certificate=sb.cert \
|
--secureboot-certificate=sb.cert \
|
||||||
--cmdline='debug' \
|
--cmdline='debug' \
|
||||||
|
--sbat='sbat,1,SBAT Version,sbat,1,https://github.com/rhboot/shim/blob/main/SBAT.md
|
||||||
|
uki.addon.author,1,UKI Addon for System,uki.addon.author,1,https://www.freedesktop.org/software/systemd/man/systemd-stub.html'
|
||||||
--output=debug.cmdline
|
--output=debug.cmdline
|
||||||
</programlisting>
|
</programlisting>
|
||||||
|
|
||||||
<para>This creates a signed PE binary that contains the additional kernel command line parameter
|
<para>This creates a signed PE binary that contains the additional kernel command line parameter
|
||||||
<literal>debug</literal>.</para>
|
<literal>debug</literal> with SBAT metadata referring to the owner of the addon.</para>
|
||||||
</example>
|
</example>
|
||||||
</refsect1>
|
</refsect1>
|
||||||
|
|
||||||
|
@ -679,10 +679,12 @@ def make_uki(opts):
|
|||||||
|
|
||||||
call_systemd_measure(uki, linux, opts=opts)
|
call_systemd_measure(uki, linux, opts=opts)
|
||||||
|
|
||||||
# UKI creation
|
# UKI or addon creation - addons don't use the stub so we add SBAT manually
|
||||||
|
|
||||||
if linux is not None:
|
if linux is not None:
|
||||||
uki.add_section(Section.create('.linux', linux, measure=True))
|
uki.add_section(Section.create('.linux', linux, measure=True))
|
||||||
|
elif opts.sbat:
|
||||||
|
uki.add_section(Section.create('.sbat', opts.sbat, measure=False))
|
||||||
|
|
||||||
if sign_args_present:
|
if sign_args_present:
|
||||||
unsigned = tempfile.NamedTemporaryFile(prefix='uki')
|
unsigned = tempfile.NamedTemporaryFile(prefix='uki')
|
||||||
@ -927,6 +929,16 @@ CONFIG_ITEMS = [
|
|||||||
config_key = 'UKI/Stub',
|
config_key = 'UKI/Stub',
|
||||||
),
|
),
|
||||||
|
|
||||||
|
ConfigItem(
|
||||||
|
'--sbat',
|
||||||
|
metavar = 'TEXT|@PATH',
|
||||||
|
help = 'SBAT policy [.sbat section] for addons',
|
||||||
|
default = """sbat,1,SBAT Version,sbat,1,https://github.com/rhboot/shim/blob/main/SBAT.md
|
||||||
|
uki.addon,1,UKI Addon,uki.addon,1,https://www.freedesktop.org/software/systemd/man/systemd-stub.html
|
||||||
|
""",
|
||||||
|
config_key = 'Addon/SBAT',
|
||||||
|
),
|
||||||
|
|
||||||
ConfigItem(
|
ConfigItem(
|
||||||
'--section',
|
'--section',
|
||||||
dest = 'sections',
|
dest = 'sections',
|
||||||
|
Loading…
x
Reference in New Issue
Block a user