Skip to content

Latest commit

 

History

History
62 lines (48 loc) · 1.09 KB

README.md

File metadata and controls

62 lines (48 loc) · 1.09 KB

SSL/TLS certificate validator

Use binary

go install github.com/ochko/go-tls-check/cmd/tls-check

tls-check example.com
tls-check -w 24h -t 5s example.com

Exit code is 0 when validation was successful, 1 if there is any issue. It also prints some information in json format, so that you can collect expiration days of your deployed certificates:

{
  "status": "ok",
  "host": "example.com",
  "expiration": "32h1m52s",
}

When there is an issue:

{
  "status": "ng",
  "host":"unknown.com",
  "expiration":"0s",
  "msg":"dial tcp 23.253.58.227:443: i/o timeout"
}

Options

tls-cert-check [options] hostname1 hostname2 ...
  options:
  -t string
    	Connection timeout. (default "10s")
  -w string
    	Allowd time before certificate expiration. (default "72h")

Importing the package

import "github.com/ochko/go-tls-check/validator"

...

expiration, err := validator.Check("example.com", time.Hour*24, time.Second*3)

...

Using the docker image

docker build . -t tls-check
docker run tls-check example.com

License

MIT