Skip to content

Commit

Permalink
Renaming from fabric-cop to fabric-ca
Browse files Browse the repository at this point in the history
This renames from fabric-cop to fabric-ca.
See https://jira.hyperledger.org/browse/FAB-1712

Change-Id: Iee15f5f68c7eb9e61b4820891781ef4572e00d0d
Signed-off-by: Keith Smith <bksmith@us.ibm.com>
  • Loading branch information
Keith Smith committed Jan 18, 2017
1 parent 9c6c125 commit 8894989
Show file tree
Hide file tree
Showing 77 changed files with 368 additions and 385 deletions.
5 changes: 2 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
bin
build
cli/cop/cop
testdata/client.json
coverage.xml
fabric-ca
*.csr
*.der
coverage.xml
2 changes: 1 addition & 1 deletion .gitreview
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[gerrit]
host=gerrit.hyperledger.org
port=29418
project=fabric-cop
project=fabric-ca
44 changes: 23 additions & 21 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,14 @@
#
# - all (default) - builds all targets and runs all tests
# - license - check all go files for license headers
# - cop - builds the cop executable
# - fabric-ca - builds the fabric-ca executable
# - unit-tests - Performs checks first and runs the go-test based unit tests
# - checks - runs all check conditions (license, format, imports, lint and vet)
# - ldap-tests - runs the LDAP tests
# - docker[-clean] - ensures all docker images are available[/cleaned]
# - clean - cleans the build area

PROJECT_NAME = fabric-cop
PROJECT_NAME = fabric-ca
BASE_VERSION = 0.7.0
IS_RELEASE = false

Expand All @@ -43,17 +43,20 @@ K := $(foreach exec,$(EXECUTABLES),\
ARCH=$(shell uname -m)
BASEIMAGE_RELEASE = 0.2.2
PKGNAME = github.com/hyperledger/$(PROJECT_NAME)
SAMPLECONFIG = $(shell git ls-files images/cop/config)
SAMPLECONFIG = $(shell git ls-files images/fabric-ca/config)

DOCKER_ORG = hyperledger
IMAGES = $(PROJECT_NAME) $(PROJECT_NAME)-runtime

image-path-map.fabric-cop := cop
image-path-map.fabric-cop-runtime := runtime
image-path-map.fabric-ca := fabric-ca
image-path-map.fabric-ca-runtime := runtime

include docker-env.mk

all: docker unit-tests
all: rename docker unit-tests

rename: .FORCE
@scripts/rename-repo

docker: $(patsubst %,build/image/%/$(DUMMY), $(IMAGES))

Expand All @@ -74,22 +77,21 @@ lint: .FORCE
vet: .FORCE
@scripts/check_vet

cop:
@echo "Building cop in bin directory ..."
@mkdir -p bin && cd cli && go build -o ../bin/cop
@echo "Built bin/cop"
fabric-ca:
@echo "Building fabric-ca in bin directory ..."
@mkdir -p bin && go build -o bin/fabric-ca
@echo "Built bin/fabric-ca"

# We (re)build a package within a docker context but persist the $GOPATH/pkg
# directory so that subsequent builds are faster
build/docker/bin/cop:
build/docker/bin/fabric-ca:
@echo "Building $@"
@mkdir -p $(@D) build/docker/$(@F)/pkg
@$(DRUN) \
-v $(abspath build/docker/bin):/opt/gopath/bin \
-v $(abspath build/docker/$(@F)/pkg):/opt/gopath/pkg \
hyperledger/fabric-baseimage:$(BASE_DOCKER_TAG) \
go install -ldflags "$(DOCKER_GO_LDFLAGS)" $(PKGNAME)/cli
mv build/docker/bin/cli $@
go install -ldflags "$(DOCKER_GO_LDFLAGS)" $(PKGNAME)
@touch $@

build/docker/busybox:
Expand All @@ -101,17 +103,17 @@ build/docker/busybox:
build/image/$(PROJECT_NAME)/$(DUMMY): build/image/$(PROJECT_NAME)-runtime/$(DUMMY)

# payload definitions
build/image/$(PROJECT_NAME)/payload: build/docker/bin/cop \
build/image/$(PROJECT_NAME)/payload: build/docker/bin/fabric-ca \
build/sampleconfig.tar.bz2
build/image/$(PROJECT_NAME)-runtime/payload: build/docker/busybox

build/image/%/payload:
mkdir -p $@
cp images/cop/root.pem $@/root.pem
cp images/cop/tls_client-cert.pem $@/tls_client-cert.pem
cp images/cop/tls_client-key.pem $@/tls_client-key.pem
cp images/cop/ec.pem $@/ec.pem
cp images/cop/ec-key.pem $@/ec-key.pem
cp images/fabric-ca/root.pem $@/root.pem
cp images/fabric-ca/tls_client-cert.pem $@/tls_client-cert.pem
cp images/fabric-ca/tls_client-key.pem $@/tls_client-key.pem
cp images/fabric-ca/ec.pem $@/ec.pem
cp images/fabric-ca/ec-key.pem $@/ec-key.pem
cp $^ $@

build/image/%/$(DUMMY): Makefile build/image/%/payload
Expand All @@ -127,9 +129,9 @@ build/image/%/$(DUMMY): Makefile build/image/%/payload
@touch $@

build/sampleconfig.tar.bz2: $(SAMPLECONFIG)
tar -jc -C images/cop/config $(patsubst images/cop/config/%,%,$(SAMPLECONFIG)) > $@
tar -jc -C images/fabric-ca/config $(patsubst images/fabric-ca/config/%,%,$(SAMPLECONFIG)) > $@

unit-tests: checks cop
unit-tests: checks fabric-ca
@scripts/run_tests

container-tests: ldap-tests
Expand Down
17 changes: 11 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
# COP
# Fabric CA

COP is the name for Membership Services in v1.0 of Hyperledger Fabric.
COP is not an acronym. The name "COP" was selected because of the following.
The fabric-ca is a Certificate Authority for Hyperledger Fabric v1.0 and later.

* COP provides police-like security functionality for Hyperledger Fabric. It is the "fabric COP";
* COP is shorter and easier to say and write than “Membership Services v1.0” :-)
It consists of both a serve and a client component.

