News for hackers. Stuff that matters.
Re:Githubassets.com Cert Has Expired by mg on Monday November 02, 2020 @07:21AM (#24967320)
This is a script I call "certdays.sh" which you can call from your regular tests like this:

certdays.sh somedomain.com 14

If the certificate for somedomain.com is valid less then 14 days, it will fail:

https://github.com/no-gravity/certdays

Re:Githubassets.com Cert Has Expired by unilynx on Monday November 02, 2020 @07:31AM (#24967411)
Is the '25' in 606025 intentional to give a bit more margin or should it just have been 24?
Re:Githubassets.com Cert Has Expired by mg on Monday November 02, 2020 @07:36AM (#24967454)
Ha, I guess I made a typo when I wrote the script 6 months ago. At least I cannot remember that I had some clever idea back then, why a day should have 25 hours.

Fixed now. Thanks.

Re:Githubassets.com Cert Has Expired by WrtCdEvrydy on Monday November 02, 2020 @08:00AM (#24967669)
Always have days having 25 hours... for DST.
Re:Githubassets.com Cert Has Expired by gregoriol on Monday November 02, 2020 @07:30AM (#24967408)
Don't call it from tests though, call it from a monitoring system!
Re:Githubassets.com Cert Has Expired by contravariant on Monday November 02, 2020 @07:41AM (#24967498)
In case anyone is looking for a good option, I've had great success with InfluxDB's telegraph utility which automatically checks both uptime and certificates for HTTPS endpoints, combined with a grafana dashboard that sends alerts when the deadline approaches.
Re:Githubassets.com Cert Has Expired by brianhicks on Monday November 02, 2020 @08:01AM (#24967679)
What shell are you running this under? Unquoted exclamation marks will do things that may be outside your intent for this script. It’ll still fail, just perhaps not in the way you expect.
Re:Githubassets.com Cert Has Expired by mg on Monday November 02, 2020 @09:06AM (#24968221)
You mean due to history substitution? If so: I have never seen that kick in in a script. Only in interactive shells.
Re:Githubassets.com Cert Has Expired by kingsloi on Monday November 02, 2020 @09:07AM (#24968230)
Hmm, if I copy/paste this, I get a different output:

    ~  ~/certdays.sh google.com 14
    date: illegal time format
    usage: date [-jnRu] [-d dst] [-r seconds] [-t west] [- 
    v[+|-]val[ymwdHMS]] ...
            [-f fmt date | [[[mm]dd]HH]MM[[cc]yy][.ss]] 
    [+format]
    google.com: -18568
    -n Lasts longer then 14 days?
    NO!!!!!!!!!!!!!!
Re:Githubassets.com Cert Has Expired by floatingatoll on Monday November 02, 2020 @10:40AM (#24969265)
You can brew install coreutils and edit it to use gdate instead of date.
Re:Githubassets.com Cert Has Expired by stereo on Monday November 02, 2020 @09:18AM (#24968314)
Are you running it on macOS or something non-Linux?
Re:Githubassets.com Cert Has Expired by kingsloi on Monday November 02, 2020 @12:17PM (#24970495)
Ah, yes I am running it on macOS Mojave
Re:Githubassets.com Cert Has Expired by mg on Monday November 02, 2020 @09:14AM (#24968283)
Works for me. In Bash? Maybe copy/paste gone wrong?

I have put it into a Github repo now and put the link into the post. Does that work for you?

Re:Githubassets.com Cert Has Expired by chillaranand on Monday November 02, 2020 @08:35AM (#24967958)
We can also use ssl-cert-check cli tool. `ssl-cert-check -s avilpage.com -p 443 -x 30` will return if the certificate will expire in 30 days.

We can use this command in CI pipeline or setup a cron job to monitor it.

Re:Githubassets.com Cert Has Expired by brian_herman on Monday November 02, 2020 @08:07AM (#24967738)
Thanks awesome script!