mkcert icon indicating copy to clipboard operation
mkcert copied to clipboard

Added an expiry date flag (-expires) allowing to set an expiry date to the generated certificate

Open ccaffy opened this issue 3 years ago • 8 comments

Hi Filippo,

I had to test that a "homemade" HTTP server automatically reloads the server certificate without the need to restart it. In order to do that, I used your very nice tool to generate a certificate. As I wanted to test the certificate renewal, I needed to first generate a certificate that is expired, start my HTTP server, try a transfer, see it failing (curl: (60) Peer's Certificate has expired.), then re-generate a new certificate that will expire later, re-issue the transfer and see it succeeding.

I therefore forked your project and modified to allow me to set a specific expiry date for the certificate to generate. I propose that pull request as a contribution if you believe this is a nice functionality you would like to port in the official version of your tool.

I never programmed in Go before, so please forgive me if you spot ugly things :D

Cheers, Cedric

ccaffy avatar Sep 01 '22 12:09 ccaffy

+1 for this @FiloSottile (and thanks @ccaffy) - I started using mkcert today and this is the first feature I came looking for. I'd like to set the expiry +10 years in the future so us lazy devs never have to regenerate for localhost development

henricook avatar Sep 21 '22 11:09 henricook

Can I set a 100-year expiry time?

lhuanyun avatar Nov 22 '22 16:11 lhuanyun

@lhuanyun the code in this MR let's you set any date you want, so yes

henricook avatar Nov 22 '22 18:11 henricook

the code in this MR let's you set any date you want, so yes

This is good news,thx

lhuanyun avatar Nov 23 '22 07:11 lhuanyun

in

How do I write an expiration time? Can you give me an example?

lhuanyun avatar Nov 23 '22 08:11 lhuanyun

@lhuanyun This pull request isn't merged yet, so isn't yet part of mkcert. We're hoping @FiloSottile will have time to take a look soon.

When it's merged, and a new release of mkcert is created, you'll be able to specify an expiration time with a command line flag like -expires Mon Jan 2 15:04:05 2006

henricook avatar Nov 23 '22 08:11 henricook

@lhuanyun This pull request isn't merged yet, so isn't yet part of mkcert. We're hoping @FiloSottile will have time to take a look soon.

When it's merged, and a new release of mkcert is created, you'll be able to specify an expiration time with a command line flag like -expires Mon Jan 2 15:04:05 2006

thx for you help 。 goodman

lhuanyun avatar Nov 23 '22 17:11 lhuanyun

Could this finally be merged? One year of maturing should be, hopefully, enough.

technodrome avatar Sep 14 '23 13:09 technodrome