@@ -3252,72 +3252,6 @@ Unable to revoke as the input-file is not a valid certificate.
3252
3252
Certificate was expected at:
3253
3253
* $crt_in"
3254
3254
3255
- # Check for misuse of revoke when revoke-* is intended
3256
- case "$cert_dir" in
3257
- issued)
3258
- # expired cert
3259
- exp_exist="${in_dir}/expired/${file_name_base}.crt"
3260
- if [ -f "$exp_exist" ]; then
3261
- exp_endd="$(
3262
- "$EASYRSA_OPENSSL" x509 -in "$exp_exist" -noout \
3263
- -enddate -serial)" || die "revoke - expire -enddate"
3264
- # shellcheck disable=SC2295 # Expansions inside ${..}
3265
- exp_confirm="
3266
- Expired certificate:
3267
- * $exp_exist
3268
- Expiry: ${exp_endd%%${NL}serial=*}
3269
- Serial: ${exp_endd##*serial=}
3270
- Use command 'revoke-expired' to revoke this certificate."
3271
- else
3272
- unset -v exp_exist exp_endd exp_confirm
3273
- fi
3274
-
3275
- # renewed cert
3276
- ren_exist="${in_dir}/renewed/${file_name_base}.crt"
3277
- if [ -f "$ren_exist" ]; then
3278
- ren_endd="$(
3279
- "$EASYRSA_OPENSSL" x509 -in "$ren_exist" -noout \
3280
- -enddate -serial)" || die "revoke - renew -enddate"
3281
- # shellcheck disable=SC2295 # Expansions inside ${..}
3282
- ren_confirm="
3283
- Renewed certificate:
3284
- * $ren_exist
3285
- Expiry: ${ren_endd%%${NL}serial=*}
3286
- Serial: ${ren_endd##*serial=}
3287
- Use command 'revoke-renewed' to revoke this certificate."
3288
- else
3289
- unset -v ren_exist ren_endd ren_confirm
3290
- fi
3291
-
3292
- # issued cert
3293
- crt_endd="$(
3294
- "$EASYRSA_OPENSSL" x509 -in "$crt_in" -noout \
3295
- -enddate -serial)" || die "revoke - expire -enddate"
3296
-
3297
- # Confirm intended use of 'revoke'
3298
- if [ "$exp_exist" ] || [ "$ren_exist" ]; then
3299
- warn "The following certificate(s) exist:
3300
- ${exp_exist:+${exp_confirm}${NL}}${ren_exist:+${ren_confirm}${NL}}"
3301
- # shellcheck disable=SC2295 # Expansions inside ${..}
3302
- confirm " Confirm intended use of 'revoke' ? " yes "\
3303
- Please confirm your intended use of 'revoke' for the following
3304
- issued certificate:${NL}
3305
- * $crt_in
3306
- Expiry: ${crt_endd%%${NL}serial=*}
3307
- Serial: ${crt_endd##*serial=}"
3308
- fi
3309
-
3310
- # Revoking an issued cert forces req/key to be moved
3311
- move_req_and_key=1
3312
- ;;
3313
- expired|renewed/issued)
3314
- # Revoke-expired/renewed cert means req/key can remain
3315
- move_req_and_key=
3316
- ;;
3317
- *)
3318
- die "Invalid cert_dir: '$cert_dir'"
3319
- esac
3320
-
3321
3255
# Verify request
3322
3256
if [ -f "$req_in" ]; then
3323
3257
verify_file req "$req_in" || user_error "\
@@ -3380,6 +3314,7 @@ The inline credentials files:
3380
3314
* $inline_pub
3381
3315
* $inline_pri"
3382
3316
3317
+ # now confirm
3383
3318
confirm " Continue with revocation: " "yes" "
3384
3319
Please confirm that you wish to revoke the certificate
3385
3320
with the following subject:
@@ -5945,6 +5880,17 @@ case "$cmd" in
5945
5880
gen_crl
5946
5881
;;
5947
5882
revoke)
5883
+ # Force user to select revoke type
5884
+ [ "$EASYRSA_BATCH" ] || user_error "\
5885
+ Please select which type of 'revoke' command is required:
5886
+ * 'revoke-issued' will revoke a current certificate.
5887
+ * 'revoke-expired' will revoke an old cert, which has been expired.
5888
+ * 'revoke-renewed' will revoke an old cert, which has been renewed."
5889
+ verify_working_env
5890
+ cert_dir=issued
5891
+ revoke "$@"
5892
+ ;;
5893
+ revoke-issued)
5948
5894
verify_working_env
5949
5895
cert_dir=issued
5950
5896
revoke "$@"
0 commit comments