tlstools

1.4.0 • Public • Published

TLStools

Command line tool to analyze, troubleshoot or inspect TLS certificates, requests or keys. Written in NodeJS.

  • tls chain - Attempt to fix an incomplete certificate chain
  • tls check - Check completeness of remote certificate chain
  • tls crt - get renewal informations and the CRT (certificate) itself based on a host
  • tls csr - simple decypher and parse informations out a CSR (Certificate Sign Request)

Requirements

  • NodeJS

Installation

npm install -g tlstools

Usage

$ tls
Usage: tls [options] [command]
 
Options:
  -V, --version   output the version number
  -h, --help      display help for command
 
Commands:
  chain           attempt to fix incomplete certificate chain
  check           check remote certificate chain
  crt             display TLS information for given hostname
  csr             decode certificate request information
  help [command]  display help for command

Sub commands

tls chain

Attempt to fix an incomplete certificate chain based on an passed certficate.

$ tls chain -h
Usage: tls chain [options]
 
Options:
 
  -h, --help                    output usage information
  -f, --filename <file>         search certificate in file
  -H, --hostname <host[:port]>  use certificate from remote hostname
  -c, --clipboard               search certificate in clipboard

Assuming you have copied the certificate to check into your system clipboard:

$ tls chain -c
-----BEGIN CERTIFICATE-----
MIIDnzCCAyWgAwIBAgIQWyXOaQfEJlVm0zkMmalUrTAKBggqhkjOPQQDAzCBhTEL
MAkGA1UEBhMCR0IxGzAZBgNVBAgTEkdyZWF0ZXIgTWFuY2hlc3RlcjEQMA4GA1UE
BxMHU2FsZm9yZDEaMBgGA1UEChMRQ09NT0RPIENBIExpbWl0ZWQxKzApBgNVBAMT
IkNPTU9ETyBFQ0MgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkwHhcNMTQwOTI1MDAw
MDAwWhcNMjkwOTI0MjM1OTU5WjCBkjELMAkGA1UEBhMCR0IxGzAZBgNVBAgTEkdy
ZWF0ZXIgTWFuY2hlc3RlcjEQMA4GA1UEBxMHU2FsZm9yZDEaMBgGA1UEChMRQ09N
T0RPIENBIExpbWl0ZWQxODA2BgNVBAMTL0NPTU9ETyBFQ0MgRG9tYWluIFZhbGlk
YXRpb24gU2VjdXJlIFNlcnZlciBDQSAyMFkwEwYHKoZIzj0CAQY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 
 ✔ Successfully fixed intermediate chain from clipboard

tls crt

Decode certificate informations.

$ tls crt -h
Usage: tls crt [options]
 
Options:
 
  -h, --help                    output usage information
  -f, --filename <file>         search certificate in file
  -H, --hostname <host[:port]>  use certificate from remote hostname
  -c, --clipboard               search certificate in clipboard

Show certificate informations from remote host "frd.mn":

$ tls crt frd.mn
-----BEGIN CERTIFICATE-----
MIIGLzCCBdagAwIBAgIQH3be7EHzH3zHdBvhyXC4wDAKBggqhkjOPQQDAjCBkjEL
MAkGA1UEBhMCR0IxGzAZBgNVBAgTEkdyZWF0ZXIgTWFuY2hlc3RlcjEQMA4GA1UE
BxMHU2FsZm9yZDEaMBgGA1UEChMRQ09NT0RPIENBIExpbWl0ZWQxODA2BgNVBAMT
L0NPTU9ETyBFQ0MgRG9tYWluIFZhbGlkYXRpb24gU2VjdXJlIFNlcnZlciBDQSAy
MB4XDTE1MDkyNjAwMDAwMFoXDTE1MTIzMDIzNTk1OVowazEhMB8GA1UECxMYRG9t
YWluIENvbnRyb2wgVmFsaWRhdGVkMSEwHwYDVQQLExhQb3NpdGl2ZVNTTCBNdWx0
aS1Eb21haW4xIzAhBgNVBAMTGnNuaTMzMjgwLmNsb3VkZmxhcmVzc2wuY29tMFkw
EwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAE/VVyjyzoogarRb9sqmpqwwAf+Kh69I9E
5NeT/1s9nVjvEzYTnrEN3xqNrzbA/y61AbJ6Yy714OCq1ViAmBuCPaOCBDIwggQu
MB8GA1UdIwQYMBaAFEAJYWfwvINxT94SCCxv1NQrdj2WMB0GA1UdDgQWBBT1uV7H
fwV8Ca9MxjAiSHOEyE9EVDAOBgNVHQ8BAf8EBAMCB4AwDAYDVR0TAQH/BAIwADAd
BgNVHSUEFjAUBggrBgEFBQcDAQYIKwYBBQUHAwIwTwYDVR0gBEgwRjA6BgsrBgEE
AbIxAQICBzArMCkGCCsGAQUFBwIBFh1odHRwczovL3NlY3VyZS5jb21vZG8uY29t
L0NQUzAIB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Xdlci5jY4IUcGVy
c29uYWxpemFyYmxvZy5jb22CEnN3YWdkb2d3YWxraW5nLmNvbYIXdGhlZ29sZGVu
YW5kY29tcGFueS5jb20wCgYIKoZIzj0EAwIDRwAwRAIgZzfbzLiht8LIcEwvCKIj
xRC5hF3mcVUzAYMTsAp+PWoCIBCaOZvgDR0t7tCijM6o5N3vNHDs0vQbtQkEaQSx
/j9A
-----END CERTIFICATE-----
 