See the [COP design doc](https://docs.google.com/document/d/1TRYHcaT8yMn8MZlDtreqzkDcXx0WI50AV2JpAcvAM5w) for information on what COP will provide.
It provides features including:
* registration of identities;
* enrollment of identities and issuance of enrollment certificates (ECerts);
* issuance of transaction certificates (TCerts) given proof of ownership
of an ECert;
* certificate renewal and revocation.

See the [Fabric-CA design doc](https://docs.google.com/document/d/1TRYHcaT8yMn8MZlDtreqzkDcXx0WI50AV2JpAcvAM5w) for design documentation.

## Getting Started

Expand Down
2 changes: 1 addition & 1 deletion api/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import (
"time"

"github.com/cloudflare/cfssl/csr"
"github.com/hyperledger/fabric-cop/lib/tcert"
"github.com/hyperledger/fabric-ca/lib/tcert"
)

// RegistrationRequest for a new identity
Expand Down
8 changes: 4 additions & 4 deletions api/net.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@ limitations under the License.

package api

import "github.com/hyperledger/fabric-cop/lib/tcert"
import "github.com/hyperledger/fabric-ca/lib/tcert"

/*
* This file contains the structure definitions for the request
* and responses which flow over the network between a COP client
* and the COP server.
* and responses which flow over the network between a fabric-ca client
* and the fabric-ca server.
*/

// RegistrationRequestNet is the registration request for a new identity
Expand All @@ -46,7 +46,7 @@ type ReenrollmentRequestNet struct {
}

// RevocationRequestNet is a revocation request which flows over the network
// to the COP server.
// to the fabric-ca server.
// To revoke a single certificate, both the Serial and AKI fields must be set;
// otherwise, to revoke all certificates and the identity associated with an enrollment ID,
// the Name field must be set to an existing enrollment ID.
Expand Down
24 changes: 12 additions & 12 deletions cli/client/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,16 @@ import (
"time"

"github.com/cloudflare/cfssl/cli"
"github.com/hyperledger/fabric-cop/cli/server"
"github.com/hyperledger/fabric-ca/cli/server"
)

var serverStarted bool
var serverExitCode = 0
var dir string

const (
ClientTLSConfig = "cop_client.json"
COPDB = "../../testdata/cop.db"
ClientTLSConfig = "client-config.json"
FabricCADB = "../../testdata/fabric-ca.db"
)

// TestNewClient tests constructing a client
Expand All @@ -49,7 +49,7 @@ func TestEnrollCLI(t *testing.T) {
startServer()

clientConfig := filepath.Join(dir, ClientTLSConfig)
os.Link("../../testdata/cop_client2.json", clientConfig)
os.Link("../../testdata/client-config2.json", clientConfig)

c := new(cli.Config)

Expand Down Expand Up @@ -114,7 +114,7 @@ func TestRegisterNoJSON(t *testing.T) {
func TestRegisterMissingRegistrar(t *testing.T) {
c := new(cli.Config)

// os.Setenv("COP_HOME", "/tmp")
// os.Setenv("FABRIC_CA_HOME", "/tmp")
args := []string{"", "", "https://localhost:8888"}

err := registerMain(args, *c)
Expand Down Expand Up @@ -210,12 +210,12 @@ func TestBogusCommand(t *testing.T) {

func TestLast(t *testing.T) {
// Cleanup
os.Remove(COPDB)
os.Remove(FabricCADB)
os.RemoveAll(dir)
}

func runServer() {
os.Setenv("COP_DEBUG", "true")
os.Setenv("FABRIC_CA_DEBUG", "true")
server.Start("../../testdata", "testconfig.json")
}

Expand All @@ -228,15 +228,15 @@ func startServer() {
}

if !serverStarted {
os.Remove(COPDB)
os.Remove(FabricCADB)
os.RemoveAll(dir)
serverStarted = true
fmt.Println("starting COP server ...")
os.Setenv("COP_HOME", dir)
fmt.Println("starting fabric-ca server ...")
os.Setenv("FABRIC_CA_HOME", dir)
go runServer()
time.Sleep(10 * time.Second)
fmt.Println("COP server started")
fmt.Println("fabric-ca server started")
} else {
fmt.Println("COP server already started")
fmt.Println("fabric-ca server already started")
}
}
18 changes: 9 additions & 9 deletions cli/client/enroll.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,20 +22,20 @@ import (
"github.com/cloudflare/cfssl/cli"
"github.com/cloudflare/cfssl/log"

"github.com/hyperledger/fabric-cop/api"
"github.com/hyperledger/fabric-ca/api"
)

var enrollUsageText = `cop client enroll -- Enroll with COP server
var enrollUsageText = `fabric-ca client enroll -- Enroll with fabric-ca server
Usage of client enroll command:
Enroll a client and get an ecert:
cop client enroll ID SECRET COP-SERVER-ADDR
fabric-ca client enroll ID SECRET FABRIC-CA-SERVER-ADDR
Arguments:
ID: Enrollment ID
SECRET: Enrollment secret returned by register
COP-SERVER-ADDR: COP server address
CSRJSON: Certificate Signing Request JSON information (Optional)
ID: Enrollment ID
SECRET: Enrollment secret returned by register
FABRIC-CA-SERVER-ADDR: Fabric CA server address
CSRJSON: Certificate Signing Request JSON information (Optional)
Flags:
`
Expand All @@ -55,7 +55,7 @@ func enrollMain(args []string, c cli.Config) error {
return err
}

copServer, args, err := cli.PopFirstArgument(args)
fcaServer, args, err := cli.PopFirstArgument(args)
if err != nil {
return err
}
Expand All @@ -65,7 +65,7 @@ func enrollMain(args []string, c cli.Config) error {
Secret: secret,
}

client, err := NewClient(copServer)
client, err := NewClient(fcaServer)
if err != nil {
return err
}
Expand Down
14 changes: 7 additions & 7 deletions cli/client/reenroll.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,17 @@ import (
"github.com/cloudflare/cfssl/cli"
"github.com/cloudflare/cfssl/log"

"github.com/hyperledger/fabric-cop/api"
"github.com/hyperledger/fabric-ca/api"
)

var reenrollUsageText = `cop client reenroll -- Reenroll with COP server
var reenrollUsageText = `fabric-ca client reenroll -- Reenroll with fabric-ca server
Usage of client enroll command:
cop client reenroll COP-SERVER-ADDR
fabric-ca client reenroll FABRIC-CA-SERVER-ADDR
Arguments:
COP-SERVER-ADDR: COP server address
CSRJSON: Certificate Signing Request JSON information (Optional)
FABRIC-CA-SERVER-ADDR: Fabric CA server address
CSRJSON: Certificate Signing Request JSON information (Optional)
Flags:
`
Expand All @@ -42,12 +42,12 @@ var reenrollFlags = []string{}
func reenrollMain(args []string, c cli.Config) error {
log.Debug("Entering cli/client/reenrollMain")

copServer, args, err := cli.PopFirstArgument(args)
fcaServer, args, err := cli.PopFirstArgument(args)
if err != nil {
return err
}

client, err := NewClient(copServer)
client, err := NewClient(fcaServer)
if err != nil {
return err
}
Expand Down
18 changes: 9 additions & 9 deletions cli/client/register.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,19 +22,19 @@ import (
"fmt"

"github.com/cloudflare/cfssl/cli"
"github.com/hyperledger/fabric-cop/api"
"github.com/hyperledger/fabric-cop/util"
"github.com/hyperledger/fabric-ca/api"
"github.com/hyperledger/fabric-ca/util"
)

var registerUsageText = `cop client register -- Register an ID with COP server and return an enrollment secret
var registerUsageText = `fabric-ca client register -- Register an ID with fabric-ca server and return an enrollment secret
Usage of client register command:
Register a client with COP server:
cop client register REGISTER-REQUEST-FILE COP-SERVER-ADDR
Register a client with fabric-ca server:
fabric-ca client register REGISTER-REQUEST-FILE FABRIC-CA-SERVER-ADDR
Arguments:
RRJSON: File contains registration info
COP-SERVER-ADDR: COP server address
RRJSON: File contains registration info
FABRIC-CA-SERVER-ADDR: Fabric CA server address
Flags:
`

Expand All @@ -58,12 +58,12 @@ func registerMain(args []string, c cli.Config) error {
return err
}

copServer, _, err := cli.PopFirstArgument(args)
fcaServer, _, err := cli.PopFirstArgument(args)
if err != nil {
return err
}

client, err := NewClient(copServer)
client, err := NewClient(fcaServer)
if err != nil {
return err
}
Expand Down

0 comments on commit 8894989

Please sign in to comment.