lee
lee

Reputation: 1

Error: Failed to get client TLS config: Error parsing certificate: x509: malformed serial number

I've set up a network using fabric-sample version 2.4.7. While there's an option to back up and restore, I'm currently working on renewing expired certificates, including the CA server's, which is valid until 2038.

The file structure under fabric-samples/test-network is as follows:

.
├── addOrg3
│   ├── addOrg3.sh
│   ├── ccp-generate.sh
│   ├── ccp-template.json
│   ├── ccp-template.yaml
│   ├── compose
│   │   ├── compose-ca-org3.yaml
│   │   ├── compose-couch-org3.yaml
│   │   ├── compose-org3.yaml
│   │   ├── docker
│   │   │   ├── docker-compose-ca-org3.yaml
│   │   │   ├── docker-compose-couch-org3.yaml
│   │   │   ├── docker-compose-org3.yaml
│   │   │   └── peercfg
│   │   │       └── core.yaml
│   │   └── podman
│   │       ├── peercfg
│   │       │   └── core.yaml
│   │       ├── podman-compose-ca-org3.yaml
│   │       ├── podman-compose-couch-org3.yaml
│   │       └── podman-compose-org3.yaml
│   ├── configtx.yaml
│   ├── fabric-ca
│   │   ├── org3
│   │   │   └── fabric-ca-server-config.yaml
│   │   └── registerEnroll.sh
│   ├── org3-crypto.yaml
│   └── README.md
├── CHAINCODE_AS_A_SERVICE_TUTORIAL.md
├── channel-artifacts
│   └── mychannel.block
├── compose
│   ├── compose-ca.yaml
│   ├── compose-couch.yaml
│   ├── compose-test-net.yaml
│   ├── docker
│   │   ├── docker-compose-ca.yaml
│   │   ├── docker-compose-couch.yaml
│   │   ├── docker-compose-test-net.yaml
│   │   └── peercfg
│   │       └── core.yaml
│   └── podman
│       ├── peercfg
│       │   └── core.yaml
│       ├── podman-compose-ca.yaml
│       ├── podman-compose-couch.yaml
│       └── podman-compose-test-net.yaml
├── configtx
│   └── configtx.yaml
├── log.txt
├── monitordocker.sh
├── network.sh
├── organizations
│   ├── ccp-generate.sh
│   ├── ccp-template.json
│   ├── ccp-template.yaml
│   ├── cryptogen
│   │   ├── crypto-config-orderer.yaml
│   │   ├── crypto-config-org1.yaml
│   │   └── crypto-config-org2.yaml
│   ├── fabric-ca
│   │   ├── ordererOrg
│   │   │   ├── ca-cert.pem
│   │   │   ├── fabric-ca-server-config.yaml
│   │   │   ├── fabric-ca-server.db
│   │   │   ├── IssuerPublicKey
│   │   │   ├── IssuerRevocationPublicKey
│   │   │   ├── msp
│   │   │   │   ├── cacerts
│   │   │   │   ├── keystore
│   │   │   │   │   ├── 5426863bbccebb6b08cefc3a43047fbdee53b73cd1e87174048408e764d5f7e0_sk
│   │   │   │   │   ├── 73ffab787b393c074b22ed28d6fb43339d8cbcfc1886ad46c885cbaec47f457f_sk
│   │   │   │   │   ├── IssuerRevocationPrivateKey
│   │   │   │   │   └── IssuerSecretKey
│   │   │   │   ├── signcerts
│   │   │   │   └── user
│   │   │   └── tls-cert.pem
│   │   ├── org1
│   │   │   ├── ca-cert.pem
│   │   │   ├── fabric-ca-server-config.yaml
│   │   │   ├── fabric-ca-server.db
│   │   │   ├── IssuerPublicKey
│   │   │   ├── IssuerRevocationPublicKey
│   │   │   ├── msp
│   │   │   │   ├── cacerts
│   │   │   │   ├── keystore
│   │   │   │   │   ├── 64a9b677ae1eee862dc15ec66d26102dae71f3e1234070c0356eedba8b86330f_sk
│   │   │   │   │   ├── 8421bfa64531fb5f23a08b8b2dc81e4087dcb89c3c5ad14eb8abe5dc9c8c58f1_sk
│   │   │   │   │   ├── IssuerRevocationPrivateKey
│   │   │   │   │   └── IssuerSecretKey
│   │   │   │   ├── signcerts
│   │   │   │   └── user
│   │   │   └── tls-cert.pem
│   │   ├── org2
│   │   │   ├── ca-cert.pem
│   │   │   ├── fabric-ca-server-config.yaml
│   │   │   ├── fabric-ca-server.db
│   │   │   ├── IssuerPublicKey
│   │   │   ├── IssuerRevocationPublicKey
│   │   │   ├── msp
│   │   │   │   ├── cacerts
│   │   │   │   ├── keystore
│   │   │   │   │   ├── 44adcf2ac237f6131fd16d399e58d71eb0a5463fcd2dabeb654c8a62c6361983_sk
│   │   │   │   │   ├── f6a3f5873a6f83457f7bc92c89bb7cdad4bae30bb70c0c8737137d70cb679514_sk
│   │   │   │   │   ├── IssuerRevocationPrivateKey
│   │   │   │   │   └── IssuerSecretKey
│   │   │   │   ├── signcerts
│   │   │   │   └── user
│   │   │   └── tls-cert.pem
│   │   └── registerEnroll.sh
│   ├── ordererOrganizations
│   │   └── example.com
│   │       ├── fabric-ca-client-config.yaml
│   │       ├── msp
│   │       │   ├── cacerts
│   │       │   │   └── localhost-9054-ca-orderer.pem
│   │       │   ├── config.yaml
│   │       │   ├── IssuerPublicKey
│   │       │   ├── IssuerRevocationPublicKey
│   │       │   ├── keystore
│   │       │   │   └── 0c2865fb343a35f0ce590c8ba31bd8d1b99132d2c2ed28c0447dbf5ed5d69146_sk
│   │       │   ├── signcerts
│   │       │   │   └── cert.pem
│   │       │   ├── tlscacerts
│   │       │   │   └── tlsca.example.com-cert.pem
│   │       │   └── user
│   │       ├── orderers
│   │       │   └── orderer.example.com
│   │       │       ├── msp
│   │       │       │   ├── cacerts
│   │       │       │   │   └── localhost-9054-ca-orderer.pem
│   │       │       │   ├── config.yaml
│   │       │       │   ├── IssuerPublicKey
│   │       │       │   ├── IssuerRevocationPublicKey
│   │       │       │   ├── keystore
│   │       │       │   │   └── d0721907ac59a54643622eb348363794820a1b73bf995427fef1e609b5903364_sk
│   │       │       │   ├── signcerts
│   │       │       │   │   └── cert.pem
│   │       │       │   ├── tlscacerts
│   │       │       │   │   └── tlsca.example.com-cert.pem
│   │       │       │   └── user
│   │       │       └── tls
│   │       │           ├── cacerts
│   │       │           ├── ca.crt
│   │       │           ├── IssuerPublicKey
│   │       │           ├── IssuerRevocationPublicKey
│   │       │           ├── keystore
│   │       │           │   └── 381e5dcdc34a21f787f3c64b765aaef21649754f5994fe11e9a0eefb7feb7075_sk
│   │       │           ├── server.crt
│   │       │           ├── server.key
│   │       │           ├── signcerts
│   │       │           │   └── cert.pem
│   │       │           ├── tlscacerts
│   │       │           │   └── tls-localhost-9054-ca-orderer.pem
│   │       │           └── user
│   │       ├── tlsca
│   │       │   └── tlsca.example.com-cert.pem
│   │       └── users
│   │           └── [email protected]
│   │               └── msp
│   │                   ├── cacerts
│   │                   │   └── localhost-9054-ca-orderer.pem
│   │                   ├── config.yaml
│   │                   ├── IssuerPublicKey
│   │                   ├── IssuerRevocationPublicKey
│   │                   ├── keystore
│   │                   │   └── 0a961a320b1ed03d4f2359e5360dd8f0b8ccb9f8d0c92f8a74479c6694253bd5_sk
│   │                   ├── signcerts
│   │                   │   └── cert.pem
│   │                   └── user
│   └── peerOrganizations
│       ├── org1.example.com
│       │   ├── ca
│       │   │   └── ca.org1.example.com-cert.pem
│       │   ├── connection-org1.json
│       │   ├── connection-org1.yaml
│       │   ├── fabric-ca-client-config.yaml
│       │   ├── msp
│       │   │   ├── cacerts
│       │   │   │   └── localhost-7054-ca-org1.pem
│       │   │   ├── config.yaml
│       │   │   ├── IssuerPublicKey
│       │   │   ├── IssuerRevocationPublicKey
│       │   │   ├── keystore
│       │   │   │   └── 1a4479573719162b553dda1747697393ff7d63495c4d4f60497321b75b8ec2d7_sk
│       │   │   ├── signcerts
│       │   │   │   └── cert.pem
│       │   │   ├── tlscacerts
│       │   │   │   └── ca.crt
│       │   │   └── user
│       │   ├── peers
│       │   │   └── peer0.org1.example.com
│       │   │       ├── msp
│       │   │       │   ├── cacerts
│       │   │       │   │   └── localhost-7054-ca-org1.pem
│       │   │       │   ├── config.yaml
│       │   │       │   ├── IssuerPublicKey
│       │   │       │   ├── IssuerRevocationPublicKey
│       │   │       │   ├── keystore
│       │   │       │   │   └── 5d856ad27b8521f5951db8c52e70b922c2204f8d8bb1f1307b8e9ac6748248f8_sk
│       │   │       │   ├── signcerts
│       │   │       │   │   └── cert.pem
│       │   │       │   └── user
│       │   │       └── tls
│       │   │           ├── cacerts
│       │   │           ├── ca.crt
│       │   │           ├── IssuerPublicKey
│       │   │           ├── IssuerRevocationPublicKey
│       │   │           ├── keystore
│       │   │           │   └── e9b73945c6248aee71fb6697628df193fb75a174cb602baf75ac266d3ce87e29_sk
│       │   │           ├── server.crt
│       │   │           ├── server.key
│       │   │           ├── signcerts
│       │   │           │   └── cert.pem
│       │   │           ├── tlscacerts
│       │   │           │   └── tls-localhost-7054-ca-org1.pem
│       │   │           └── user
│       │   ├── tlsca
│       │   │   └── tlsca.org1.example.com-cert.pem
│       │   └── users
│       │       ├── [email protected]
│       │       │   └── msp
│       │       │       ├── cacerts
│       │       │       │   └── localhost-7054-ca-org1.pem
│       │       │       ├── config.yaml
│       │       │       ├── IssuerPublicKey
│       │       │       ├── IssuerRevocationPublicKey
│       │       │       ├── keystore
│       │       │       │   └── 443b651278d37340d0b006551ad54f02ecb02ecbc8aaba4ad12cf9d7dcd2c08a_sk
│       │       │       ├── signcerts
│       │       │       │   └── cert.pem
│       │       │       └── user
│       │       └── [email protected]
│       │           └── msp
│       │               ├── cacerts
│       │               │   └── localhost-7054-ca-org1.pem
│       │               ├── config.yaml
│       │               ├── IssuerPublicKey
│       │               ├── IssuerRevocationPublicKey
│       │               ├── keystore
│       │               │   └── 4b9f42d4e2ed58d14decb49731df801f9eb493398a73521d9c2097d0f1621b45_sk
│       │               ├── signcerts
│       │               │   └── cert.pem
│       │               └── user
│       └── org2.example.com
│           ├── ca
│           │   └── ca.org2.example.com-cert.pem
│           ├── connection-org2.json
│           ├── connection-org2.yaml
│           ├── fabric-ca-client-config.yaml
│           ├── msp
│           │   ├── cacerts
│           │   │   └── localhost-8054-ca-org2.pem
│           │   ├── config.yaml
│           │   ├── IssuerPublicKey
│           │   ├── IssuerRevocationPublicKey
│           │   ├── keystore
│           │   │   └── 26f2fab85ee99fd2673b27f37b34ee1dc5066ebb6a4a19e822547f7cbba3085a_sk
│           │   ├── signcerts
│           │   │   └── cert.pem
│           │   ├── tlscacerts
│           │   │   └── ca.crt
│           │   └── user
│           ├── peers
│           │   └── peer0.org2.example.com
│           │       ├── msp
│           │       │   ├── cacerts
│           │       │   │   └── localhost-8054-ca-org2.pem
│           │       │   ├── config.yaml
│           │       │   ├── IssuerPublicKey
│           │       │   ├── IssuerRevocationPublicKey
│           │       │   ├── keystore
│           │       │   │   └── c18f2038a9ca32aaabc55d7a2e86d7eb73a31b158645b64c40944ffd01f5d330_sk
│           │       │   ├── signcerts
│           │       │   │   └── cert.pem
│           │       │   └── user
│           │       └── tls
│           │           ├── cacerts
│           │           ├── ca.crt
│           │           ├── IssuerPublicKey
│           │           ├── IssuerRevocationPublicKey
│           │           ├── keystore
│           │           │   └── 67d8b4c64097b7b1ea71856b36d19992cd784722be2f26ab4c9c9f03f78dbcba_sk
│           │           ├── server.crt
│           │           ├── server.key
│           │           ├── signcerts
│           │           │   └── cert.pem
│           │           ├── tlscacerts
│           │           │   └── tls-localhost-8054-ca-org2.pem
│           │           └── user
│           ├── tlsca
│           │   └── tlsca.org2.example.com-cert.pem
│           └── users
│               ├── [email protected]
│               │   └── msp
│               │       ├── cacerts
│               │       │   └── localhost-8054-ca-org2.pem
│               │       ├── config.yaml
│               │       ├── IssuerPublicKey
│               │       ├── IssuerRevocationPublicKey
│               │       ├── keystore
│               │       │   └── f616fab4ecbc54ef13442244d5fcecf4f5302e2e794d49975135233e71b63550_sk
│               │       ├── signcerts
│               │       │   └── cert.pem
│               │       └── user
│               └── [email protected]
│                   └── msp
│                       ├── cacerts
│                       │   └── localhost-8054-ca-org2.pem
│                       ├── config.yaml
│                       ├── IssuerPublicKey
│                       ├── IssuerRevocationPublicKey
│                       ├── keystore
│                       │   └── ffb9eeaad271313f9b1586eda25eac35fe804d2acf839bb2b9c4f88698691e21_sk
│                       ├── signcerts
│                       │   └── cert.pem
│                       └── user
├── prometheus-grafana
│   ├── docker-compose.yaml
│   ├── grafana
│   │   ├── config.monitoring
│   │   └── provisioning
│   │       ├── dashboards
│   │       │   ├── dashboard.yml
│   │       │   └── hlf-performances.json
│   │       └── datasources
│   │           └── datasource.yml
│   ├── grafana_db
│   │   └── grafana.db
│   ├── prometheus
│   │   └── prometheus.yml
│   └── README.md
├── README.md
├── scripts
│   ├── ccutils.sh
│   ├── configUpdate.sh
│   ├── createChannel.sh
│   ├── deployCCAAS.sh
│   ├── deployCC.sh
│   ├── envVar.sh
│   ├── org3-scripts
│   │   ├── joinChannel.sh
│   │   └── updateChannelConfig.sh
│   ├── pkgcc.sh
│   ├── setAnchorPeer.sh
│   └── utils.sh
├── setOrgEnv.sh
└── system-genesis-block