Host/port: frd.mn:443
Start date: Sat Sep 26 2015 02:00:00 GMT+0200 (CEST)
End date: Thu Dec 31 2015 00:59:59 GMT+0100 (CET)
Remaining days: 96
✔ Successfully parsed information

tls csr

Decode and display information from certificate sign requests.

$ tls csr -h
Usage: tls csr [options]
 
Options:
 
  -h, --help             output usage information
  -f, --filename <file>  search CRT or CSR in file
  -c, --clipboard        search CSR in clipboard

In the example below, I copied the CSR into my clipboard and executed the following command:

$ tls csr -c
Certificate Request:
-----BEGIN CERTIFICATE REQUEST-----
MIIC+jCCAeICAQAwgbQxCzAJBgNVBAYTAkRFMRAwDgYDVQQIDAdCYXZhcmlhMRMw
EQYDVQQHDApFaWJlbHN0YWR0MSUwIwYDVQQKDBxZRUFIV0hBVD8hIE1pbmVjcmFm
dCBzZXJ2ZXJzMRQwEgYDVQQLDAtNYWlsIHN5c3RlbTEcMBoGA1UEAwwTY2hld2Jh
Y2NhLnllYWh3aC5hdDEjMCEGCSqGSIb3DQEJARYUcG9zdG1hc3RlckB5ZWFod2gu
YXQwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDAi9mSsi01EDc3QMCL
lreBVzDSsICIc8w4mttgSg+cW/Hl98iDZ/awyv0hEeXLg/rybR42LHCRXyJbiuV8
edOGbYN5ODD3di5tOmzjgJm34gmSxuzzZSe6431C9nR0BJaPwGbBoFqBO5MiWD1i
Z7Cv3a+xJQO0gN+3PIgSMOGAD608bqJN58ewtqqYY0xM3vQCEcf40TJJc8fv1+a5
1BM07s26L0Az5xZeIcWOqBgvBQhY0dI3QEKW5BbQDVA/OFilpbJFqCseosjz0/YG
tS46CHGjNuViAcxeJ/IWKRWB3TCd2KhIqaEZLCVTWPqCaQ7CioITgrQW+c/qVCfv
to6xAgMBAAGgADANBgkqhkiG9w0BAQsFAAOCAQEAu8gxx8RrQPeWvKJiY3fmTNHg
lEDQU2vTPU+56UZEuCVztj1LdmjzFpH6biFa+C2XxkTxfeXc9OakklWlIgfP7b2Y
RTObWPcpyDSE+yB79Lhybb4Wr3vASJJWSgwqymp5BjEj0iHeVFzvippvvyPieafr
a31cPiG5UbOWOXpeZ73K1qBqmpRglzYouqWPA0D9e9wks71INhPL8wODRha2RZ9M
voaVZHsm6NB+WAZzK+wznc1wLs/mVigqfjakU//VXi8opb7hTkH1/8h8Pn5uCFM7
3UcTESfcIv3XuKeLXKQEJZtR3PQlWDb+pI7x1iUm7k0Q1KXsYysdUzq/fGTSdw==
-----END CERTIFICATE REQUEST-----
Key size: 2048 bit
Subject:
 - C: DE
 - ST: Bavaria
 - L: Eibelstadt
 - O: YEAHWHAT?! Minecraft servers
 - OU: Mail system
 - CN: chewbacca.yeahwh.at
 - emailAddress: postmaster@yeahwh.at
 ✔ Successfully decoded information from clipboard

tls check

This command lets you know if the intermediate certificate chain of a certain remote hostname is correct/complete.

$ tls check -h
Usage: tls check [options]
 
Options:
  -H, --hostname <host[:port]>  use certificate from remote hostname
  -h, --help                    display help for command

Show chain status from remote host "frd.mn":

$ tls check -H frd.mn
 ✔ Intermediate chain "frd.mn:443" seems to be complete/correct

Credits

Readme

Keywords

Package Sidebar

Install

npm i tlstools

Weekly Downloads

8

Version

1.4.0

License

MIT

Unpacked Size

37.5 kB

Total Files

14

Last publish

Collaborators

  • frdmn