Christopher Broglie bfcbf295f1 Revert accidental sqlite changes 6 tahun lalu
..
dbconf 843abf2988 new certdb method: GetRevokedAndUnexpiredCertificatesByLabel (#785) 7 tahun lalu
mysql f38a88d1e9 Increase certificate serial number to 128 (#744) 7 tahun lalu
ocspstapling 37c1a7625a Switch github.com/google/certificate-transparency/go import paths to their new location and fix API breaks 7 tahun lalu
pg 1b8476a235 now remove temp id 8 tahun lalu
sql 3d237bf2a0 fix spelling in comments 6 tahun lalu
sqlite 3d15118774 Fixing sqlite db schema (replaces bytea by blob) (#787) 7 tahun lalu
testdb bfcbf295f1 Revert accidental sqlite changes 6 tahun lalu
README.md 7fb22c8cba Added "parseTime=true" to query string in example MySQL db-config file, to match test files and address https://github.com/go-sql-driver/mysql#timetime-support. (#659) 8 tahun lalu
certdb.go 843abf2988 new certdb method: GetRevokedAndUnexpiredCertificatesByLabel (#785) 7 tahun lalu

README.md

certdb usage

Using a database enables additional functionality for existing commands when a db config is provided:

  • sign and gencert add a certificate to the certdb after signing it
  • serve enables database functionality for the sign and revoke endpoints

A database is required for the following:

  • revoke marks certificates revoked in the database with an optional reason
  • ocsprefresh refreshes the table of cached OCSP responses
  • ocspdump outputs cached OCSP responses in a concatenated base64-encoded format

Setup/Migration

This directory stores goose db migration scripts for various DB backends. Currently supported:

  • MySQL in mysql
  • PostgreSQL in pg
  • SQLite in sqlite

Get goose

go get bitbucket.org/liamstask/goose/cmd/goose

Use goose to start and terminate a MySQL DB

To start a MySQL using goose:

goose -path $GOPATH/src/github.com/cloudflare/cfssl/certdb/mysql up

To tear down a MySQL DB using goose

goose -path $GOPATH/src/github.com/cloudflare/cfssl/certdb/mysql down

Note: the administration of MySQL DB is not included. We assume the databases being connected to are already created and access control is properly handled.

Use goose to start and terminate a PostgreSQL DB

To start a PostgreSQL using goose:

goose -path $GOPATH/src/github.com/cloudflare/cfssl/certdb/pg up

To tear down a PostgreSQL DB using goose

goose -path $GOPATH/src/github.com/cloudflare/cfssl/certdb/pg down

Note: the administration of PostgreSQL DB is not included. We assume the databases being connected to are already created and access control is properly handled.

Use goose to start and terminate a SQLite DB

To start a SQLite DB using goose:

goose -path $GOPATH/src/github.com/cloudflare/cfssl/certdb/sqlite up

To tear down a SQLite DB using goose

goose -path $GOPATH/src/github.com/cloudflare/cfssl/certdb/sqlite down

CFSSL Configuration

Several cfssl commands take a -db-config flag. Create a file with a JSON dictionary:

{"driver":"sqlite3","data_source":"certs.db"}

or

{"driver":"postgres","data_source":"postgres://user:password@host/db"}

or

{"driver":"mysql","data_source":"user:password@tcp(hostname:3306)/db?parseTime=true"}