Quickstart for Linux and MacOS X

Quickly get SPIRE up and running on Unix and Mac OS X


In this introduction to SPIRE you will learn how to:

  • Start the spire-server process
  • Attest a spire-agent to the server using a join token
  • Configure a registration entry for a workload
  • Fetch an x509-SVID over the WorkloadAPI
  • Learn where to find resources for more complex installations


  • A 64 bit Linux or macOS environment
  • The openssl command line tool
  • For macOS, Go 1.11 or higher must be installed to build SPIRE. See https://golang.org/dl/ or run brew install golang

The commands in this getting started guide can be run as a standard user or root.

Installing SPIRE

Downloading SPIRE for Linux

$ curl -s -N -L https://github.com/spiffe/spire/releases/download/0.9.0/spire-0.9.0-linux-x86_64-glibc.tar.gz | tar xz

This will create a spire-0.9.0 directory containing the binaries and example configuration files.

Building SPIRE on macOS/Darwin

To complete this step you will need Go 1.11 or higher (https://golang.org/dl/)

$ git clone --single-branch --branch v0.8 https://github.com/spiffe/spire.git
$ go build ./cmd/spire-server 
$ go build ./cmd/spire-agent

Starting the SPIRE Server

The SPIRE Server manages and issues identities. You can use the example configuration file provided to start the server, from within the directory created in the previous step:

$ bin/spire-server run -config conf/server/server.conf &
INFO[0000] Starting TCP server   address="" subsystem_name=endpoints
INFO[0000] Starting UDS server   address=/tmp/spire-registration.sock subsystem_name=endpoints

Check that the server is running:

$ bin/spire-server healthcheck
Server is healthy.

Creating a join token to attest the agent to the server

A join token is one of the many available agent attestor methods. It is a one-time-use, pre-shared key that attests (authenticates) the SPIRE agent to the SPIRE server. Other agent attestation methods include AWS/GCP instance identity tokens and X.509 certificates. To see a complete list of available attestors, click here.

Generate a one-time-use token to use to attest the agent:

$ bin/spire-server token generate -spiffeID spiffe://example.org/myagent
Token: <token_string>

Make a note of the token, you will need it in the next step to attest the agent on initial startup.

A Join Token is just one of the many available agent attestation methods. To see a complete list of available attestors, click here.

Starting the agent

SPIRE agents query the SPIRE server to attest (authenticate) nodes and workloads.

Use the token created in the previous step to start and attest the agent:

$ bin/spire-agent run -config conf/agent/agent.conf -joinToken <token_string> &
INFO[0000] Starting workload API   subsystem_name=endpoints

Check that the agent is running:

$ bin/spire-agent healthcheck
Agent is healthy.

Create a registration policy for your workload

In order for SPIRE to identify a workload, you must register the workload with the SPIRE Server, via registration entries. Workload registration tells SPIRE how to identify the workload and which SPIFFE ID to give it.

This command is creating a registration entry based on the current user’s UID ($(id -u)) - feel free to adjust this as necessary
$ bin/spire-server entry create -parentID spiffe://example.org/myagent \
    -spiffeID spiffe://example.org/myservice -selector unix:uid:$(id -u)
Entry ID      : ac5e2354-596a-4059-85f7-5b76e3bb53b3
SPIFFE ID     : spiffe://example.org/myservice
Parent ID     : spiffe://example.org/myagent
TTL           : 3600
Selector      : unix:uid:501
unix is just one of the available workload attestation methods. To see a complete list of available attestors, click here.

Retrieve and view a x509-SVID

This command replicates the process that a workload would take to get an x509-SVID from the agent. The x509-SVID could be used to authenticate the workload to another workload. To fetch and write an x509-SVID to /tmp/:

$ bin/spire-agent api fetch x509 -write /tmp/
Received 1 bundle after 254.780649ms
SPIFFE ID:		spiffe://example.org/myservice
SVID Valid After:	2019-10-25 19:07:49 +0000 UTC
SVID Valid Until:	2019-10-25 20:07:21 +0000 UTC
Intermediate #1 Valid After:	2019-10-25 19:07:11 +0000 UTC
Intermediate #1 Valid Until:	2019-10-25 20:07:21 +0000 UTC
CA #1 Valid After:	2018-05-13 19:33:47 +0000 UTC
CA #1 Valid Until:	2023-05-12 19:33:47 +0000 UTC
Writing SVID #0 to file /tmp/svid.0.pem.
Writing key #0 to file /tmp/svid.0.key.
Writing bundle #0 to file /tmp/bundle.0.pem.

You can use the openssl command to view the contents of the SVID:

$ openssl x509 -in /tmp/svid.0.pem -text -noout
        Version: 3 (0x2)
        Serial Number:
    Signature Algorithm: ecdsa-with-SHA384
        Issuer: C=US, O=SPIFFE
            Not Before: Oct 25 19:07:49 2019 GMT
            Not After : Oct 25 20:07:21 2019 GMT
        Subject: C=US, O=SPIRE
        Subject Public Key Info:
            Public Key Algorithm: id-ecPublicKey
                Public-Key: (256 bit)
                ASN1 OID: prime256v1
                NIST CURVE: P-256
        X509v3 extensions:
            X509v3 Key Usage: critical
                Digital Signature, Key Encipherment, Key Agreement
            X509v3 Extended Key Usage: 
                TLS Web Server Authentication, TLS Web Client Authentication
            X509v3 Basic Constraints: critical
            X509v3 Subject Key Identifier: 
            X509v3 Authority Key Identifier: 
            X509v3 Subject Alternative Name: 
    Signature Algorithm: ecdsa-with-SHA384

Next steps