mirror of
https://github.com/linuxboot/heads.git
synced 2024-12-18 20:47:55 +00:00
key-init: force user to change time if <2024, give warnings on errors
Signed-off-by: Thierry Laurion <insurgo@riseup.net>
This commit is contained in:
parent
3b22ae68e5
commit
ebb4d7ab69
@ -6,14 +6,21 @@ TRACE_FUNC
|
||||
|
||||
# Post processing of keys
|
||||
|
||||
# Good system clock is required for GPG to work properly.
|
||||
# if system year is less then 2024, prompt user to set correct time
|
||||
if [ "$(date +%Y)" -lt 2024 ]; then
|
||||
warn "System time is incorrect. Please set the correct time."
|
||||
change-time.sh
|
||||
fi
|
||||
|
||||
# Import user's keys
|
||||
gpg --import /.gnupg/keys/*.key /.gnupg/keys/*.asc 2>/dev/null || true
|
||||
gpg --import /.gnupg/keys/*.key /.gnupg/keys/*.asc 2>/dev/null || warn "Importing user's keys failed"
|
||||
|
||||
# Import trusted distro keys allowed for ISO signing
|
||||
gpg --homedir=/etc/distro/ --import /etc/distro/keys/* 2>/dev/null || true
|
||||
gpg --homedir=/etc/distro/ --import /etc/distro/keys/* 2>/dev/null || warn "Importing distro keys failed"
|
||||
#Set distro keys trust level to ultimate (trust anything that was signed with these keys)
|
||||
gpg --homedir=/etc/distro/ --list-keys --fingerprint --with-colons|sed -E -n -e 's/^fpr:::::::::([0-9A-F]+):$/\1:6:/p' |gpg --homedir=/etc/distro/ --import-ownertrust 2>/dev/null || true
|
||||
gpg --homedir=/etc/distro/ --update-trust 2>/dev/null || true
|
||||
gpg --homedir=/etc/distro/ --list-keys --fingerprint --with-colons|sed -E -n -e 's/^fpr:::::::::([0-9A-F]+):$/\1:6:/p' |gpg --homedir=/etc/distro/ --import-ownertrust 2>/dev/null || warn "Setting distro keys ultimate trust failed"
|
||||
gpg --homedir=/etc/distro/ --update-trust 2>/dev/null || warn "Updating distro keys trust failed"
|
||||
|
||||
# Add user's keys to the list of trusted keys for ISO signing
|
||||
gpg --export | gpg --homedir=/etc/distro/ --import 2>/dev/null || true
|
||||
gpg --export | gpg --homedir=/etc/distro/ --import 2>/dev/null || warn "Adding user's keys to distro keys failed"
|
||||
|
Loading…
Reference in New Issue
Block a user