@@ -826,6 +826,7 @@ func (r *FabricMainChannelReconciler) mapToConfigTX(channel *hlfv1alpha1.FabricM
826
826
for _ , ordererOrg := range channel .Spec .OrdererOrganizations {
827
827
var tlsCACert * x509.Certificate
828
828
var caCert * x509.Certificate
829
+
829
830
if ordererOrg .CAName != "" && ordererOrg .CANamespace != "" {
830
831
certAuth , err := helpers .GetCertAuthByName (
831
832
clientSet ,
@@ -854,7 +855,20 @@ func (r *FabricMainChannelReconciler) mapToConfigTX(channel *hlfv1alpha1.FabricM
854
855
return configtx.Channel {}, err
855
856
}
856
857
}
857
- ordererOrgs = append (ordererOrgs , r .mapOrdererOrg (ordererOrg .MSPID , ordererOrg .OrdererEndpoints , caCert , tlsCACert ))
858
+
859
+ // Parse revocation list if provided
860
+ revocationList := []* pkix.CertificateList {}
861
+ if len (ordererOrg .RevocationList ) > 0 {
862
+ for _ , revocation := range ordererOrg .RevocationList {
863
+ crl , err := utils .ParseCRL ([]byte (revocation ))
864
+ if err != nil {
865
+ return configtx.Channel {}, errors .Wrapf (err , "failed to parse revocation list for orderer org %s" , ordererOrg .MSPID )
866
+ }
867
+ revocationList = append (revocationList , crl )
868
+ }
869
+ }
870
+
871
+ ordererOrgs = append (ordererOrgs , r .mapOrdererOrg (ordererOrg .MSPID , ordererOrg .OrdererEndpoints , caCert , tlsCACert , revocationList ))
858
872
}
859
873
for _ , ordererOrg := range channel .Spec .ExternalOrdererOrganizations {
860
874
tlsCACert , err := utils .ParseX509Certificate ([]byte (ordererOrg .TLSRootCert ))
@@ -865,7 +879,15 @@ func (r *FabricMainChannelReconciler) mapToConfigTX(channel *hlfv1alpha1.FabricM
865
879
if err != nil {
866
880
return configtx.Channel {}, err
867
881
}
868
- ordererOrgs = append (ordererOrgs , r .mapOrdererOrg (ordererOrg .MSPID , ordererOrg .OrdererEndpoints , caCert , tlsCACert ))
882
+ revocationList := []* pkix.CertificateList {}
883
+ for _ , revocation := range ordererOrg .RevocationList {
884
+ crl , err := utils .ParseCRL ([]byte (revocation ))
885
+ if err != nil {
886
+ return configtx.Channel {}, err
887
+ }
888
+ revocationList = append (revocationList , crl )
889
+ }
890
+ ordererOrgs = append (ordererOrgs , r .mapOrdererOrg (ordererOrg .MSPID , ordererOrg .OrdererEndpoints , caCert , tlsCACert , revocationList ))
869
891
}
870
892
etcdRaftOptions := orderer.EtcdRaftOptions {
871
893
TickInterval : "500ms" ,
@@ -1160,7 +1182,8 @@ func (r *FabricMainChannelReconciler) mapPolicy(
1160
1182
}
1161
1183
return policiesMap
1162
1184
}
1163
- func (r * FabricMainChannelReconciler ) mapOrdererOrg (mspID string , ordererEndpoints []string , caCert * x509.Certificate , tlsCACert * x509.Certificate ) configtx.Organization {
1185
+
1186
+ func (r * FabricMainChannelReconciler ) mapOrdererOrg (mspID string , ordererEndpoints []string , caCert * x509.Certificate , tlsCACert * x509.Certificate , revocationList []* pkix.CertificateList ) configtx.Organization {
1164
1187
return configtx.Organization {
1165
1188
Name : mspID ,
1166
1189
Policies : map [string ]configtx.Policy {
@@ -1206,7 +1229,7 @@ func (r *FabricMainChannelReconciler) mapOrdererOrg(mspID string, ordererEndpoin
1206
1229
},
1207
1230
Admins : []* x509.Certificate {},
1208
1231
IntermediateCerts : []* x509.Certificate {},
1209
- RevocationList : [] * pkix. CertificateList {} ,
1232
+ RevocationList : revocationList ,
1210
1233
OrganizationalUnitIdentifiers : []membership.OUIdentifier {},
1211
1234
CryptoConfig : membership.CryptoConfig {},
1212
1235
TLSIntermediateCerts : []* x509.Certificate {},
@@ -1336,13 +1359,14 @@ func updateApplicationChannelConfigTx(currentConfigTX configtx.ConfigTx, newConf
1336
1359
}
1337
1360
}
1338
1361
if ! found {
1339
- log .Infof ("Adding organization %s " , organization . Name )
1362
+ log .Infof ("Adding organization %v " , organization )
1340
1363
err = currentConfigTX .Application ().SetOrganization (organization )
1341
1364
if err != nil {
1342
1365
return errors .Wrapf (err , "failed to set organization %s" , organization .Name )
1343
1366
}
1344
1367
}
1345
1368
}
1369
+
1346
1370
err = currentConfigTX .Application ().SetPolicies (
1347
1371
newConfigTx .Application .Policies ,
1348
1372
)
@@ -1438,20 +1462,20 @@ func updateOrdererChannelConfigTx(currentConfigTX configtx.ConfigTx, newConfigTx
1438
1462
deleted := true
1439
1463
needsUpdate := false
1440
1464
var matchingNewConsenter orderer.Consenter
1441
-
1465
+
1442
1466
for _ , newConsenter := range newConfigTx .Orderer .EtcdRaft .Consenters {
1443
1467
if newConsenter .Address .Host == consenter .Address .Host && newConsenter .Address .Port == consenter .Address .Port {
1444
1468
deleted = false
1445
1469
matchingNewConsenter = newConsenter
1446
1470
// Check if TLS certs are different
1447
- if ! bytes .Equal (newConsenter .ClientTLSCert .Raw , consenter .ClientTLSCert .Raw ) ||
1448
- ! bytes .Equal (newConsenter .ServerTLSCert .Raw , consenter .ServerTLSCert .Raw ) {
1471
+ if ! bytes .Equal (newConsenter .ClientTLSCert .Raw , consenter .ClientTLSCert .Raw ) ||
1472
+ ! bytes .Equal (newConsenter .ServerTLSCert .Raw , consenter .ServerTLSCert .Raw ) {
1449
1473
needsUpdate = true
1450
1474
}
1451
1475
break
1452
1476
}
1453
1477
}
1454
-
1478
+
1455
1479
if deleted {
1456
1480
log .Infof ("Removing consenter %s:%d" , consenter .Address .Host , consenter .Address .Port )
1457
1481
err = currentConfigTX .Orderer ().RemoveConsenter (consenter )
@@ -1645,6 +1669,12 @@ func updateOrdererChannelConfigTx(currentConfigTX configtx.ConfigTx, newConfigTx
1645
1669
return errors .Wrapf (err , "failed to add endpoint %s" , endpoint )
1646
1670
}
1647
1671
}
1672
+
1673
+ ordConfig .MSP .RevocationList = organization .MSP .RevocationList
1674
+ err = currentConfigTX .Orderer ().Organization (organization .Name ).SetMSP (ordConfig .MSP )
1675
+ if err != nil {
1676
+ return errors .Wrapf (err , "failed to set organization %s" , organization .Name )
1677
+ }
1648
1678
} else {
1649
1679
log .Infof ("Adding organization %s" , organization .Name )
1650
1680
err = currentConfigTX .Orderer ().SetOrganization (organization )
0 commit comments