certstrap is a free, open source data security & privacy project written in Go and released under Apache-2.0. It has 2,454 GitHub stars, 212 forks and 32 open issues, and was last pushed 8 months ago. On this registry it ranks #16 of 22 tracked projects in Data Security & Privacy, with 5 head-to-head comparisons available.

What is certstrap?

certstrap is a simple certificate manager written in Go that bootstraps a private certificate authority and public key infrastructure, aimed at operators and developers who need to issue TLS certificates without wrestling with openssl.

What it is

certstrap is a command-line certificate manager, adapted from etcd-ca, that lets a team build its own certificate system from scratch: initialize certificate authorities, create identities and certificate signing requests for hosts, and sign and generate certificates. It lives in the Go ecosystem and ships as a single compiled binary named certstrap. Output is written to a depot directory, out/ by default, and consists of .key, .crt, .csr, and .crl files.

The concrete problem it solves is the operational pain of openssl. certstrap is explicitly pitched as convenient for people who do not want to deal with openssl, its myriad of options, or its config files. Instead of assembling long openssl invocations by hand, a user runs three short commands to produce a working CA and a signed leaf certificate. certstrap replaces ad-hoc openssl scripting for the common case of standing up an internal CA and issuing host certificates.

Key capabilities

  • init creates a certificate authority and writes CertAuth.key, CertAuth.crt, and CertAuth.crl, using the required --common-name flag to name the output files.
  • request-cert generates an identity and keypair, producing a .key and a .csr, and requires either -common-name or -domain.
  • sign takes a CSR and a named CA and produces a signed certificate, for example ./certstrap sign Alice --CA CertAuth.
  • Multiple CAs can be initialized, and users can build arbitrarily long certificate chains by signing later requests with already-signed hosts.
  • Key algorithms include curves P-224, P-256, P-384, P-521, and Ed25519, selectable by name on init and request_cert.
  • Hosts with multiple addresses accept comma-separated lists, for example -ip $ip1,$ip2 -domain $domain1,$domain2 -uri $uri1,$uri2.
  • Pre-existing private PEM keys can be supplied with the -key flag instead of generating a new keypair.

Who uses it and how

  • Small teams standing up internal TLS for services, where a single init and a handful of sign calls replace hand-written openssl commands.
  • Operators issuing certificates for hosts with several IP addresses, domains, or URIs, using the comma-separated flag lists.
  • Environments that need certstrap inside a build pipeline, since it compiles to one binary and requires no runtime service.
  • Deployments with a layered trust model, using multiple CAs and arbitrarily long chains where signed hosts sign later requests.
  • Anyone needing a PKCS12 bundle, who runs the generated key and certificate through openssl pkcs12 -export.

Getting started

Build from source with Go 1.18 or higher by cloning https://github.com/square/certstrap, changing into the directory, and running go build, which produces a certstrap binary in the project root. Then run ./certstrap init --common-name "CertAuth" to create the first certificate authority.

How it compares

Among the tools named in the facts, certstrap sits alongside etcd-ca, the project it was adapted from, and takes the place of openssl for routine CA bootstrapping and certificate issuance. openssl remains necessary for adjacent tasks such as converting output to PKCS12 with openssl pkcs12 -export. It is the purpose-built wrapper; openssl is the general-purpose toolkit underneath.

When to use it — and when not to

certstrap is a good fit when the goal is a self-contained, scriptable CA workflow with no service to run and no external dependencies beyond Go at build time. A self-hoster still manages the generated key material, the out/ depot directory, and any distribution of the CA certificate and CRL to relying parties. It is not the right choice for anyone wanting a hosted certificate service, an ACME client for public certificates, or a GUI; the README documents command-line usage only, and prospective users should confirm maintenance cadence and the Apache-2.0 terms against their own requirements before adopting it.

project readme (upstream, from github) — read inline

certstrap

godoc CI license

A simple certificate manager written in Go, to bootstrap your own certificate authority and public key infrastructure. Adapted from etcd-ca.

certstrap is a very convenient app if you don't feel like dealing with openssl, its myriad of options or config files.

Common Uses

certstrap allows you to build your own certificate system:

  1. Initialize certificate authorities
  2. Create identities and certificate signature requests for hosts
  3. Sign and generate certificates

Certificate architecture

certstrap can init multiple certificate authorities to sign certificates with. Users can make arbitrarily long certificate chains by using signed hosts to sign later certificate requests, as well.

Examples

Getting Started

Building

certstrap must be built with Go 1.18+. You can build certstrap from source:

$ git clone https://github.com/square/certstrap
$ cd certstrap
$ go build

This will generate a binary called certstrap under project root folder.

Initialize a new certificate authority:

$ ./certstrap init --common-name "CertAuth"
Created out/CertAuth.key
Created out/CertAuth.crt
Created out/CertAuth.crl

Note that the -common-name flag is required, and will be used to name output files.

Moreover, this will also generate a new keypair for the Certificate Authority, though you can use a pre-existing private PEM key with the -key flag.

If the CN contains spaces, certstrap will change them to underscores in the filename for easier use. The spaces will be preserved inside the fields of the generated files:

$ ./certstrap init --common-name "Cert Auth"
Created out/Cert_Auth.key
Created out/Cert_Auth.crt
Created out/Cert_Auth.crl

Request a certificate, including keypair:

$ ./certstrap request-cert --common-name Alice
Created out/Alice.key
Created out/Alice.csr

certstrap requires either -common-name or -domain flag to be set in order to generate a certificate signing request. The CN for the certificate will be found from these fields.

If your server has mutiple ip addresses or domains, use comma seperated ip/domain/uri list. eg: ./certstrap request-cert -ip $ip1,$ip2 -domain $domain1,$domain2 -uri $uri1,$uri2

If you do not wish to generate a new keypair, you can use a pre-existing private PEM key with the -key flag

Sign certificate request of host and generate the certificate:

$ ./certstrap sign Alice --CA CertAuth
Created out/Alice.crt from out/Alice.csr signed by out/CertAuth.key
PKCS Format:

If you'd like to convert your certificate and key to PKCS12 format, simply run:

$ openssl pkcs12 -export -out outputCert.p12 -inkey inputKey.key -in inputCert.crt -certfile CA.crt

inputKey.key and inputCert.crt make up the leaf private key and certificate pair of your choosing (generated by a sign command), with CA.crt being the certificate authority certificate that was used to sign it. The output PKCS12 file is outputCert.p12

Key Algorithms:

Certstrap supports curves P-224, P-256, P-384, P-521, and Ed25519. Curve names can be specified by name as part of the init and request_cert commands:

$ ./certstrap init --common-name CertAuth --curve P-256
Created out/CertAuth.key
Created out/CertAuth.crt
Created out/CertAuth.crl

$ ./certstrap request-cert --common-name Alice --curve P-256
Created out/Alice.key
Created out/Alice.csr

Retrieving Files

Outputted key, request, and certificate files can be found in the depot directory. By default, this is in out/

Project Details

Contributing

See CONTRIBUTING for details on submitting patches.

License

certstrap is under the Apache 2.0 license. See the LICENSE file for details.

Frequently asked questions

Is certstrap free to use?

certstrap is open source under the Apache-2.0 licence. There is no licence fee and no seat count — you can self-host it or, where the project offers one, pay a vendor for a managed version instead.

What does certstrap do?

Tools to bootstrap CAs, certificate requests, and signed certificates.

What is certstrap written in?

certstrap is primarily written in Go. Its source is publicly available at https://github.com/square/certstrap, and it has 2,454 GitHub stars.