arrfab / rpms / shim-signed

Forked from rpms/shim-signed 5 years ago
Clone

Blame SPECS/shim-signed.spec

3bee5b
Name:           shim-signed
5cf28a
Version:        0.9
5cf28a
Release:        2%{?dist}
3bee5b
Summary:        First-stage UEFI bootloader
3bee5b
Provides:	shim = %{version}-%{release}
5cf28a
%define unsigned_release 1.el7
3bee5b
3bee5b
License:        BSD
3bee5b
URL:            http://www.codon.org.uk/~mjg59/shim/
5cf28a
# incorporate mokutil for packaging simplicity
5cf28a
%global mokutil_version 0.2.0
5cf28a
Source0:        https://github.com/lcp/mokutil/archive/mokutil-%{mokutil_version}.tar.gz
5cf28a
Patch0001:	0001-Fix-a-potential-buffer-overflow.patch
5cf28a
Patch0002:	0002-Avoid-a-signed-comparison-error.patch
5cf28a
5cf28a
Source1:	shimx64.efi
5cf28a
Source2:	shimaa64.efi
5cf28a
Source3:	secureboot.cer
5cf28a
Source4:	securebootca.cer
5cf28a
Source5:	BOOT.CSV
5cf28a
5cf28a
%ifarch x86_64
5cf28a
%global efiarch X64
5cf28a
%global efiarchlc x64
5cf28a
%global shimsrc %{SOURCE1}
5cf28a
%endif
5cf28a
%ifarch aarch64
5cf28a
%global efiarch AA64
5cf28a
%global efiarchlc aa64
5cf28a
%global shimsrc %{SOURCE2}
5cf28a
%endif
5cf28a
%define unsigned_dir %{_datadir}/shim/%{efiarchlc}-%{version}-%{unsigned_release}/
3bee5b
5cf28a
BuildRequires: git
5cf28a
BuildRequires: openssl-devel openssl
3bee5b
BuildRequires: pesign >= 0.106-5%{dist}
5cf28a
BuildRequires: efivar-devel
5cf28a
# BuildRequires: shim-unsigned = %{version}-%{unsigned_release}
5cf28a
BuildRequires: shim-unsigned = %{version}-%{unsigned_release}
5cf28a
5cf28a
# for mokutil's configure
5cf28a
BuildRequires: autoconf automake
3bee5b
3bee5b
# Shim uses OpenSSL, but cannot use the system copy as the UEFI ABI is not
3bee5b
# compatible with SysV (there's no red zone under UEFI) and there isn't a
3bee5b
# POSIX-style C library.
3bee5b
# BuildRequires: OpenSSL
68c47f
Provides: bundled(openssl) = 0.9.8zb
3bee5b
3bee5b
# Shim is only required on platforms implementing the UEFI secure boot
3bee5b
# protocol. The only one of those we currently wish to support is 64-bit x86.
3bee5b
# Adding further platforms will require adding appropriate relocation code.
68c47f
ExclusiveArch: x86_64 aarch64
3bee5b
5cf28a
%define debug_package \
5cf28a
%ifnarch noarch\
5cf28a
%global __debug_package 1\
5cf28a
%package -n mokutil-debuginfo\
5cf28a
Summary: Debug information for package %{name}\
5cf28a
Group: Development/Debug\
5cf28a
AutoReqProv: 0\
5cf28a
%description -n mokutil-debuginfo\
5cf28a
This package provides debug information for package %{name}.\
5cf28a
Debug information is useful when developing applications that use this\
5cf28a
package or when debugging this package.\
5cf28a
%files -n mokutil-debuginfo -f debugfiles.list\
5cf28a
%defattr(-,root,root)\
5cf28a
%endif\
5cf28a
%{nil}
3bee5b
3bee5b
# Figure out the right file path to use
5cf28a
%global efidir %(eval echo $(grep ^ID= /etc/os-release | sed -e 's/^ID=//' -e 's/rhel/redhat/'))
3bee5b
68c47f
%define ca_signed_arches x86_64
68c47f
%define rh_signed_arches x86_64 aarch64
68c47f
3bee5b
%description
3bee5b
Initial UEFI bootloader that handles chaining to a trusted full bootloader
3bee5b
under secure boot environments. This package contains the version signed by
3bee5b
the UEFI signing service.
3bee5b
3bee5b
%package -n shim
3bee5b
Summary: First-stage UEFI bootloader
5cf28a
Requires: mokutil = %{version}-%{release}
3bee5b
Provides: shim-signed = %{version}-%{release}
3bee5b
Obsoletes: shim-signed < %{version}-%{release}
3bee5b
3bee5b
%description -n shim
3bee5b
Initial UEFI bootloader that handles chaining to a trusted full bootloader
3bee5b
under secure boot environments. This package contains the version signed by
3bee5b
the UEFI signing service.
3bee5b
5cf28a
%package -n mokutil
5cf28a
Summary: Utilities for managing Secure Boot/MoK keys.
5cf28a
5cf28a
%description -n mokutil
5cf28a
Utilities for managing the "Machine's Own Keys" list.
5cf28a
3bee5b
%prep
5cf28a
%setup -T -c -n shim-signed-%{version}
5cf28a
%setup -q -D -a 0 -n shim-signed-%{version} -c
5cf28a
#%%setup -T -D -n shim-signed-%{version}
5cf28a
git init
5cf28a
git config user.email "example@example.com"
5cf28a
git config user.name "rpmbuild -bp"
5cf28a
git add .
5cf28a
git commit -a -q -m "%{version} baseline."
5cf28a
git am --ignore-whitespace %{patches} 
5cf28a
git config --unset user.email
5cf28a
git config --unset user.name
3bee5b
3bee5b
%build
3bee5b
%define vendor_token_str %{expand:%%{nil}%%{?vendor_token_name:-t "%{vendor_token_name}"}}
3bee5b
%define vendor_cert_str %{expand:%%{!?vendor_cert_nickname:-c "Red Hat Test Certificate"}%%{?vendor_cert_nickname:-c "%%{vendor_cert_nickname}"}}
3bee5b
68c47f
%ifarch %{ca_signed_arches}
5cf28a
pesign -i %{shimsrc} -h -P > shim.hash
5cf28a
if ! cmp shim.hash %{unsigned_dir}shim.hash ; then
3bee5b
	echo Invalid signature\! > /dev/stderr
