smallstep / cli

🧰 A zero trust swiss army knife for working with X509, OAuth, JWT, OATH OTP, etc.
https://smallstep.com/cli
Apache License 2.0
3.57k stars 247 forks source link

Allow stdin input of cert for needs-renewal #1157

Closed redrac closed 2 months ago

redrac commented 2 months ago

Name of feature:

Allow stdin input of cert for needs-renewal

Pain or issue this feature alleviates:

This allows users who have ephemeral certs (certs only in agents) to use needs-renewal without writing the cert to disk. This functionality already exists for inspect; I merely ported it over.

redrac commented 2 months ago

Now requires: https://github.com/smallstep/crypto/pull/490 Related to: https://github.com/smallstep/cli/issues/116

edit: these were merged

dopey commented 2 months ago

Hey @redrac 👋. Thanks for submitting this PR, and apologies for the radio silence!

Overall, this looks good and useful. However, the exit codes that are being returned by this command are intentional and in some cases I think the proposed changes may result in an exit code that does not line up with the documentation. I will try to comment on those exact cases.

See the exit code documentation here - https://github.com/smallstep/cli/blob/master/command/ssh/needsRenewal.go#L39-L43.

redrac commented 2 months ago

Hey @redrac 👋. Thanks for submitting this PR, and apologies for the radio silence!

Overall, this looks good and useful. However, the exit codes that are being returned by this command are intentional and in some cases I think the proposed changes may result in an exit code that does not line up with the documentation. I will try to comment on those exact cases.

See the exit code documentation here - https://github.com/smallstep/cli/blob/master/command/ssh/needsRenewal.go#L39-L43.

Ah thanks! I will fix this this afternoon most likely

redrac commented 2 months ago

Okay fixed :)

$ ./step ssh needs-renewal
too many arguments: not enough positional arguments were provided in 'step ssh needs-renewal <crt-file>'
$ echo $?
255

$ ./step ssh needs-renewal zz zzz zz
too many arguments: too many positional arguments were provided in 'step ssh needs-renewal <crt-file>'
$ echo $?
255