https://github.com/smallstep/certificates

Mariano Cano 349bca06bb Fix line error due to deprecated DialTLS. 6 лет назад
.github 00b412a45a remove autocert bug + enhancement issue templates 7 лет назад
acme cb46a8b741 Small test fixes. 6 лет назад
api 1cb8bb3ae1 Simplify statuscoder error generators. 6 лет назад
authority f868e07a76 Allow to use custom principals on cloud provisioners. 6 лет назад
autocert 8fafd987ca Use REAMDE.md suggested in code review. 7 лет назад
ca 349bca06bb Fix line error due to deprecated DialTLS. 6 лет назад
cmd 6b01128bcc Reference root.Subject instead of hardcoding it. 6 лет назад
commands 8f17a46be0 Fix formatting. 6 лет назад
db dccbdf3a90 Introduce generalized statusCoder errors and loads of ssh unit tests. 6 лет назад
debian c23eb88a4f Added version operability for `git archive` tarball (non git repo) 7 лет назад
docker 2871d0b68b bump Docker to latest tag 7 лет назад
docs be4b853d3a Typo fix 6 лет назад
errs 1cb8bb3ae1 Simplify statuscoder error generators. 6 лет назад
examples 7b1f4a43cf Added example for custom claims (#39) 7 лет назад
kms 1138cc4207 Retry CloudKMS GetPublicKey. 6 лет назад
logging d368791606 Add x5c provisioner capabilities 7 лет назад
monitoring c74fcd57a7 ca-component -> certificates 8 лет назад
pki 05cda81215 Add quotes in configuration paths. 6 лет назад
server d0c7ccd0db ServetTLS => ServeTLS in function docs 8 лет назад
sshutil 656f35e522 Use an actual Hosts type when returning ssh hosts 6 лет назад
templates 914636668a Add support for loading templates without using files. 6 лет назад
.VERSION c23eb88a4f Added version operability for `git archive` tarball (non git repo) 7 лет назад
.gitattributes c23eb88a4f Added version operability for `git archive` tarball (non git repo) 7 лет назад
.gitignore 4b473732d9 Add support for TLS-ALPN-01 challenge. 6 лет назад
.golangci.yml 1cb8bb3ae1 Simplify statuscoder error generators. 6 лет назад
.travis.yml f37554fddb Use go 1.14 6 лет назад
.version.sh c23eb88a4f Added version operability for `git archive` tarball (non git repo) 7 лет назад
CHANGELOG.md e8baba3e30 first pass at README 8 лет назад
LICENSE bb30372d43 Its 2020! 6 лет назад
Makefile 1535e95d89 Add tool to initialize pki in cloud kms. 6 лет назад
README.md 2c747fc11f Merge pull request #180 from ibrt/master 6 лет назад
distribution.md 6c3e5278e2 Update steps for go mod in distribution.md 7 лет назад
go.mod 21bd339b86 Merge branch 'master' into kms 6 лет назад
go.sum f868e07a76 Allow to use custom principals on cloud provisioners. 6 лет назад
icon.png a064540681 Commit icons. 7 лет назад
icon.svg a064540681 Commit icons. 7 лет назад

README.md

Step Certificates

An online certificate authority and related tools for secure automated certificate management, so you can use TLS everywhere.

This repository is for step-ca, a certificate authority that exposes an API for automated certificate management. It also contains a golang SDK for interacting with step-ca programatically. However, you'll probably want to use the step command-line tool to operate step-ca and get certificates, instead of using this low-level SDK directly.

Questions? Find us on gitter.

Website | Documentation | Installation Guide | Getting Started | Contribution Guide

GitHub release CA Image Go Report Card Build Status License CLA assistant

GitHub stars Twitter followers

Animated terminal showing step certificates in practice

Features

It's super easy to get started and to operate step-ca thanks to streamlined initialization and safe, sane defaults. Get started in 15 minutes.

A private certificate authority you run yourself

Lots of (automatable) ways to get certificates

Your own private ACME Server

SSH Certificates

  • Use certificate authentication for SSH: connect SSH to SSO, improve security, and eliminate warnings & errors
  • Issue SSH user certificates using OAuth OIDC
  • Issue SSH host certificates to cloud VMs using instance identity documents

Easy certificate management and automation via step CLI integration

Motivation

Managing your own public key infrastructure (PKI) can be tedious and error prone. Good security hygiene is hard. Setting up simple PKI is out of reach for many small teams, and following best practices like proper certificate revocation and rolling is challenging even for experts.

Amongst numerous use cases, proper PKI makes it easy to use mTLS (mutual TLS) to improve security and to make it possible to connect services across the public internet. Unlike VPNs & SDNs, deploying and scaling mTLS is pretty easy. You're (hopefully) already using TLS, and your existing tools and standard libraries will provide most of what you need. If you know how to operate DNS and reverse proxies, you know how to operate mTLS infrastructure.

Connect it all with
mTLS

There's just one problem: you need certificates issued by your own certificate authority (CA). Building and operating a CA, issuing certificates, and making sure they're renewed before they expire is tricky. This project provides the infrastructure, automations, and workflows you'll need.

step certificates is part of smallstep's broader security architecture, which makes it much easier to implement good security practices early, and incrementally improve them as your system matures.

For more information and docs see the smallstep website and the blog post announcing this project.

Installation Guide

These instructions will install an OS specific version of the step-ca binary on your local machine.

While step is not required to run step-ca, it will make your life easier so you'll probably want to install it too.

Mac OS

Install step and step-ca together via Homebrew:

$ brew install step

# Test installation ...
$ step certificate inspect https://smallstep.com
Certificate:
    Data:
        Version: 3 (0x2)
        Serial Number: 326381749415081530968054238478851085504954 (0x3bf265673332db2d0c70e48a163fb7d11ba)
    Signature Algorithm: SHA256-RSA
        Issuer: C=US,O=Let's Encrypt,CN=Let's Encrypt Authority X3
...

Note: If you have installed step previously through the smallstep/smallstep tap you will need to run the following commands before installing:

> $ brew untap smallstep/smallstep
> $ brew uninstall step
> ```

### Linux

#### Debian

1. [Optional] Install `step`.

    Download the latest Debian package from
    [`step` releases](https://github.com/smallstep/cli/releases):

    ```
    $ wget https://github.com/smallstep/cli/releases/download/vX.Y.Z/step-cli_X.Y.Z_amd64.deb
    ```

    Install the Debian package:

    ```
    $ sudo dpkg -i step-cli_X.Y.Z_amd64.deb
    ```

2. Install `step-ca`.

    Download the latest Debian package from [releases](https://github.com/smallstep/certificates/releases):

    ```
    $ wget https://github.com/smallstep/certificates/releases/download/vX.Y.Z/step-certificates_X.Y.Z_amd64.deb
    ```

    Install the Debian package:

    ```
    $ sudo dpkg -i step-certificates_X.Y.Z_amd64.deb
    ```

#### Arch Linux

We are using the [Arch User Repository](https://aur.archlinux.org) to distribute
`step` binaries for Arch Linux.

* [Optional] The `step` binary tarball can be found [here](https://aur.archlinux.org/packages/step-cli-bin/).
* The `step-ca` binary tarball can be found [here](https://aur.archlinux.org/packages/step-ca-bin/).

You can use [pacman](https://www.archlinux.org/pacman/) to install the packages.

### Kubernetes

We publish [helm charts](https://hub.helm.sh/charts/smallstep/step-certificates) for easy installation on kubernetes:

helm install step-certificates


> <a href="https://github.com/smallstep/autocert"><img width="25%" src="https://raw.githubusercontent.com/smallstep/autocert/master/autocert-logo.png"></a>
>
> If you're using Kubernetes, make sure you [check out
> autocert](https://github.com/smallstep/autocert): a kubernetes add-on that builds on `step
> certificates` to automatically inject TLS/HTTPS certificates into your containers.

### Test

<pre><code><b>$ step version</b>
Smallstep CLI/0.10.0 (darwin/amd64)
Release Date: 2019-04-30 19:01 UTC

<b>$ step-ca version</b>
Smallstep CA/0.10.0 (darwin/amd64)
Release Date: 2019-04-30 19:02 UTC</code></pre>

## Quickstart

In the following guide we'll run a simple `hello` server that requires clients
to connect over an authorized and encrypted channel using HTTPS. `step-ca`
will issue certificates to our server, allowing it to authenticate and encrypt
communication. Let's get started!

### Prerequisites

* [`step`](#installation-guide)
* [golang](https://golang.org/doc/install)

### Let's get started!

#### 1. Run `step ca init` to create your CA's keys & certificates and configure `step-ca`:

<pre><code><b>$ step ca init</b>
✔ What would you like to name your new PKI? (e.g. Smallstep): <b>Example Inc.</b>
✔ What DNS names or IP addresses would you like to add to your new CA? (e.g. ca.smallstep.com[,1.1.1.1,etc.]): <b>localhost</b>
✔ What address will your new CA listen at? (e.g. :443): <b>127.0.0.1:8080</b>
✔ What would you like to name the first provisioner for your new CA? (e.g. you@smallstep.com): <b>bob@example.com</b>
✔ What do you want your password to be? [leave empty and we'll generate one]: <b>abc123</b>

Generating root certificate...
all done!

Generating intermediate certificate...
all done!

✔ Root certificate: /Users/bob/src/github.com/smallstep/step/.step/certs/root_ca.crt
✔ Root private key: /Users/bob/src/github.com/smallstep/step/.step/secrets/root_ca_key
✔ Root fingerprint: 702a094e239c9eec6f0dcd0a5f65e595bf7ed6614012825c5fe3d1ae1b2fd6ee
✔ Intermediate certificate: /Users/bob/src/github.com/smallstep/step/.step/certs/intermediate_ca.crt
✔ Intermediate private key: /Users/bob/src/github.com/smallstep/step/.step/secrets/intermediate_ca_key
✔ Default configuration: /Users/bob/src/github.com/smallstep/step/.step/config/defaults.json
✔ Certificate Authority configuration: /Users/bob/src/github.com/smallstep/step/.step/config/ca.json

Your PKI is ready to go. To generate certificates for individual services see 'step help ca'.</code></pre>

This command will:

- Generate [password protected](https://github.com/smallstep/certificates/blob/master/docs/GETTING_STARTED.md#passwords)  private keys for your CA to sign certificates
- Generate a root and [intermediate signing certificate](https://security.stackexchange.com/questions/128779/why-is-it-more-secure-to-use-intermediate-ca-certificates) for your CA
- Create a JSON configuration file for `step-ca` (see [getting started](./docs/GETTING_STARTED.md) for details)

You can find these artifacts in `$STEPPATH` (or `~/.step` by default).

#### 2. Start `step-ca`:

You'll be prompted for your password from the previous step, to decrypt the CA's private signing key:

<pre><code><b>$ step-ca $(step path)/config/ca.json</b>
Please enter the password to decrypt /Users/bob/src/github.com/smallstep/step/.step/secrets/intermediate_ca_key: <b>abc123</b>
2019/02/18 13:28:58 Serving HTTPS on 127.0.0.1:8080 ...</code></pre>

#### 3. Copy our `hello world` golang server.

$ cat > srv.go <<EOF package main

import (

"net/http"
"log"

)

func HiHandler(w http.ResponseWriter, req *http.Request) {

w.Header().Set("Content-Type", "text/plain")
w.Write([]byte("Hello, world!\n"))

}

func main() {

http.HandleFunc("/hi", HiHandler)
err := http.ListenAndServeTLS(":8443", "srv.crt", "srv.key", nil)
if err != nil {
    log.Fatal(err)
}

} EOF ```

4. Get an identity for your server from the Step CA.

$ step ca certificate localhost srv.crt srv.key
✔ Key ID: rQxROEr7Kx9TNjSQBTETtsu3GKmuW9zm02dMXZ8GUEk (bob@example.com)
✔ Please enter the password to decrypt the provisioner key: abc123
✔ CA: https://localhost:8080/1.0/sign
✔ Certificate: srv.crt
✔ Private Key: srv.key

$ step certificate inspect --bundle srv.crt
Certificate:
    Data:
        Version: 3 (0x2)
        Serial Number: 140439335711218707689123407681832384336 (0x69a7a1d7f6f22f68059d2d9088307750)
    Signature Algorithm: ECDSA-SHA256
        Issuer: CN=Example Inc. Intermediate CA
        Validity
            Not Before: Feb 18 21:32:35 2019 UTC
            Not After : Feb 19 21:32:35 2019 UTC
        Subject: CN=localhost
...
Certificate:
    Data:
        Version: 3 (0x2)
        Serial Number: 207035091234452090159026162349261226844 (0x9bc18217bd560cf07db23178ed90835c)
    Signature Algorithm: ECDSA-SHA256
        Issuer: CN=Example Inc. Root CA
        Validity
            Not Before: Feb 18 21:27:21 2019 UTC
            Not After : Feb 15 21:27:21 2029 UTC
        Subject: CN=Example Inc. Intermediate CA
...

Note that step and step-ca handle details like certificate bundling for you.

5. Run the simple server.

$ go run srv.go &

6. Get the root certificate from the Step CA.

In a new Terminal window:

$ step ca root root.crt
The root certificate has been saved in root.crt.

7. Make an authenticated, encrypted curl request to your server using HTTP over TLS.

$ curl --cacert root.crt https://localhost:8443/hi
Hello, world!

All Done!

Check out the Getting Started guide for more examples and best practices on running Step CA in production.

Documentation

Documentation can be found in a handful of different places:

  1. The docs sub-repo has an index of documentation and tutorials.

  2. On the command line with step help ca xxx where xxx is the subcommand you are interested in. Ex: step help ca provisioner list.

  3. On the web at https://smallstep.com/docs/certificates.

  4. On your browser by running step help --http=:8080 ca from the command line and visiting http://localhost:8080.

The Future

We plan to build more tools that facilitate the use and management of zero trust networks.

  • Tell us what you like and don't like about managing your PKI - we're eager to help solve problems in this space.
  • Tell us what features you'd like to see - open issues or hit us on Twitter.

Further Reading

Check out the Getting Started guide for more examples and best practices on running Step CA in production.