-
Notifications
You must be signed in to change notification settings - Fork 257
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
Add bundle to x509 needs-renewal command. #873
Conversation
- Fixes unexpected behavior of implicitly applying needs-renewal to every cert in the bundle
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The old code has also an exit code 2
that is not documented.
command/certificate/needsRenewal.go
Outdated
cli.BoolFlag{ | ||
Name: `bundle`, | ||
Usage: `Check all certificates in the order in which they appear in the bundle. | ||
By default (without this flag) this command will only check the leaf certificate.`, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the default option can be clarified in the description.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is documented just below in the exit codes section.
command/certificate/needsRenewal.go
Outdated
@@ -22,13 +23,16 @@ func needsRenewalCommand() cli.Command { | |||
Action: cli.ActionFunc(needsRenewalAction), | |||
Usage: `Check if a certificate needs to be renewed`, | |||
UsageText: `**step certificate needs-renewal** <cert-file or hostname> | |||
[**--expires-in**=<percent|duration>] [**--roots**=<root-bundle>] [**--servername**=<servername>]`, | |||
[**--expires-in**=<percent|duration>] [**--bundle] [**--verbose] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Two missing **
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was wrong about the verbose. We're already showing something if we DO NOT NEED to renew. We can remove the option or add a message something if the certificate NEEDS to be renewed.
command/certificate/needsRenewal.go
Outdated
@@ -48,11 +52,22 @@ Check if certificate.crt has passed 66 percent of its validity period: | |||
$ step certificate needs-renewal ./certificate.crt | |||
''' | |||
|
|||
Check if any certificate in the bundle has passed 66 percent of it's validity period: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Clarify in the first example that is the leaf certificate. Check if the leaf certificate.crt ...
command/certificate/needsRenewal.go
Outdated
if isVerbose { | ||
fmt.Println(needsRenewal) | ||
} | ||
if needsRenewal { | ||
return nil | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't know that when the certificate doesn't need renewal shows the following:
$ step certificate needs-renewal acme.crt
certificate does not need renewal
So perhaps the verbose option is not necessary.
command/ssh/needsRenewal.go
Outdated
func isVerboseExit(needsRenewal, isVerbose bool) error { | ||
if isVerbose { | ||
fmt.Println(needsRenewal) | ||
} | ||
if needsRenewal { | ||
return nil | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same comment as before. Perhaps show something only if needs renewal is false?
command/certificate/needsRenewal.go
Outdated
}, | ||
cli.BoolFlag{ | ||
Name: "verbose, v", | ||
Usage: `Return "true" or "false" in the terminal.`, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The verbose usage is not right. We don't show true or false.
command/ssh/needsRenewal.go
Outdated
@@ -66,6 +68,10 @@ character. If using <duration>, the input must be a sequence of decimal numbers, | |||
each with optional fraction and a unit suffix, such as "300ms", "-1.5h" or "2h45m". | |||
Valid time units are "ns", "us" (or "µs"), "ms", "s", "m", "h".`, | |||
}, | |||
cli.BoolFlag{ | |||
Name: "verbose, v", | |||
Usage: `Return "true" or "false" in the terminal.`, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ditto.
Fixes #870