Merge branch 'master' into va-ctc
This commit is contained in:
commit
dc05141c04
|
|
@ -1,9 +0,0 @@
|
|||
development:
|
||||
driver: mysql
|
||||
open: boulder@tcp(localhost:3306)/boulder_ca_development
|
||||
test:
|
||||
driver: mysql
|
||||
open: boulder@tcp(localhost:3306)/boulder_ca_test
|
||||
integration:
|
||||
driver: mysql
|
||||
open: boulder@tcp(localhost:3306)/boulder_ca_integration
|
||||
|
|
@ -1,23 +0,0 @@
|
|||
|
||||
-- +goose Up
|
||||
-- SQL in section 'Up' is executed when this migration is applied
|
||||
|
||||
CREATE TABLE `serialNumber` (
|
||||
`id` int(11) DEFAULT NULL,
|
||||
`number` int(11) DEFAULT NULL,
|
||||
`lastUpdated` datetime DEFAULT NULL
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
INSERT INTO `serialNumber`
|
||||
(`id`,
|
||||
`number`,
|
||||
`lastUpdated`)
|
||||
VALUES (1,
|
||||
1,
|
||||
now()
|
||||
);
|
||||
|
||||
-- +goose Down
|
||||
-- SQL section 'Down' is executed when this migration is rolled back
|
||||
|
||||
DROP TABLE `serialNumber`
|
||||
|
|
@ -1,30 +0,0 @@
|
|||
|
||||
-- +goose Up
|
||||
-- SQL in section 'Up' is executed when this migration is applied
|
||||
|
||||
DROP TABLE `serialNumber`;
|
||||
CREATE TABLE `serialNumber` (
|
||||
`id` bigint(20) unsigned NOT NULL auto_increment,
|
||||
`stub` char(1) NOT NULL default '',
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE KEY `stub` (`stub`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
-- +goose Down
|
||||
-- SQL section 'Down' is executed when this migration is rolled back
|
||||
|
||||
DROP TABLE `serialNumber`;
|
||||
CREATE TABLE `serialNumber` (
|
||||
`id` int(11) DEFAULT NULL,
|
||||
`number` int(11) DEFAULT NULL,
|
||||
`lastUpdated` datetime DEFAULT NULL
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
INSERT INTO `serialNumber`
|
||||
(`id`,
|
||||
`number`,
|
||||
`lastUpdated`)
|
||||
VALUES (1,
|
||||
1,
|
||||
now()
|
||||
);
|
||||
|
|
@ -1,60 +0,0 @@
|
|||
// Copyright 2015 ISRG. All rights reserved
|
||||
// This Source Code Form is subject to the terms of the Mozilla Public
|
||||
// License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
package ca
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
blog "github.com/letsencrypt/boulder/log"
|
||||
|
||||
gorp "github.com/letsencrypt/boulder/Godeps/_workspace/src/gopkg.in/gorp.v1"
|
||||
)
|
||||
|
||||
// CertificateAuthorityDatabaseImpl represents a database used by the CA; it
|
||||
// enforces transaction semantics, and is effectively single-threaded.
|
||||
type CertificateAuthorityDatabaseImpl struct {
|
||||
log *blog.AuditLogger
|
||||
dbMap *gorp.DbMap
|
||||
}
|
||||
|
||||
// SerialNumber defines the database table used to hold the serial number.
|
||||
type SerialNumber struct {
|
||||
ID int `db:"id"`
|
||||
Number int64 `db:"number"`
|
||||
LastUpdated time.Time `db:"lastUpdated"`
|
||||
}
|
||||
|
||||
// NewCertificateAuthorityDatabaseImpl constructs a Database for the
|
||||
// Certificate Authority.
|
||||
func NewCertificateAuthorityDatabaseImpl(dbMap *gorp.DbMap) (cadb *CertificateAuthorityDatabaseImpl, err error) {
|
||||
logger := blog.GetAuditLogger()
|
||||
|
||||
dbMap.AddTableWithName(SerialNumber{}, "serialNumber").SetKeys(true, "ID")
|
||||
|
||||
cadb = &CertificateAuthorityDatabaseImpl{
|
||||
dbMap: dbMap,
|
||||
log: logger,
|
||||
}
|
||||
return cadb, nil
|
||||
}
|
||||
|
||||
// Begin starts a transaction at the GORP wrapper.
|
||||
func (cadb *CertificateAuthorityDatabaseImpl) Begin() (*gorp.Transaction, error) {
|
||||
return cadb.dbMap.Begin()
|
||||
}
|
||||
|
||||
// IncrementAndGetSerial returns the next-available serial number, incrementing
|
||||
// it in the database before returning. There must be an active transaction to
|
||||
// call this method. Callers should Begin the transaction, call this method,
|
||||
// perform any other work, and Commit at the end once the certificate is issued.
|
||||
func (cadb *CertificateAuthorityDatabaseImpl) IncrementAndGetSerial(tx *gorp.Transaction) (int64, error) {
|
||||
r, err := tx.Exec("REPLACE INTO serialNumber (stub) VALUES ('a');")
|
||||
if err != nil {
|
||||
return -1, err
|
||||
}
|
||||
|
||||
return r.LastInsertId()
|
||||
}
|
||||
|
|
@ -1,61 +0,0 @@
|
|||
// Copyright 2015 ISRG. All rights reserved
|
||||
// This Source Code Form is subject to the terms of the Mozilla Public
|
||||
// License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
package ca
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/letsencrypt/boulder/sa"
|
||||
"github.com/letsencrypt/boulder/test"
|
||||
)
|
||||
|
||||
func TestGetSetSequenceOutsideTx(t *testing.T) {
|
||||
cadb, cleanUp := caDBImpl(t)
|
||||
defer cleanUp()
|
||||
tx, err := cadb.Begin()
|
||||
test.AssertNotError(t, err, "Could not begin")
|
||||
tx.Commit()
|
||||
_, err = cadb.IncrementAndGetSerial(tx)
|
||||
test.AssertError(t, err, "Not permitted")
|
||||
|
||||
tx2, err := cadb.Begin()
|
||||
test.AssertNotError(t, err, "Could not begin")
|
||||
tx2.Rollback()
|
||||
_, err = cadb.IncrementAndGetSerial(tx2)
|
||||
test.AssertError(t, err, "Not permitted")
|
||||
}
|
||||
|
||||
func TestGetSetSequenceNumber(t *testing.T) {
|
||||
cadb, cleanUp := caDBImpl(t)
|
||||
defer cleanUp()
|
||||
tx, err := cadb.Begin()
|
||||
test.AssertNotError(t, err, "Could not begin")
|
||||
|
||||
num, err := cadb.IncrementAndGetSerial(tx)
|
||||
test.AssertNotError(t, err, "Could not get number")
|
||||
|
||||
num2, err := cadb.IncrementAndGetSerial(tx)
|
||||
test.AssertNotError(t, err, "Could not get number")
|
||||
test.Assert(t, num+1 == num2, "Numbers should be incrementing")
|
||||
|
||||
err = tx.Commit()
|
||||
test.AssertNotError(t, err, "Could not commit")
|
||||
}
|
||||
|
||||
func caDBImpl(t *testing.T) (*CertificateAuthorityDatabaseImpl, func()) {
|
||||
dbMap, err := sa.NewDbMap(caDBConnStr)
|
||||
if err != nil {
|
||||
t.Fatalf("Could not construct dbMap: %s", err)
|
||||
}
|
||||
|
||||
cadb, err := NewCertificateAuthorityDatabaseImpl(dbMap)
|
||||
if err != nil {
|
||||
t.Fatalf("Could not construct CA DB: %s", err)
|
||||
}
|
||||
|
||||
cleanUp := test.ResetTestDatabase(t, dbMap.Db)
|
||||
return cadb, cleanUp
|
||||
}
|
||||
|
|
@ -54,7 +54,6 @@ type CertificateAuthorityImpl struct {
|
|||
OCSPSigner ocsp.Signer
|
||||
SA core.StorageAuthority
|
||||
PA core.PolicyAuthority
|
||||
DB core.CertificateAuthorityDatabase
|
||||
Publisher core.Publisher
|
||||
Clk clock.Clock // TODO(jmhodges): should be private, like log
|
||||
log *blog.AuditLogger
|
||||
|
|
@ -70,7 +69,7 @@ type CertificateAuthorityImpl struct {
|
|||
// using CFSSL's authenticated signature scheme. A CA created in this way
|
||||
// issues for a single profile on the remote signer, which is indicated
|
||||
// by name in this constructor.
|
||||
func NewCertificateAuthorityImpl(cadb core.CertificateAuthorityDatabase, config cmd.CAConfig, clk clock.Clock, issuerCert string) (*CertificateAuthorityImpl, error) {
|
||||
func NewCertificateAuthorityImpl(config cmd.CAConfig, clk clock.Clock, issuerCert string) (*CertificateAuthorityImpl, error) {
|
||||
var ca *CertificateAuthorityImpl
|
||||
var err error
|
||||
logger := blog.GetAuditLogger()
|
||||
|
|
@ -127,7 +126,6 @@ func NewCertificateAuthorityImpl(cadb core.CertificateAuthorityDatabase, config
|
|||
Signer: signer,
|
||||
OCSPSigner: ocspSigner,
|
||||
profile: config.Profile,
|
||||
DB: cadb,
|
||||
Prefix: config.SerialPrefix,
|
||||
Clk: clk,
|
||||
log: logger,
|
||||
|
|
@ -306,15 +304,6 @@ func (ca *CertificateAuthorityImpl) IssueCertificate(csr x509.CertificateRequest
|
|||
Bytes: csr.Raw,
|
||||
}))
|
||||
|
||||
// Get the next serial number
|
||||
tx, err := ca.DB.Begin()
|
||||
if err != nil {
|
||||
err = core.InternalServerError(err.Error())
|
||||
// AUDIT[ Error Conditions ] 9cc4d537-8534-4970-8665-4b382abe82f3
|
||||
ca.log.AuditErr(err)
|
||||
return emptyCert, err
|
||||
}
|
||||
|
||||
// Hack: CFSSL always sticks a 64-bit random number at the end of the
|
||||
// serialSeq we provide, but we want 136 bits of random number, plus an 8-bit
|
||||
// instance id prefix. For now, we generate the extra 72 bits of randomness
|
||||
|
|
@ -328,7 +317,6 @@ func (ca *CertificateAuthorityImpl) IssueCertificate(csr x509.CertificateRequest
|
|||
err = core.InternalServerError(err.Error())
|
||||
// AUDIT[ Error Conditions ] 9cc4d537-8534-4970-8665-4b382abe82f3
|
||||
ca.log.Audit(fmt.Sprintf("Serial randomness failed, err=[%v]", err))
|
||||
tx.Rollback()
|
||||
return emptyCert, err
|
||||
}
|
||||
serialHex := hex.EncodeToString([]byte{byte(ca.Prefix)}) + hex.EncodeToString(randSlice)
|
||||
|
|
@ -349,7 +337,6 @@ func (ca *CertificateAuthorityImpl) IssueCertificate(csr x509.CertificateRequest
|
|||
err = core.InternalServerError(err.Error())
|
||||
// AUDIT[ Error Conditions ] 9cc4d537-8534-4970-8665-4b382abe82f3
|
||||
ca.log.Audit(fmt.Sprintf("Signer failed, rolling back: serial=[%s] err=[%v]", serialHex, err))
|
||||
tx.Rollback()
|
||||
return emptyCert, err
|
||||
}
|
||||
|
||||
|
|
@ -357,7 +344,6 @@ func (ca *CertificateAuthorityImpl) IssueCertificate(csr x509.CertificateRequest
|
|||
err = core.InternalServerError("No certificate returned by server")
|
||||
// AUDIT[ Error Conditions ] 9cc4d537-8534-4970-8665-4b382abe82f3
|
||||
ca.log.Audit(fmt.Sprintf("PEM empty from Signer, rolling back: serial=[%s] err=[%v]", serialHex, err))
|
||||
tx.Rollback()
|
||||
return emptyCert, err
|
||||
}
|
||||
|
||||
|
|
@ -366,7 +352,6 @@ func (ca *CertificateAuthorityImpl) IssueCertificate(csr x509.CertificateRequest
|
|||
err = core.InternalServerError("Invalid certificate value returned")
|
||||
// AUDIT[ Error Conditions ] 9cc4d537-8534-4970-8665-4b382abe82f3
|
||||
ca.log.Audit(fmt.Sprintf("PEM decode error, aborting and rolling back issuance: pem=[%s] err=[%v]", certPEM, err))
|
||||
tx.Rollback()
|
||||
return emptyCert, err
|
||||
}
|
||||
certDER := block.Bytes
|
||||
|
|
@ -380,7 +365,6 @@ func (ca *CertificateAuthorityImpl) IssueCertificate(csr x509.CertificateRequest
|
|||
err = core.InternalServerError(err.Error())
|
||||
// AUDIT[ Error Conditions ] 9cc4d537-8534-4970-8665-4b382abe82f3
|
||||
ca.log.Audit(fmt.Sprintf("Uncaught error, aborting and rolling back issuance: pem=[%s] err=[%v]", certPEM, err))
|
||||
tx.Rollback()
|
||||
return emptyCert, err
|
||||
}
|
||||
|
||||
|
|
@ -390,14 +374,6 @@ func (ca *CertificateAuthorityImpl) IssueCertificate(csr x509.CertificateRequest
|
|||
err = core.InternalServerError(err.Error())
|
||||
// AUDIT[ Error Conditions ] 9cc4d537-8534-4970-8665-4b382abe82f3
|
||||
ca.log.Audit(fmt.Sprintf("Failed RPC to store at SA, orphaning certificate: pem=[%s] err=[%v]", certPEM, err))
|
||||
tx.Rollback()
|
||||
return emptyCert, err
|
||||
}
|
||||
|
||||
if err = tx.Commit(); err != nil {
|
||||
err = core.InternalServerError(err.Error())
|
||||
// AUDIT[ Error Conditions ] 9cc4d537-8534-4970-8665-4b382abe82f3
|
||||
ca.log.Audit(fmt.Sprintf("Failed to commit, orphaning certificate: pem=[%s] err=[%v]", certPEM, err))
|
||||
return emptyCert, err
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -91,7 +91,6 @@ const caCertFile = "../test/test-ca.pem"
|
|||
|
||||
const (
|
||||
paDBConnStr = "mysql+tcp://boulder@localhost:3306/boulder_policy_test"
|
||||
caDBConnStr = "mysql+tcp://boulder@localhost:3306/boulder_ca_test"
|
||||
saDBConnStr = "mysql+tcp://boulder@localhost:3306/boulder_sa_test"
|
||||
)
|
||||
|
||||
|
|
@ -104,7 +103,6 @@ func mustRead(path string) []byte {
|
|||
}
|
||||
|
||||
type testCtx struct {
|
||||
caDB core.CertificateAuthorityDatabase
|
||||
sa core.StorageAuthority
|
||||
caConfig cmd.CAConfig
|
||||
reg core.Registration
|
||||
|
|
@ -126,7 +124,6 @@ func setup(t *testing.T) *testCtx {
|
|||
t.Fatalf("Failed to create SA: %s", err)
|
||||
}
|
||||
saDBCleanUp := test.ResetTestDatabase(t, dbMap.Db)
|
||||
cadb, caDBCleanUp := caDBImpl(t)
|
||||
|
||||
paDbMap, err := sa.NewDbMap(paDBConnStr)
|
||||
test.AssertNotError(t, err, "Could not construct dbMap")
|
||||
|
|
@ -136,7 +133,6 @@ func setup(t *testing.T) *testCtx {
|
|||
|
||||
cleanUp := func() {
|
||||
saDBCleanUp()
|
||||
caDBCleanUp()
|
||||
paDBCleanUp()
|
||||
}
|
||||
|
||||
|
|
@ -188,7 +184,7 @@ func setup(t *testing.T) *testCtx {
|
|||
},
|
||||
},
|
||||
}
|
||||
return &testCtx{cadb, ssa, caConfig, reg, pa, fc, cleanUp}
|
||||
return &testCtx{ssa, caConfig, reg, pa, fc, cleanUp}
|
||||
}
|
||||
|
||||
func TestFailNoSerial(t *testing.T) {
|
||||
|
|
@ -196,14 +192,14 @@ func TestFailNoSerial(t *testing.T) {
|
|||
defer ctx.cleanUp()
|
||||
|
||||
ctx.caConfig.SerialPrefix = 0
|
||||
_, err := NewCertificateAuthorityImpl(ctx.caDB, ctx.caConfig, ctx.fc, caCertFile)
|
||||
_, err := NewCertificateAuthorityImpl(ctx.caConfig, ctx.fc, caCertFile)
|
||||
test.AssertError(t, err, "CA should have failed with no SerialPrefix")
|
||||
}
|
||||
|
||||
func TestRevoke(t *testing.T) {
|
||||
ctx := setup(t)
|
||||
defer ctx.cleanUp()
|
||||
ca, err := NewCertificateAuthorityImpl(ctx.caDB, ctx.caConfig, ctx.fc, caCertFile)
|
||||
ca, err := NewCertificateAuthorityImpl(ctx.caConfig, ctx.fc, caCertFile)
|
||||
test.AssertNotError(t, err, "Failed to create CA")
|
||||
ca.PA = ctx.pa
|
||||
ca.SA = ctx.sa
|
||||
|
|
@ -244,7 +240,7 @@ func TestRevoke(t *testing.T) {
|
|||
func TestIssueCertificate(t *testing.T) {
|
||||
ctx := setup(t)
|
||||
defer ctx.cleanUp()
|
||||
ca, err := NewCertificateAuthorityImpl(ctx.caDB, ctx.caConfig, ctx.fc, caCertFile)
|
||||
ca, err := NewCertificateAuthorityImpl(ctx.caConfig, ctx.fc, caCertFile)
|
||||
test.AssertNotError(t, err, "Failed to create CA")
|
||||
ca.Publisher = &mocks.MockPublisher{}
|
||||
ca.PA = ctx.pa
|
||||
|
|
@ -321,7 +317,7 @@ func TestIssueCertificate(t *testing.T) {
|
|||
func TestRejectNoName(t *testing.T) {
|
||||
ctx := setup(t)
|
||||
defer ctx.cleanUp()
|
||||
ca, err := NewCertificateAuthorityImpl(ctx.caDB, ctx.caConfig, ctx.fc, caCertFile)
|
||||
ca, err := NewCertificateAuthorityImpl(ctx.caConfig, ctx.fc, caCertFile)
|
||||
test.AssertNotError(t, err, "Failed to create CA")
|
||||
ca.Publisher = &mocks.MockPublisher{}
|
||||
ca.PA = ctx.pa
|
||||
|
|
@ -338,7 +334,7 @@ func TestRejectNoName(t *testing.T) {
|
|||
func TestRejectTooManyNames(t *testing.T) {
|
||||
ctx := setup(t)
|
||||
defer ctx.cleanUp()
|
||||
ca, err := NewCertificateAuthorityImpl(ctx.caDB, ctx.caConfig, ctx.fc, caCertFile)
|
||||
ca, err := NewCertificateAuthorityImpl(ctx.caConfig, ctx.fc, caCertFile)
|
||||
test.AssertNotError(t, err, "Failed to create CA")
|
||||
ca.Publisher = &mocks.MockPublisher{}
|
||||
ca.PA = ctx.pa
|
||||
|
|
@ -355,7 +351,7 @@ func TestRejectTooManyNames(t *testing.T) {
|
|||
func TestDeduplication(t *testing.T) {
|
||||
ctx := setup(t)
|
||||
defer ctx.cleanUp()
|
||||
ca, err := NewCertificateAuthorityImpl(ctx.caDB, ctx.caConfig, ctx.fc, caCertFile)
|
||||
ca, err := NewCertificateAuthorityImpl(ctx.caConfig, ctx.fc, caCertFile)
|
||||
test.AssertNotError(t, err, "Failed to create CA")
|
||||
ca.Publisher = &mocks.MockPublisher{}
|
||||
ca.PA = ctx.pa
|
||||
|
|
@ -379,7 +375,7 @@ func TestDeduplication(t *testing.T) {
|
|||
func TestRejectValidityTooLong(t *testing.T) {
|
||||
ctx := setup(t)
|
||||
defer ctx.cleanUp()
|
||||
ca, err := NewCertificateAuthorityImpl(ctx.caDB, ctx.caConfig, ctx.fc, caCertFile)
|
||||
ca, err := NewCertificateAuthorityImpl(ctx.caConfig, ctx.fc, caCertFile)
|
||||
test.AssertNotError(t, err, "Failed to create CA")
|
||||
ca.Publisher = &mocks.MockPublisher{}
|
||||
ca.PA = ctx.pa
|
||||
|
|
@ -397,7 +393,7 @@ func TestRejectValidityTooLong(t *testing.T) {
|
|||
func TestShortKey(t *testing.T) {
|
||||
ctx := setup(t)
|
||||
defer ctx.cleanUp()
|
||||
ca, err := NewCertificateAuthorityImpl(ctx.caDB, ctx.caConfig, ctx.fc, caCertFile)
|
||||
ca, err := NewCertificateAuthorityImpl(ctx.caConfig, ctx.fc, caCertFile)
|
||||
ca.Publisher = &mocks.MockPublisher{}
|
||||
ca.PA = ctx.pa
|
||||
ca.SA = ctx.sa
|
||||
|
|
@ -413,7 +409,7 @@ func TestShortKey(t *testing.T) {
|
|||
func TestRejectBadAlgorithm(t *testing.T) {
|
||||
ctx := setup(t)
|
||||
defer ctx.cleanUp()
|
||||
ca, err := NewCertificateAuthorityImpl(ctx.caDB, ctx.caConfig, ctx.fc, caCertFile)
|
||||
ca, err := NewCertificateAuthorityImpl(ctx.caConfig, ctx.fc, caCertFile)
|
||||
ca.Publisher = &mocks.MockPublisher{}
|
||||
ca.PA = ctx.pa
|
||||
ca.SA = ctx.sa
|
||||
|
|
|
|||
|
|
@ -33,18 +33,12 @@ func main() {
|
|||
|
||||
go cmd.DebugServer(c.CA.DebugAddr)
|
||||
|
||||
dbMap, err := sa.NewDbMap(c.CA.DBConnect)
|
||||
cmd.FailOnError(err, "Couldn't connect to CA database")
|
||||
|
||||
cadb, err := ca.NewCertificateAuthorityDatabaseImpl(dbMap)
|
||||
cmd.FailOnError(err, "Failed to create CA database")
|
||||
|
||||
paDbMap, err := sa.NewDbMap(c.PA.DBConnect)
|
||||
cmd.FailOnError(err, "Couldn't connect to policy database")
|
||||
pa, err := policy.NewPolicyAuthorityImpl(paDbMap, c.PA.EnforcePolicyWhitelist)
|
||||
cmd.FailOnError(err, "Couldn't create PA")
|
||||
|
||||
cai, err := ca.NewCertificateAuthorityImpl(cadb, c.CA, clock.Default(), c.Common.IssuerCert)
|
||||
cai, err := ca.NewCertificateAuthorityImpl(c.CA, clock.Default(), c.Common.IssuerCert)
|
||||
cmd.FailOnError(err, "Failed to create CA impl")
|
||||
cai.PA = pa
|
||||
|
||||
|
|
|
|||
|
|
@ -128,7 +128,6 @@ var (
|
|||
|
||||
const (
|
||||
paDBConnStr = "mysql+tcp://boulder@localhost:3306/boulder_policy_test"
|
||||
caDBConnStr = "mysql+tcp://boulder@localhost:3306/boulder_ca_test"
|
||||
saDBConnStr = "mysql+tcp://boulder@localhost:3306/boulder_sa_test"
|
||||
)
|
||||
|
||||
|
|
@ -187,13 +186,11 @@ func initAuthorities(t *testing.T) (*DummyValidationAuthority, *sa.SQLStorageAut
|
|||
policyDBCleanUp := test.ResetTestDatabase(t, paDbMap.Db)
|
||||
pa, err := policy.NewPolicyAuthorityImpl(paDbMap, false)
|
||||
test.AssertNotError(t, err, "Couldn't create PA")
|
||||
cadb, caDBCleanUp := caDBImpl(t)
|
||||
ca := ca.CertificateAuthorityImpl{
|
||||
Signer: signer,
|
||||
OCSPSigner: ocspSigner,
|
||||
SA: ssa,
|
||||
PA: pa,
|
||||
DB: cadb,
|
||||
Publisher: &mocks.MockPublisher{},
|
||||
ValidityPeriod: time.Hour * 2190,
|
||||
NotAfter: time.Now().Add(time.Hour * 8761),
|
||||
|
|
@ -201,7 +198,6 @@ func initAuthorities(t *testing.T) (*DummyValidationAuthority, *sa.SQLStorageAut
|
|||
}
|
||||
cleanUp := func() {
|
||||
saDBCleanUp()
|
||||
caDBCleanUp()
|
||||
policyDBCleanUp()
|
||||
}
|
||||
|
||||
|
|
@ -229,27 +225,6 @@ func initAuthorities(t *testing.T) (*DummyValidationAuthority, *sa.SQLStorageAut
|
|||
return va, ssa, &ra, fc, cleanUp
|
||||
}
|
||||
|
||||
// This is an unfortunate bit of tech debt that is being taken on in
|
||||
// order to get the more important change of using MySQL/MariaDB in
|
||||
// all of our tests working without SQLite. We already had issues with
|
||||
// the RA here getting a real CertificateAuthority instead of a
|
||||
// CertificateAuthorityClient, so this is only marginally worse.
|
||||
// TODO(Issue #628): use a CAClient fake instead of a CAImpl instance
|
||||
func caDBImpl(t *testing.T) (core.CertificateAuthorityDatabase, func()) {
|
||||
dbMap, err := sa.NewDbMap(caDBConnStr)
|
||||
if err != nil {
|
||||
t.Fatalf("Could not construct dbMap: %s", err)
|
||||
}
|
||||
|
||||
cadb, err := ca.NewCertificateAuthorityDatabaseImpl(dbMap)
|
||||
if err != nil {
|
||||
t.Fatalf("Could not construct CA DB: %s", err)
|
||||
}
|
||||
|
||||
cleanUp := test.ResetTestDatabase(t, dbMap.Db)
|
||||
return cadb, cleanUp
|
||||
}
|
||||
|
||||
func assertAuthzEqual(t *testing.T, a1, a2 core.Authorization) {
|
||||
test.Assert(t, a1.ID == a2.ID, "ret != DB: ID")
|
||||
test.Assert(t, a1.Identifier == a2.Identifier, "ret != DB: Identifier")
|
||||
|
|
|
|||
|
|
@ -54,7 +54,6 @@
|
|||
"ca": {
|
||||
"serialPrefix": 255,
|
||||
"profile": "ee",
|
||||
"dbConnect": "mysql+tcp://boulder@localhost:3306/boulder_ca_integration",
|
||||
"debugAddr": "localhost:8001",
|
||||
"Key": {
|
||||
"File": "test/test-ca.key"
|
||||
|
|
|
|||
|
|
@ -6,8 +6,7 @@ function die() {
|
|||
exit 1
|
||||
}
|
||||
|
||||
SERVICES="ca
|
||||
sa
|
||||
SERVICES="sa
|
||||
policy"
|
||||
DBENVS="development
|
||||
test
|
||||
|
|
|
|||
Loading…
Reference in New Issue