Skip to content

Commit e63662a

Browse files
committed
Cleaup core.yaml security section
This change-set removes the unused properties from the security section of core.yaml Among other things, SHA2 is now default in core.yaml Change-Id: I45b28c05e6c799c3ac6531f1e5d482be6f96a0a2 Signed-off-by: Angelo De Caro <[email protected]>
1 parent 4ad8f9e commit e63662a

19 files changed

+212
-999
lines changed

core/chaincode/exectransaction_test.go

+7-7
Original file line numberDiff line numberDiff line change
@@ -378,7 +378,7 @@ func chaincodeQueryChaincode(chainID string, user string) error {
378378
f := "init"
379379
args := util.ToChaincodeArgs(f, "a", "100", "b", "200")
380380

381-
spec1 := &pb.ChaincodeSpec{Type: 1, ChaincodeID: cID1, CtorMsg: &pb.ChaincodeInput{Args: args}, SecureContext: user}
381+
spec1 := &pb.ChaincodeSpec{Type: 1, ChaincodeID: cID1, CtorMsg: &pb.ChaincodeInput{Args: args}}
382382

383383
cccid1 := NewCCContext(chainID, "example02", "0", "", false, nil)
384384

@@ -399,7 +399,7 @@ func chaincodeQueryChaincode(chainID string, user string) error {
399399
f = "init"
400400
args = util.ToChaincodeArgs(f, "sum", "0")
401401

402-
spec2 := &pb.ChaincodeSpec{Type: 1, ChaincodeID: cID2, CtorMsg: &pb.ChaincodeInput{Args: args}, SecureContext: user}
402+
spec2 := &pb.ChaincodeSpec{Type: 1, ChaincodeID: cID2, CtorMsg: &pb.ChaincodeInput{Args: args}}
403403

404404
cccid2 := NewCCContext(chainID, "example05", "0", "", false, nil)
405405

@@ -417,7 +417,7 @@ func chaincodeQueryChaincode(chainID string, user string) error {
417417
f = "invoke"
418418
args = util.ToChaincodeArgs(f, chaincodeID1, "sum")
419419

420-
spec2 = &pb.ChaincodeSpec{Type: 1, ChaincodeID: cID2, CtorMsg: &pb.ChaincodeInput{Args: args}, SecureContext: user}
420+
spec2 = &pb.ChaincodeSpec{Type: 1, ChaincodeID: cID2, CtorMsg: &pb.ChaincodeInput{Args: args}}
421421
// Invoke chaincode
422422
var retVal []byte
423423
_, _, retVal, err = invoke(ctxt, chainID, spec2)
@@ -440,7 +440,7 @@ func chaincodeQueryChaincode(chainID string, user string) error {
440440
f = "query"
441441
args = util.ToChaincodeArgs(f, chaincodeID1, "sum")
442442

443-
spec2 = &pb.ChaincodeSpec{Type: 1, ChaincodeID: cID2, CtorMsg: &pb.ChaincodeInput{Args: args}, SecureContext: user}
443+
spec2 = &pb.ChaincodeSpec{Type: 1, ChaincodeID: cID2, CtorMsg: &pb.ChaincodeInput{Args: args}}
444444
// Invoke chaincode
445445
_, _, retVal, err = invoke(ctxt, chainID, spec2)
446446

@@ -687,7 +687,7 @@ func chaincodeInvokeChaincode(t *testing.T, chainID string, user string) (err er
687687
f := "init"
688688
args := util.ToChaincodeArgs(f, "a", "100", "b", "200")
689689

690-
spec1 := &pb.ChaincodeSpec{Type: 1, ChaincodeID: cID1, CtorMsg: &pb.ChaincodeInput{Args: args}, SecureContext: user}
690+
spec1 := &pb.ChaincodeSpec{Type: 1, ChaincodeID: cID1, CtorMsg: &pb.ChaincodeInput{Args: args}}
691691

692692
cccid1 := NewCCContext(chainID, "example02", "0", "", false, nil)
693693

@@ -711,7 +711,7 @@ func chaincodeInvokeChaincode(t *testing.T, chainID string, user string) (err er
711711
f = "init"
712712
args = util.ToChaincodeArgs(f, "e", "0")
713713

714-
spec2 := &pb.ChaincodeSpec{Type: 1, ChaincodeID: cID2, CtorMsg: &pb.ChaincodeInput{Args: args}, SecureContext: user}
714+
spec2 := &pb.ChaincodeSpec{Type: 1, ChaincodeID: cID2, CtorMsg: &pb.ChaincodeInput{Args: args}}
715715

716716
cccid2 := NewCCContext(chainID, "example04", "0", "", false, nil)
717717

@@ -733,7 +733,7 @@ func chaincodeInvokeChaincode(t *testing.T, chainID string, user string) (err er
733733
cid := spec1.ChaincodeID.Name
734734
args = util.ToChaincodeArgs(f, cid, "e", "1")
735735

736-
spec2 = &pb.ChaincodeSpec{Type: 1, ChaincodeID: cID2, CtorMsg: &pb.ChaincodeInput{Args: args}, SecureContext: user}
736+
spec2 = &pb.ChaincodeSpec{Type: 1, ChaincodeID: cID2, CtorMsg: &pb.ChaincodeInput{Args: args}}
737737
// Invoke chaincode
738738
var uuid string
739739
_, uuid, _, err = invoke(ctxt, chainID, spec2)

core/config.go

+2-5
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,7 @@ limitations under the License.
1616

1717
package core
1818

19-
import (
20-
"github.com/op/go-logging"
21-
"github.com/spf13/viper"
22-
)
19+
import "github.com/op/go-logging"
2320

2421
// See fabric/core/peer/config.go for comments on the configuration caching
2522
// methodology.
@@ -32,7 +29,7 @@ var securityEnabled bool
3229
// CacheConfiguration caches configuration settings so that reading the yaml
3330
// file can be avoided on future requests
3431
func CacheConfiguration() error {
35-
securityEnabled = viper.GetBool("security.enabled")
32+
securityEnabled = true
3633
configurationCached = true
3734
return nil
3835
}

core/endorser/endorser_test.go

+4-10
Original file line numberDiff line numberDiff line change
@@ -78,16 +78,10 @@ func initPeer(chainID string) (net.Listener, error) {
7878
}
7979

8080
// Install security object for peer
81-
if viper.GetBool("security.enabled") {
82-
//TODO: integrate new crypto / idp
83-
securityLevel := viper.GetInt("security.level")
84-
hashAlgorithm := viper.GetString("security.hashAlgorithm")
85-
primitives.SetSecurityLevel(hashAlgorithm, securityLevel)
86-
} else {
87-
// the primitives need to be instantiated no matter what. Otherwise
88-
// the escc code won't have a hash algorithm available to hash the proposal
89-
primitives.SetSecurityLevel("SHA2", 256)
90-
}
81+
//TODO: integrate new crypto / idp
82+
securityLevel := viper.GetInt("security.level")
83+
hashAlgorithm := viper.GetString("security.hashAlgorithm")
84+
primitives.SetSecurityLevel(hashAlgorithm, securityLevel)
9185

9286
ccStartupTimeout := time.Duration(30000) * time.Millisecond
9387
pb.RegisterChaincodeSupportServer(grpcServer, chaincode.NewChaincodeSupport(getPeerEndpoint, false, ccStartupTimeout))

core/peer/config.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ func CacheConfiguration() (err error) {
106106
syncBlocksChannelSize = viper.GetInt("peer.sync.blocks.channelSize")
107107
validatorEnabled = viper.GetBool("peer.validator.enabled")
108108

109-
securityEnabled = viper.GetBool("security.enabled")
109+
securityEnabled = true
110110

111111
configurationCached = true
112112

docs/Setup/Chaincode-setup.md

+1-3
Original file line numberDiff line numberDiff line change
@@ -40,16 +40,14 @@ Running the above commands builds and runs the CA server with the default setup,
4040

4141
### Running the validating peer
4242

43-
**Note:** To run with security enabled, first modify the [core.yaml](https://github.com/hyperledger/fabric/blob/master/peer/core.yaml) configuration file to set the `security.enabled` value to `true` before building the peer executable. Alternatively, you can enable security by running the peer with the following environment variable: `CORE_SECURITY_ENABLED=true`. To enable privacy and confidentiality of transactions (which requires security to also be enabled), modify the [core.yaml](https://github.com/hyperledger/fabric/blob/master/peer/core.yaml) configuration file to set the `security.privacy` value to `true` as well. Alternatively, you can enable privacy by running the peer with the following environment variable: `CORE_SECURITY_PRIVACY=true`. If you are enabling security and privacy on the peer process with environment variables, it is important to include these environment variables in the command when executing all subsequent peer operations (e.g. deploy, invoke, or query).
44-
4543
In a **new** terminal window, from the `devenv` subdirectory of your fabric workspace environment, `ssh` into Vagrant:
4644

4745
```
4846
cd $GOPATH/src/github.com/hyperledger/fabric/devenv
4947
vagrant ssh
5048
```
5149

52-
Build and run the peer process to enable security and privacy after setting `security.enabled` and `security.privacy` settings to `true`.
50+
Build and run the peer process.
5351

5452
```
5553
cd $GOPATH/src/github.com/hyperledger/fabric

examples/chaincode/go/asset_management/app/README.md

-94
This file was deleted.

0 commit comments

Comments
 (0)