Rename --revoke-existing
to --replace-existing
This commit is contained in:
parent
123d5f5c05
commit
ab4e3e5de1
|
@ -14,7 +14,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||
* Accept `--days` and `--end-date` command line options
|
||||
* CA key length is configurable (minimum 4096)
|
||||
* Add `--non-interactive` command line option
|
||||
* Add `--revoke-existing` command line option
|
||||
* Add `--replace-existing` command line option
|
||||
|
||||
### Changed
|
||||
|
||||
|
|
18
shellpki
18
shellpki
|
@ -261,16 +261,16 @@ ask_user_password() {
|
|||
warning "Warning: empty password from input"
|
||||
fi
|
||||
}
|
||||
revoke_existing_or_abort() {
|
||||
replace_existing_or_abort() {
|
||||
cn=${1:?}
|
||||
if [ "${non_interactive}" -eq 1 ]; then
|
||||
if [ "${revoke_existing}" -eq 1 ]; then
|
||||
if [ "${replace_existing}" -eq 1 ]; then
|
||||
resp="y"
|
||||
else
|
||||
error "${cn} already exists, use \`--revoke-existing' to force"
|
||||
error "${cn} already exists, use \`--replace-existing' to force"
|
||||
fi
|
||||
else
|
||||
if [ "${revoke_existing}" -eq 1 ]; then
|
||||
if [ "${replace_existing}" -eq 1 ]; then
|
||||
resp="y"
|
||||
else
|
||||
printf "%s already exists, do you want to revoke and recreate it ? [y/N] " "${cn}"
|
||||
|
@ -288,7 +288,7 @@ create() {
|
|||
from_csr=0
|
||||
ask_pass=0
|
||||
non_interactive=0
|
||||
revoke_existing=0
|
||||
replace_existing=0
|
||||
days=""
|
||||
end_date=""
|
||||
|
||||
|
@ -384,8 +384,8 @@ create() {
|
|||
--non-interactive)
|
||||
non_interactive=1
|
||||
;;
|
||||
--revoke-existing)
|
||||
revoke_existing=1
|
||||
--replace-existing)
|
||||
replace_existing=1
|
||||
;;
|
||||
--)
|
||||
# End of all options.
|
||||
|
@ -466,7 +466,7 @@ create() {
|
|||
|
||||
# check if CN already exist
|
||||
if [ -f "${crt_file}" ]; then
|
||||
revoke_existing_or_abort "${cn}"
|
||||
replace_existing_or_abort "${cn}"
|
||||
fi
|
||||
|
||||
# ca sign and generate cert
|
||||
|
@ -501,7 +501,7 @@ create() {
|
|||
|
||||
# check if CN already exist
|
||||
if [ -f "${crt_file}" ]; then
|
||||
revoke_existing_or_abort "${cn}"
|
||||
replace_existing_or_abort "${cn}"
|
||||
fi
|
||||
|
||||
# ask for CA passphrase
|
||||
|
|
Loading…
Reference in a new issue