| Server IP : 82.208.35.60 / Your IP : 216.73.216.168 Web Server : Apache/2.4.55 (FreeBSD) OpenSSL/1.1.1q-freebsd PHP/7.3.31 System : FreeBSD server7.d2m.cz 12.4-RELEASE-p9 FreeBSD 12.4-RELEASE-p9 GENERIC amd64 User : studiokobylisy_cz ( 1008) PHP Version : 7.3.31 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /usr/share/examples/uefisign/ |
Upload File : |
#!/bin/sh
#
# See uefisign(8) manual page for usage instructions.
#
# $FreeBSD: releng/12.4/share/examples/uefisign/uefikeys 279321 2015-02-26 14:22:27Z trasz $
#
die() {
echo "$*" > /dev/stderr
exit 1
}
if [ $# -ne 1 ]; then
echo "usage: $0 common-name"
exit 1
fi
certfile="${1}.pem"
efifile="${1}.cer"
keyfile="${1}.key"
# XXX: Set this to ten years; we don't want system to suddenly stop booting
# due to certificate expiration. Better way would be to use Authenticode
# Timestamp. That said, the rumor is UEFI implementations ignore it anyway.
days="3650"
subj="/CN=${1}"
[ ! -e "${certfile}" ] || die "${certfile} already exists"
[ ! -e "${efifile}" ] || die "${efifile} already exists"
[ ! -e "${keyfile}" ] || die "${keyfile} already exists"
umask 077 || die "umask 077 failed"
openssl genrsa -out "${keyfile}" 2048 2> /dev/null || die "openssl genrsa failed"
openssl req -new -x509 -sha256 -days "${days}" -subj "${subj}" -key "${keyfile}" -out "${certfile}" || die "openssl req failed"
openssl x509 -inform PEM -outform DER -in "${certfile}" -out "${efifile}" || die "openssl x509 failed"
echo "certificate: ${certfile}; private key: ${keyfile}; certificate to enroll in UEFI: ${efifile}"