147 directories, 202 files

The Docker setup I've been working with is as follows:

CONTAINER ID   IMAGE                               COMMAND                  CREATED         STATUS                      PORTS                                                                                                NAMES
1f7a14254111   hyperledger/fabric-tools:latest     "/bin/bash"              12 months ago   Exited (137) 4 weeks ago                                                                                                         cli
d038bacb111   hyperledger/fabric-peer:latest      "peer node start"        12 months ago   Exited (1) 46 seconds ago                                                                                                        peer0.org1.example.com
8549a1564111d   hyperledger/fabric-peer:latest      "peer node start"        12 months ago   Exited (0) 4 weeks ago                                                                                                           peer0.org2.example.com
a1edccd9111   couchdb:3.1.1                       "tini -- /docker-ent…"   12 months ago   Exited (0) 4 weeks ago                                                                                                           couchdb0
8f565236111c   hyperledger/fabric-orderer:latest   "orderer"                12 months ago   Exited (0) 4 weeks ago                                                                                                           orderer.example.com
aec0812a1112   couchdb:3.1.1                       "tini -- /docker-ent…"   12 months ago   Exited (0) 4 weeks ago                                                                                                           couchdb1
fcb349a5111c   hyperledger/fabric-ca:latest        "sh -c 'fabric-ca-se…"   12 months ago   Up 34 minutes               0.0.0.0:9054->9054/tcp, :::9054->9054/tcp, 7054/tcp, 0.0.0.0:19054->19054/tcp, :::19054->19054/tcp   ca_orderer
75b8c8f282e4   hyperledger/fabric-ca:latest        "sh -c 'fabric-ca-se…"   12 months ago   Exited (2) 4 weeks ago                                                                                                           ca_org1
b21071ec7f7b   hyperledger/fabric-ca:latest        "sh -c 'fabric-ca-se…"   12 months ago   Exited (2) 4 weeks ago

