Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow --fix-offset to create post-dated certificates #804

Merged
merged 1 commit into from
Dec 22, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 0 additions & 34 deletions easyrsa3/easyrsa
Original file line number Diff line number Diff line change
Expand Up @@ -3459,18 +3459,6 @@ fixed_cert_dates() {
this_year_n="$(busybox date -u +%y)"
today_n="$(busybox date -u +%j)"

# If the start day number is into the future then back-date by one year
if [ "$start_fix_day_n" -gt "$today_n" ]; then
not_valid_until_d="$(( start_fix_day_n - today_n ))"
this_year_n="$(( this_year_n - 1 ))"
# Get user confirmation
# This needs to be less rigid ;-)
confirm " Create certificate with one year back-dated date ? " \
"yes" "\
This certificate will not be valid for '${not_valid_until_d} days'.
The fixed date will be rolled backward by one year."
fi

New_Year_day_s="$(
busybox date -u -d "${this_year_n}01010000.01" '+%s'
)"
Expand All @@ -3492,17 +3480,6 @@ The fixed date will be rolled backward by one year."
this_year_n="$(date -j +%y)"
today_n="$(date -u -j +%j)"

# If the start day number is into the future then back-date by one year
if [ "$start_fix_day_n" -gt "$today_n" ]; then
not_valid_until_d="$(( start_fix_day_n - today_n ))"
this_year_n="$(( this_year_n - 1 ))"
# Get user confirmation
confirm " Create certificate with one year back-dated date ? " \
"yes" "\
This certificate will not be valid for ${not_valid_until_d} days.
The fixed date will be rolled backward by one year."
fi

New_Year_day_d="$(
date -u -j -f %y%m%d%H%M%S "${this_year_n}0101000001" \
+%Y%m%d%H%M.%SZ
Expand Down Expand Up @@ -3530,17 +3507,6 @@ The fixed date will be rolled backward by one year."
# Day of Year number today
today_n="$(date -u +%j)"

# If the start day number is into the future then back-date by one year
if [ "$start_fix_day_n" -gt "$today_n" ]; then
not_valid_until_d="$(( start_fix_day_n - today_n ))"
this_year_n="$(( this_year_n - 1 ))"
# Get user confirmation
confirm " Create certificate with one year back-dated date ? " \
"yes" "\
This certificate will not be valid for ${not_valid_until_d} days.
The fixed date will be rolled backward by one year."
fi

# New Years day date
New_Year_day_d="$(
date -u -d "${this_year_n}-01-01 00:00:01Z" '+%Y-%m-%d %H:%M:%SZ'
Expand Down