Skip to content

Commit 87dde58

Browse files
committed
initrd/bin/key-init.sh: stricter date checking
Includes the MTL case, where a CMOS reset sets the date to 2070, instead of pre-2024 Signed-off-by: Filip Lewiński <filip.lewinski@3mdeb.com>
1 parent c8b32bc commit 87dde58

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

initrd/bin/key-init.sh

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,17 @@ TRACE_FUNC
88
# Post processing of keys
99

1010
# Good system clock is required for GPG to work properly.
11-
# if system year is less then 2024, prompt user to set correct time
12-
if [ "$(date +%Y)" -lt 2024 ]; then
11+
# Reject years before 2025 (catches RTC reset to ~2024 on MTL with ALTCENTURY)
12+
# and years after 2045 (catches RTC reset to ~2070 via raw Unix-epoch year register).
13+
_year="$(date +%Y)"
14+
if [ "$_year" -lt 2025 ] || [ "$_year" -gt 2045 ]; then
1315
if whiptail_warning --title "System Time Incorrect" \
1416
--yesno "The system time is incorrect. Please set the correct time." \
1517
0 80 --yes-button Continue --no-button Skip --clear; then
1618
change-time.sh
1719
fi
1820
fi
21+
unset _year
1922

2023
# Import user's keys if they exist
2124
if [ -d /.gnupg/keys ]; then

0 commit comments

Comments
 (0)