GithubHelp home page GithubHelp logo

trimstray / mkchain Goto Github PK

View Code? Open in Web Editor NEW
356.0 14.0 54.0 976 KB

Open source tool to help you build a valid SSL certificate chain.

License: GNU General Public License v3.0

Shell 98.36% Roff 1.64%
openssl ssl-certificates certificates trust-chain ssl-certificate-chain chain openssl-certs ssl-cert

mkchain's Introduction

mkchain's People

Contributors

trimstray avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

mkchain's Issues

Improvement output when CN is missing.

Next Release: testing
Status: In Progress

The problem is the lack of the CN field for the last certificate in the chain.

How can reproduce the problem?

Properly chain for google.com is:

Certificate chain
 0 s:/C=US/ST=California/L=Mountain View/O=Google Inc/CN=*.google.com
   i:/C=US/O=Google Inc/CN=Google Internet Authority G2
 1 s:/C=US/O=Google Inc/CN=Google Internet Authority G2
   i:/C=US/O=GeoTrust Inc./CN=GeoTrust Global CA
 2 s:/C=US/O=GeoTrust Inc./CN=GeoTrust Global CA
   i:/C=US/O=Equifax/OU=Equifax Secure Certificate Authority
  1. Show certificate chain for google.com:
echo | openssl s_client -connect google.com:443 -servername google.com -showcerts
  1. Download all certificates (manually)

  2. Run sslmerge:

sslmerge -i /tmp/example/ -o /tmp/output.crt                

  	           (ServerCertificate.crt)
  	           (Identity Certificate)
  S:(a18bd28a):(*.google.com)
  I:(c4c7a654):(GoogleInternetAuthorityG2)
  	           (Intermediate1.crt)
  	           (Intermediate Certificate)
  S:(c4c7a654):(GoogleInternetAuthorityG2)
  I:(2c543cd1):(GeoTrustGlobalCA)
  	           (Intermediate2.crt)
  	           (Intermediate Certificate)
  S:(2c543cd1):(GeoTrustGlobalCA)
  I:(578d5c04):()
  	           (RootCertificate.crt)
  	           (Root Certificate)
  S:(578d5c04):()
  I:(578d5c04):()

  Result: chain generated correctly

You will see empty fields for the certificate marked with an identifier 578d5c04.

Add option to generate OCSP cert chain

Creating correct certificate chains for OCSP is quite confusing - it would be very useful if sslmerge could generate them. As far as I can see it should include the intermediate and root certs, but not the leaf cert, so if a normal chain cert is leaf -> intermediate, the matching OCSP chain should be intermediate -> root.

Since we already have --with-root, this could perhaps be combined with a new --without-leaf option to achieve this.

default _system_ca_path won't work on FreeBSD and change not taken into account

The default value for _system_ca_path set in src/init is not right for FreeBSD. Changing this value with another path is not taken into account because code has hard-coded values:

$ sslmerge -i foobar.crt -o foobar-full.crt find: /etc/ssl/certs/: No such file or directory sed: 1: "$a-----END CERTIFICATE- ...": command a expects \ followed by text [!] bad certificate (maybe broken): foobar.crt

More importantly, upon error, the certificate file used as input is cleared (content erased).

Readlink usage not compatible with macOS

Current use of command readlink in shell script code is not compatible with macOS:

  • install fails
  • execution fails

sample error upon execution:
readlink: illegal option -- f usage: readlink [-n] [file ...] /usr/local/bin/sslmerge: line 57: ./../src/settings: No such file or directory /usr/local/bin/sslmerge: line 59: ./../src/helpers: No such file or directory /usr/local/bin/sslmerge: line 61: ./../src/__init__: No such file or directory /usr/local/bin/sslmerge: line 66: __main__: command not found /usr/local/bin/sslmerge: line 68: _exit_: command not found

Create dual-stack OCSP chains

Further to #8, I'm very confused as to how to create valid OCSP certificate chains for dual stack (ECC + RSA) certificates. This comes up in things like nginx, where we can say:

ssl_certificate /etc/ssl/example.com.combined.crt;
ssl_certificate_key /etc/ssl/example.com.key;
ssl_certificate /etc/ssl/example.com-ecc.combined.crt;
ssl_certificate_key /etc/ssl/example.com-ecc.key;
ssl_trusted_certificate /etc/ssl/cert-bundle-rsa-ecc.crt;

so we have multiple certificates, but only a single opportunity to specify a trusted cert chain to use for OCSP. I don't know exactly how this should be formatted since it needs to contain 2 or more intermediate -> root chains, i.e. I don't know whether it should contain:

  • intermediate1
  • root1
  • intermediate2
  • root2

or

  • intermediate1
  • intermediate2
  • root1
  • root2

or, if they need to share a root (some ECC certs are signed using an RSA root):

  • intermediate1
  • intermediate2
  • root

So it would be very useful if sslmerge could help get this right.

(and yes, it is dumb that openssl can't figure out the cert order itself by matching IDs)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.