trusty

module
v1.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 10, 2021 License: Apache-2.0

README

trusty

Build Coverage Status

Trusty is a Certification Authority.

Requirements

  1. GoLang 1.16+
  2. SoftHSM 2.6+
  3. protoc
	echo "curl -L https://github.com/google/protobuf/releases/download/v3.6.1/protoc-3.6.1-linux-x86_64.zip -o /tmp/protoc.zip"
	echo "unzip /tmp/protoc.zip -d /usr/local/protoc"
	echo "export PATH=$PATH:/usr/local/protoc/bin"

To run or test locally, you need GitHub OAuth secret and a random seed. Add this to your ~/.profile Note that these secrets can be random if you don't use a specific feature with GCP or Github.

export TRUSTY_GITHUB_CLIENT_SECRET=0d...a8
export TRUSTY_GITHUB_CLIENT_ID=09...71
export TRUSTY_GOOGLE_CLIENT_SECRET=01...b2
export TRUSTY_GOOGLE_CLIENT_ID=4a...89
export TRUSTY_JWT_SEED=g...A
export TRUSTY_MAILGUN_PRIVATE_KEY=c0..aa
export TRUSTY_STRIPE_API_KEY=12..av
export TRUSTY_STRIPE_WEBHOOK_SECRET=c1..aw
# export CR_PAT=ghp_M...v

Build

  • make all initializes all dependencies, builds and tests.
  • make proto generates gRPC protobuf.
  • make build build the executable
  • make gen_test_certs generate test certificates
  • make test run the tests
  • make testshort runs the tests skipping the end-to-end tests and the code coverage reporting
  • make covtest runs the tests with end-to-end and the code coverage reporting
  • make coverage view the code coverage results from the last make test run.
  • make generate runs go generate to update any code gen'd files (query_console.go in our case)
  • make fmt runs go fmt on the project.
  • make lint runs the go linter on the project.

run make all once, then run make build or make test as needed.

First run:

make all

Subsequent builds:

make build

Tests:

make test

Optionally run golang race detector with test targets by setting RACE flag:

make test RACE=true

Review coverage report:

make coverage

Generate protobuf

make proto

Local testing

When runnning unit tests, the Unix sockets are used. If the test fails, there can be localhost:{port} files left on the disk. To clean up use:

find -name "localhost:*" -delete

Integration test

make docker docker-citest

Debug

Add the launch configuration to .vscode/launch.json:

{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Server",
            "type": "go",
            "request": "launch",
            "mode": "debug",
            "remotePath": "",
            "port": 2345,
            "host": "127.0.0.1",
            "program": "${workspaceRoot}/cmd/trusty",
            "env": {},
            "args": [
                "--std",
                "--cfg",
                "${workspaceRoot}/etc/dev/trusty-config.yaml"
            ],
            "showLog": true
        }
    ]
}

Swagger

make start-swagger

Open http://localhost:8080

Before runing the above command, make sure trusty is running locally using bin/trusty command.

Directories

Path Synopsis
acmedb
Package acmedb provides storage functionality for ACME data model
Package acmedb provides storage functionality for ACME data model
model
Package model provides internal data model for ACME
Package model provides internal data model for ACME
api
v1
v1/pb/gw
Package pb is a reverse proxy.
Package pb is a reverse proxy.
v2acme
Package v2acme provides public API exposed to ACME clients
Package v2acme provides public API exposed to ACME clients
Package authority contains the Certification Authority.
Package authority contains the Certification Authority.
backend
cli
Package cli provides common code for building a command line control for the service
Package cli provides common code for building a command line control for the service
ca
cis
csr
hsm
Package client implements the official Go trusty client for v1.
Package client implements the official Go trusty client for v1.
embed/proxy
Package proxy provides gRPC proxy between client and server gRPC interfaces without needing to go through a gRPC connection.
Package proxy provides gRPC proxy between client and server gRPC interfaces without needing to go through a gRPC connection.
cmd
internal
db
kubeca
pkg
credentials
Package credentials implements gRPC credential interface with etcd specific logic.
Package credentials implements gRPC credential interface with etcd specific logic.
csr
fcc
jwt
poller
Package poller supports periodic polling to load a value.
Package poller supports periodic polling to load a value.
tlsutil
Package tlsutil provides utility functions for handling TLS.
Package tlsutil provides utility functions for handling TLS.
tests

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL