Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Intermediate CA certs to dial options #3225

Merged
merged 1 commit into from
Feb 11, 2022

Conversation

andrew-coleman
Copy link
Member

The gateway was omitting to include TLS intermediate certificates in the dial options when connecting to other nodes.
This commit appends them to the splice of root certs in the endpoint config.

Resolves #3224

Signed-off-by: andrew-coleman andrew_coleman@uk.ibm.com

@andrew-coleman andrew-coleman requested a review from a team as a code owner February 11, 2022 11:22
@@ -353,7 +353,7 @@ func (reg *registry) connectChannelPeers(channel string, force bool) error {
for mspid, infoset := range reg.discovery.IdentityInfo().ByOrg() {
var tlsRootCerts [][]byte
if mspInfo, ok := config.GetMsps()[mspid]; ok {
tlsRootCerts = mspInfo.GetTlsRootCerts()
tlsRootCerts = append(mspInfo.GetTlsRootCerts(), mspInfo.GetTlsIntermediateCerts()...)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

concatenating slices in this way may alter the root cert slice.

Let's do it in the right way by having the left most slice a nil slice.

@@ -121,6 +121,8 @@ func TestStaleMultiChannelOrdererConnections(t *testing.T) {
func buildConfig(t *testing.T, orderers []string) *dp.ConfigResult {
ca, err := tlsgen.NewCA()
require.NoError(t, err)
ica, err := ca.NewIntermediateCA()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this doesn't test the change in line 424

The gateway was omitting to include TLS intermediate certificates in the dial options when connecting to other nodes.
This commit appends them to the splice of root certs in the endpoint config.

Signed-off-by: andrew-coleman <andrew_coleman@uk.ibm.com>
@yacovm yacovm enabled auto-merge (squash) February 11, 2022 15:13
@yacovm yacovm merged commit 7b7b6e9 into hyperledger:main Feb 11, 2022
@andrew-coleman andrew-coleman deleted the issue3224 branch February 11, 2022 16:03
@denyeart
Copy link
Contributor

@Mergifyio backport release-2.4

@mergify
Copy link

mergify bot commented Feb 11, 2022

backport release-2.4

✅ Backports have been created

mergify bot pushed a commit that referenced this pull request Feb 11, 2022
The gateway was omitting to include TLS intermediate certificates in the dial options when connecting to other nodes.
This commit appends them to the splice of root certs in the endpoint config.

Signed-off-by: andrew-coleman <andrew_coleman@uk.ibm.com>
(cherry picked from commit 7b7b6e9)
yacovm pushed a commit that referenced this pull request Feb 11, 2022
The gateway was omitting to include TLS intermediate certificates in the dial options when connecting to other nodes.
This commit appends them to the splice of root certs in the endpoint config.

Signed-off-by: andrew-coleman <andrew_coleman@uk.ibm.com>
(cherry picked from commit 7b7b6e9)

Co-authored-by: Andrew Coleman <andrew_coleman@uk.ibm.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Fabric Gateway not taking intermediate certificate into account
3 participants