use openssl for verification
also rename --dbkey --dbcrt arguments
This commit is contained in:
parent
3813c38f72
commit
815c930eda
33
mkrelease.sh
33
mkrelease.sh
|
@ -6,15 +6,15 @@ Usage: $PROGNAME [OPTION]
|
||||||
|
|
||||||
-h, --help Display this help
|
-h, --help Display this help
|
||||||
--nosign Don't sign the EFI executable
|
--nosign Don't sign the EFI executable
|
||||||
--dbkey KEY Use KEY as certification key for EFI signing
|
--key KEY Use KEY as certification key for EFI signing
|
||||||
--dbcrt CRT Use CRT as certification for EFI signing
|
--crt CRT Use CRT as certification for EFI signing
|
||||||
EOF
|
EOF
|
||||||
}
|
}
|
||||||
|
|
||||||
TEMP=$(
|
TEMP=$(
|
||||||
getopt -o '' \
|
getopt -o '' \
|
||||||
--long dbkey: \
|
--long key: \
|
||||||
--long dbcrt: \
|
--long crt: \
|
||||||
--long nosign \
|
--long nosign \
|
||||||
--long notar \
|
--long notar \
|
||||||
--long help \
|
--long help \
|
||||||
|
@ -31,12 +31,12 @@ unset TEMP
|
||||||
|
|
||||||
while true; do
|
while true; do
|
||||||
case "$1" in
|
case "$1" in
|
||||||
'--dbkey')
|
'--key')
|
||||||
DBKEY="$(readlink -e $2)"
|
KEY="$(readlink -e $2)"
|
||||||
shift 2; continue
|
shift 2; continue
|
||||||
;;
|
;;
|
||||||
'--dbcrt')
|
'--crt')
|
||||||
DBCRT="$(readlink -e $2)"
|
CRT="$(readlink -e $2)"
|
||||||
shift 2; continue
|
shift 2; continue
|
||||||
;;
|
;;
|
||||||
'--nosign')
|
'--nosign')
|
||||||
|
@ -64,24 +64,29 @@ done
|
||||||
|
|
||||||
JSON="$(realpath -e $1)"
|
JSON="$(realpath -e $1)"
|
||||||
BASEDIR="${JSON%/*}"
|
BASEDIR="${JSON%/*}"
|
||||||
IMAGE="${BASEDIR}/$(jq -r '.name' ${JSON})-$(jq -r '.version' ${JSON})"
|
NAME="$(jq -r '.name' ${JSON})"
|
||||||
|
VERSION="$(jq -r '.version' ${JSON})"
|
||||||
|
IMAGE="${BASEDIR}/${NAME}-${VERSION}"
|
||||||
|
CRT=${CRT:-${BASEDIR}/${NAME}.crt}
|
||||||
|
KEY=${KEY:-${BASEDIR}/${NAME}.key}
|
||||||
|
|
||||||
pushd "$IMAGE"
|
pushd "$IMAGE"
|
||||||
if ! [[ $NOSIGN ]]; then
|
if ! [[ $NOSIGN ]]; then
|
||||||
if ! [[ $DBKEY ]] || ! [[ $DBCRT ]]; then
|
if ! [[ $KEY ]] || ! [[ $CRT ]]; then
|
||||||
echo "Need --dbkey KEY --dbcrt CRT options"
|
echo "Cannot find $KEY and $CRT"
|
||||||
|
echo "Need --key KEY --crt CRT options"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
for i in $(find . -type f -name '*.efi'); do
|
for i in $(find . -type f -name '*.efi'); do
|
||||||
[[ -f "$i" ]] || continue
|
[[ -f "$i" ]] || continue
|
||||||
if ! sbverify --cert "$DBCRT" "$i" &>/dev/null ; then
|
if ! sbverify --cert "$CRT" "$i" &>/dev/null ; then
|
||||||
sbsign --key "$DBKEY" --cert "$DBCRT" --output "${i}signed" "$i"
|
sbsign --key "$KEY" --cert "$CRT" --output "${i}signed" "$i"
|
||||||
mv "${i}signed" "$i"
|
mv "${i}signed" "$i"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
[[ -f sha512sum.txt ]] || sha512sum $(find . -type f) > sha512sum.txt
|
[[ -f sha512sum.txt ]] || sha512sum $(find . -type f) > sha512sum.txt
|
||||||
[[ -f sha512sum.txt.sig ]] || gpg2 --detach-sign sha512sum.txt
|
[[ -f sha512sum.txt.sig ]] || openssl dgst -sha256 -sign "$KEY" -out sha512sum.txt.sig sha512sum.txt
|
||||||
|
|
||||||
popd
|
popd
|
||||||
|
|
||||||
|
|
|
@ -37,7 +37,7 @@ TEMP=$(
|
||||||
--long releasever: \
|
--long releasever: \
|
||||||
--long logo: \
|
--long logo: \
|
||||||
--long quirks: \
|
--long quirks: \
|
||||||
--long gpgkey: \
|
--long crt: \
|
||||||
--long reposd: \
|
--long reposd: \
|
||||||
--long statedir: \
|
--long statedir: \
|
||||||
--long noupdates \
|
--long noupdates \
|
||||||
|
@ -94,8 +94,8 @@ while true; do
|
||||||
QUIRKS+=( $2 )
|
QUIRKS+=( $2 )
|
||||||
shift 2; continue
|
shift 2; continue
|
||||||
;;
|
;;
|
||||||
'--gpgkey')
|
'--crt')
|
||||||
GPGKEY="$2"
|
CRT="$(readlink -e $2)"
|
||||||
shift 2; continue
|
shift 2; continue
|
||||||
;;
|
;;
|
||||||
'--reposd')
|
'--reposd')
|
||||||
|
@ -130,7 +130,7 @@ NAME=${NAME:-"FedoraBook"}
|
||||||
RELEASEVER=${RELEASEVER:-$VERSION_ID}
|
RELEASEVER=${RELEASEVER:-$VERSION_ID}
|
||||||
VERSION_ID="${RELEASEVER}.$(date -u +'%Y%m%d%H%M%S')"
|
VERSION_ID="${RELEASEVER}.$(date -u +'%Y%m%d%H%M%S')"
|
||||||
OUTDIR=${OUTDIR:-"${CURDIR}/${NAME}-${VERSION_ID}"}
|
OUTDIR=${OUTDIR:-"${CURDIR}/${NAME}-${VERSION_ID}"}
|
||||||
GPGKEY=${GPGKEY:-${NAME}.gpg}
|
CRT=${CRT:-${NAME}.crt}
|
||||||
REPOSD=${REPOSD:-/etc/yum.repos.d}
|
REPOSD=${REPOSD:-/etc/yum.repos.d}
|
||||||
STATEDIR=${STATEDIR:-"${BASEDIR}/${NAME}"}
|
STATEDIR=${STATEDIR:-"${BASEDIR}/${NAME}"}
|
||||||
|
|
||||||
|
@ -312,7 +312,8 @@ cp "$CURDIR/update.sh" "$sysroot"/usr/bin/update
|
||||||
cp "$CURDIR/update.sh" "$sysroot"/usr/bin/update
|
cp "$CURDIR/update.sh" "$sysroot"/usr/bin/update
|
||||||
|
|
||||||
mkdir -p "$sysroot"/etc/pki/${NAME}
|
mkdir -p "$sysroot"/etc/pki/${NAME}
|
||||||
cp "${CURDIR}/${GPGKEY}" "$sysroot"/etc/pki/${NAME}/GPG-KEY
|
openssl x509 -in "${CURDIR}/${CRT}" -pubkey -noout > "$sysroot"/etc/pki/${NAME}/pubkey
|
||||||
|
cp "${CURDIR}/${CRT}" "$sysroot"/etc/pki/${NAME}/crt
|
||||||
|
|
||||||
rpm --root "$sysroot" -qa | sort > "$sysroot"/usr/rpm-list.txt
|
rpm --root "$sysroot" -qa | sort > "$sysroot"/usr/rpm-list.txt
|
||||||
|
|
||||||
|
|
|
@ -178,7 +178,8 @@ cd ${IMAGE}
|
||||||
|
|
||||||
if ! [[ $NO_CHECK ]]; then
|
if ! [[ $NO_CHECK ]]; then
|
||||||
# check integrity
|
# check integrity
|
||||||
gpg2 --no-default-keyring --keyring /etc/pki/${NAME}/GPG-KEY --verify sha512sum.txt.sig sha512sum.txt
|
openssl dgst -sha256 -verify "$sysroot"/etc/pki/${NAME}/pubkey \
|
||||||
|
-signature sha512sum.txt.sig sha512sum.txt
|
||||||
sha512sum --strict -c sha512sum.txt
|
sha512sum --strict -c sha512sum.txt
|
||||||
unset FILES; declare -A FILES
|
unset FILES; declare -A FILES
|
||||||
while read _ file || [[ $file ]]; do
|
while read _ file || [[ $file ]]; do
|
||||||
|
|
Loading…
Reference in a new issue