3bee5b
	exit 1
3bee5b
fi
5cf28a
cp %{shimsrc} shim.efi
68c47f
%endif
68c47f
%ifarch %{rh_signed_arches}
5cf28a
%pesign -s -i %{unsigned_dir}shim.efi -a %{SOURCE4} -c %{SOURCE3} -n redhatsecureboot301 -o shim-%{efidir}.efi
68c47f
%endif
68c47f
%ifarch %{rh_signed_arches}
68c47f
%ifnarch %{ca_signed_arches}
68c47f
cp shim-%{efidir}.efi shim.efi
68c47f
%endif
68c47f
%endif
68c47f
5cf28a
%pesign -s -i %{unsigned_dir}MokManager.efi -o MokManager.efi -a %{SOURCE4} -c %{SOURCE3} -n redhatsecureboot301
5cf28a
%pesign -s -i %{unsigned_dir}fallback.efi -o fallback.efi -a %{SOURCE4} -c %{SOURCE3} -n redhatsecureboot301
5cf28a
5cf28a
cd mokutil-%{mokutil_version}
5cf28a
./autogen.sh
5cf28a
%configure
5cf28a
make %{?_smp_mflags}
3bee5b
3bee5b
%install
3bee5b
rm -rf $RPM_BUILD_ROOT
3bee5b
install -D -d -m 0755 $RPM_BUILD_ROOT/boot/efi/EFI/%{efidir}/
3bee5b
install -m 0644 shim.efi $RPM_BUILD_ROOT/boot/efi/EFI/%{efidir}/shim.efi
68c47f
install -m 0644 shim-%{efidir}.efi $RPM_BUILD_ROOT/boot/efi/EFI/%{efidir}/shim-%{efidir}.efi
3bee5b
install -m 0644 MokManager.efi $RPM_BUILD_ROOT/boot/efi/EFI/%{efidir}/MokManager.efi
5cf28a
install -m 0644 %{SOURCE5} $RPM_BUILD_ROOT/boot/efi/EFI/%{efidir}/BOOT.CSV
3bee5b
3bee5b
install -D -d -m 0755 $RPM_BUILD_ROOT/boot/efi/EFI/BOOT/
5cf28a
install -m 0644 shim.efi $RPM_BUILD_ROOT/boot/efi/EFI/BOOT/BOOT%{efiarch}.EFI
3bee5b
install -m 0644 fallback.efi $RPM_BUILD_ROOT/boot/efi/EFI/BOOT/fallback.efi
3bee5b
5cf28a
cd mokutil-%{mokutil_version}
5cf28a
make PREFIX=%{_prefix} LIBDIR=%{_libdir} DESTDIR=%{buildroot} install
5cf28a
3bee5b
%files -n shim
3bee5b
/boot/efi/EFI/%{efidir}/shim.efi
68c47f
/boot/efi/EFI/%{efidir}/shim-%{efidir}.efi
3bee5b
/boot/efi/EFI/%{efidir}/MokManager.efi
3bee5b
/boot/efi/EFI/%{efidir}/BOOT.CSV
5cf28a
/boot/efi/EFI/BOOT/BOOT%{efiarch}.EFI
3bee5b
/boot/efi/EFI/BOOT/fallback.efi
3bee5b
5cf28a
%files -n mokutil
5cf28a
%{!?_licensedir:%global license %%doc}
5cf28a
%license mokutil-%{mokutil_version}/COPYING
5cf28a
%doc mokutil-%{mokutil_version}/README
5cf28a
%{_bindir}/mokutil
5cf28a
%{_mandir}/man1/*
5cf28a
3bee5b
%changelog
5cf28a
* Mon Jul 20 2015 Peter Jones <pjones@redhat.com> - 0.9-2
5cf28a
- Apparently I'm *never* going to learn to build this in the right target
5cf28a
  the first time through.
5cf28a
  Related: rhbz#1100048
5cf28a
5cf28a
* Mon Jun 29 2015 Peter Jones <pjones@redhat.com> - 0.9-0.1
5cf28a
- Bump version for 0.9
5cf28a
  Also use mokutil-0.3.0
5cf28a
  Related: rhbz#1100048
5cf28a
5cf28a
* Tue Jun 23 2015 Peter Jones <pjones@redhat.com> - 0.7-14.1
5cf28a
- Fix mokutil_version usage.
5cf28a
  Related: rhbz#1100048
5cf28a
5cf28a
* Mon Jun 22 2015 Peter Jones <pjones@redhat.com> - 0.7-14
5cf28a
- Pull in aarch64 build so they can compose that tree.
5cf28a
  (-14 to match -unsigned)
5cf28a
  Related: rhbz#1100048
5cf28a
5cf28a
* Wed Feb 25 2015 Peter Jones <pjones@redhat.com> - 0.7-12
5cf28a
- Fix some minor build bugs on Aarch64
5cf28a
  Related: rhbz#1190191
5cf28a
5cf28a
* Tue Feb 24 2015 Peter Jones <pjones@redhat.com> - 0.7-11
5cf28a
- Fix section loading on Aarch64
5cf28a
  Related: rhbz#1190191
5cf28a
5cf28a
* Wed Dec 17 2014 Peter Jones <pjones@redhat.com> - 0.7-10
5cf28a
- Rebuild for Aarch64 to get \EFI\BOOT\BOOTAA64.EFI named right.
5cf28a
  (I managed to fix the inputs but not the outputs in -9.)
5cf28a
  Related: rhbz#1100048
5cf28a
5cf28a
* Wed Dec 17 2014 Peter Jones <pjones@redhat.com> - 0.7-9
5cf28a
- Rebuild for Aarch64 to get \EFI\BOOT\BOOTAA64.EFI named right.
5cf28a
  Related: rhbz#1100048
5cf28a
5cf28a
* Tue Oct 21 2014 Peter Jones <pjones@redhat.com> - 0.7-8
5cf28a
- Build for aarch64 as well 
5cf28a
  Related: rhbz#1100048
68c47f
- out-of-bounds memory read flaw in DHCPv6 packet processing
68c47f
  Resolves: CVE-2014-3675
68c47f
- heap-based buffer overflow flaw in IPv6 address parsing
68c47f
  Resolves: CVE-2014-3676
68c47f
- memory corruption flaw when processing Machine Owner Keys (MOKs)
68c47f
  Resolves: CVE-2014-3677
Karanbir Singh c49d55
5cf28a
* Tue Sep 23 2014 Peter Jones <pjones@redhat.com> - 0.7-7
5cf28a
- Make sure we use the right keys on Aarch64.
5cf28a
  (It's only a demo at this stage.)
5cf28a
  Related: rhbz#1100048
5cf28a
5cf28a
* Tue Sep 23 2014 Peter Jones <pjones@redhat.com> - 0.7-6
5cf28a
- Add ARM Aarch64.
5cf28a
  Related: rhbz#1100048
5cf28a
409188
* Thu Feb 27 2014 Peter Jones <pjones@redhat.com> - 0.7-5.2
409188
- Get the right signatures on shim-redhat.efi
409188
  Related: rhbz#1064449
409188
409188
* Thu Feb 27 2014 Peter Jones <pjones@redhat.com> - 0.7-5.1
409188
- Update for signed shim for RHEL 7
409188
  Resolves: rhbz#1064449
409188
3bee5b
* Thu Nov 21 2013 Peter Jones <pjones@redhat.com> - 0.7-5
3bee5b
- Fix shim-unsigned deps.
3bee5b
  Related: rhbz#1032583
3bee5b
3bee5b
* Thu Nov 21 2013 Peter Jones <pjones@redhat.com> - 0.7-4
3bee5b
- Make dhcp4 work better.
3bee5b
  Related: rhbz#1032583
3bee5b
3bee5b
* Thu Nov 14 2013 Peter Jones <pjones@redhat.com> - 0.7-3
3bee5b
- Make lockdown include UEFI and other KEK/DB entries.
3bee5b
  Related: rhbz#1030492
3bee5b
3bee5b
* Fri Nov 08 2013 Peter Jones <pjones@redhat.com> - 0.7-2
3bee5b
- Handle SetupMode better in lockdown as well
3bee5b
  Related: rhbz#996863
3bee5b
3bee5b
* Wed Nov 06 2013 Peter Jones <pjones@redhat.com> - 0.7-1
3bee5b
- Don't treat SetupMode variable's presence as meaning we're in SetupMode.
3bee5b
  Related: rhbz#996863
3bee5b
3bee5b
* Wed Nov 06 2013 Peter Jones <pjones@redhat.com> - 0.6-3
3bee5b
- Use the correct CA and signer certificates.
3bee5b
  Related: rhbz#996863
3bee5b
3bee5b
* Thu Oct 31 2013 Peter Jones <pjones@redhat.com> - 0.6-1
3bee5b
- Update to 0.6-1
3bee5b
  Resolves: rhbz#1008379
3bee5b
3bee5b
* Wed Aug 07 2013 Peter Jones <pjones@redhat.com> - 0.4-3.2
3bee5b
- Depend on newer pesign.
3bee5b
  Related: rhbz#989442
3bee5b
3bee5b
* Tue Aug 06 2013 Peter Jones <pjones@redhat.com> - 0.4-3.1
3bee5b
- Rebuild with newer pesign
3bee5b
  Related: rhbz#989442
3bee5b
3bee5b
* Tue Aug 06 2013 Peter Jones <pjones@redhat.com> - 0.4-3
3bee5b
- Update for RHEL signing with early test keys.
3bee5b
  Related: rhbz#989442
3bee5b
3bee5b
* Thu Jun 20 2013 Peter Jones <pjones@redhat.com> - 0.4-1
3bee5b
- Provide a fallback for uninitialized Boot#### and BootOrder
3bee5b
  Resolves: rhbz#963359
3bee5b
- Move all signing from shim-unsigned to here
3bee5b
- properly compare our generated hash from shim-unsigned with the hash of
3bee5b
  the signed binary (as opposed to doing it manually)
3bee5b
3bee5b
* Fri May 31 2013 Peter Jones <pjones@redhat.com> - 0.2-4.4
3bee5b
- Re-sign to get alignments that match the new specification.
3bee5b
  Resolves: rhbz#963361
3bee5b
3bee5b
* Thu Feb 14 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.2-4.3
3bee5b
- Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild
3bee5b
3bee5b
* Wed Jan 02 2013 Peter Jones <pjones@redhat.com> - 0.2-3.3
3bee5b
- Add obsoletes and provides for earlier shim-signed packages, to cover
3bee5b
  the package update cases where previous versions were installed.
3bee5b
  Related: rhbz#888026
3bee5b
3bee5b
* Mon Dec 17 2012 Peter Jones <pjones@redhat.com> - 0.2-3.2
3bee5b
- Make the shim-unsigned dep be on the subpackage.
3bee5b
3bee5b
* Sun Dec 16 2012 Peter Jones <pjones@redhat.com> - 0.2-3.1
3bee5b
- Rebuild to provide "shim" package directly instead of just as a Provides:
3bee5b
3bee5b
* Sat Dec 15 2012 Peter Jones <pjones@redhat.com> - 0.2-3
3bee5b
- Also provide shim-fedora.efi, signed only by the fedora signer.
3bee5b
- Fix the fedora signature on the result to actually be correct.
3bee5b
- Update for shim-unsigned 0.2-3
3bee5b
3bee5b
* Mon Dec 03 2012 Peter Jones <pjones@redhat.com> - 0.2-2
3bee5b
- Initial build