When I try to run peer0.org1.example.com, peer0.org2.example.com, and orderer.example.com, the certificates are expired, so they won't run.

2024-02-22 09:57:48.515 UTC 0001 ERRO [main] InitCmd -> Cannot run peer because error when setting up MSP of type bccsp from directory /etc/hyperledger/fabric/msp: signing identity expired 319h35m48.515285305s ago

How can we renew the certificates in fabric-sample to utilize existing data? I'd like to hear multiple opinions.

In the fabric-ca-client-config.yaml file located at fabric-samples/test-network/organizations/ordererOrganizations/example.com directory, I've modified the following section:

tls:
  # TLS section for secure socket connection
  certfiles: ../../fabric-ca/ordererOrg/ca-cert.pem
  client:
    certfile: users/[email protected]/msp/cacerts/localhost-9054-ca-orderer.pem
    keyfile: users/[email protected]/msp/keystore/0a961a320b1ed03d4f2359e5360dd8f0b8ccb9f8d0c92f8a74479c669

4253bd5_sk

The certificate at fabric-ca/ordererOrg/ca-cert.pem is valid until 2038, as confirmed by the command.

When I execute the command: fabric-ca-client enroll -u https://admin:adminpw@localhost:9054 -M msp --tls.certfiles ../../fabric-ca/ordererOrg/ca-cert.pem --enrollment.profile tls --id.name admin --id.secret adminpw

I encounter the following error: the following error occurs: Error: Failed to get client TLS config: Error parsing certificate: x509: malformed serial number.

Upvotes: 0

Views: 224

Answers (0)

Related Questions