@@ -826,6 +826,7 @@ func (r *FabricMainChannelReconciler) mapToConfigTX(channel *hlfv1alpha1.FabricM
826826 for _ , ordererOrg := range channel .Spec .OrdererOrganizations {
827827 var tlsCACert * x509.Certificate
828828 var caCert * x509.Certificate
829+
829830 if ordererOrg .CAName != "" && ordererOrg .CANamespace != "" {
830831 certAuth , err := helpers .GetCertAuthByName (
831832 clientSet ,
@@ -854,7 +855,20 @@ func (r *FabricMainChannelReconciler) mapToConfigTX(channel *hlfv1alpha1.FabricM
854855 return configtx.Channel {}, err
855856 }
856857 }
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 ))
858872 }
859873 for _ , ordererOrg := range channel .Spec .ExternalOrdererOrganizations {
860874 tlsCACert , err := utils .ParseX509Certificate ([]byte (ordererOrg .TLSRootCert ))
@@ -865,7 +879,15 @@ func (r *FabricMainChannelReconciler) mapToConfigTX(channel *hlfv1alpha1.FabricM
865879 if err != nil {
866880 return configtx.Channel {}, err
867881 }
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 ))
869891 }
870892 etcdRaftOptions := orderer.EtcdRaftOptions {
871893 TickInterval : "500ms" ,
@@ -1160,7 +1182,8 @@ func (r *FabricMainChannelReconciler) mapPolicy(
11601182 }
11611183 return policiesMap
11621184}
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 {
11641187 return configtx.Organization {
11651188 Name : mspID ,
11661189 Policies : map [string ]configtx.Policy {
@@ -1206,7 +1229,7 @@ func (r *FabricMainChannelReconciler) mapOrdererOrg(mspID string, ordererEndpoin
12061229 },
12071230 Admins : []* x509.Certificate {},
12081231 IntermediateCerts : []* x509.Certificate {},
1209- RevocationList : [] * pkix. CertificateList {} ,
1232+ RevocationList : revocationList ,
12101233 OrganizationalUnitIdentifiers : []membership.OUIdentifier {},
12111234 CryptoConfig : membership.CryptoConfig {},
12121235 TLSIntermediateCerts : []* x509.Certificate {},
@@ -1336,13 +1359,14 @@ func updateApplicationChannelConfigTx(currentConfigTX configtx.ConfigTx, newConf
13361359 }
13371360 }
13381361 if ! found {
1339- log .Infof ("Adding organization %s " , organization . Name )
1362+ log .Infof ("Adding organization %v " , organization )
13401363 err = currentConfigTX .Application ().SetOrganization (organization )
13411364 if err != nil {
13421365 return errors .Wrapf (err , "failed to set organization %s" , organization .Name )
13431366 }
13441367 }
13451368 }
1369+
13461370 err = currentConfigTX .Application ().SetPolicies (
13471371 newConfigTx .Application .Policies ,
13481372 )
@@ -1438,20 +1462,20 @@ func updateOrdererChannelConfigTx(currentConfigTX configtx.ConfigTx, newConfigTx
14381462 deleted := true
14391463 needsUpdate := false
14401464 var matchingNewConsenter orderer.Consenter
1441-
1465+
14421466 for _ , newConsenter := range newConfigTx .Orderer .EtcdRaft .Consenters {
14431467 if newConsenter .Address .Host == consenter .Address .Host && newConsenter .Address .Port == consenter .Address .Port {
14441468 deleted = false
14451469 matchingNewConsenter = newConsenter
14461470 // 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 ) {
14491473 needsUpdate = true
14501474 }
14511475 break
14521476 }
14531477 }
1454-
1478+
14551479 if deleted {
14561480 log .Infof ("Removing consenter %s:%d" , consenter .Address .Host , consenter .Address .Port )
14571481 err = currentConfigTX .Orderer ().RemoveConsenter (consenter )
@@ -1645,6 +1669,12 @@ func updateOrdererChannelConfigTx(currentConfigTX configtx.ConfigTx, newConfigTx
16451669 return errors .Wrapf (err , "failed to add endpoint %s" , endpoint )
16461670 }
16471671 }
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+ }
16481678 } else {
16491679 log .Infof ("Adding organization %s" , organization .Name )
16501680 err = currentConfigTX .Orderer ().SetOrganization (organization )
0 commit comments