Skip to content

Enable TLS for Fabric-X Committer Container#1298

Open
Rozerxshashank wants to merge 1 commit intohyperledger-labs:mainfrom
Rozerxshashank:issue-1295-fabricx-tls
Open

Enable TLS for Fabric-X Committer Container#1298
Rozerxshashank wants to merge 1 commit intohyperledger-labs:mainfrom
Rozerxshashank:issue-1295-fabricx-tls

Conversation

@Rozerxshashank
Copy link
Copy Markdown
Contributor

Closes: #1295

Description

This PR enables TLS for the Fabric-X committer all-in-one test container. It ensures secure communication between the sidecar, the orderer, and the query services by removing the insecure default settings.

Key Changes

  • Security: Removed the --insecure flag from the committer container command.
  • Configuration: Updated sidecar environment variables to utilize TLS certificates from the crypto artifacts.
  • Dynamic Integration: Updated DeployNamespace and tryListInstalledNames to respect the network's TLSEnabled status.

@Rozerxshashank Rozerxshashank force-pushed the issue-1295-fabricx-tls branch from 633cb16 to 3b7e431 Compare April 24, 2026 15:30
@mbrandenburger mbrandenburger self-assigned this Apr 24, 2026
@mbrandenburger mbrandenburger added Fabric-x NWO All about our testing infrastructure labels Apr 24, 2026
@mbrandenburger mbrandenburger added this to the 26Q2 milestone Apr 24, 2026
@mbrandenburger mbrandenburger self-requested a review April 24, 2026 19:23
Copy link
Copy Markdown
Member

@mbrandenburger mbrandenburger left a comment

Choose a reason for hiding this comment

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

Thank you @Rozerxshashank for your PR! This is a solid start.

Please check integration/nwo/fabricx/topology.go:30 - where we currently disable TLS for fabricx topos - that needs to be removed in order to see if your proposed changes work :D

A few more comments below.

}
if tlsEnabled {
env = append(env,
"SC_SIDECAR_ORDERER_TLS_MODE=tls",
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

we could even try mtls mode here.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Note that this configures the "orderer client" of the sidecar. In addition to that, we need tls configuration for the mock orderer, the the query service using the crypto material we inject into the container.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Updated SC_SIDECAR_ORDERER_TLS_MODE to mtls in the latest commit.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Understood. Removing the --insecure flag now correctly triggers the use of the injected crypto material for all container components, ensuring the entire setup is consistent with the network's TLS settings

Comment on lines -16 to +20
var ContainerCmd = []string{"run", "db", "orderer", "committer", "--insecure"}
var ContainerCmd = []string{"run", "db", "orderer", "committer"}
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Note that by removing --insecure you enable mtls for every component in the committer image. See here https://github.com/hyperledger/fabric-x-committer/blob/main/docker/images/test_node/run#L12

However, I believe for our tests it is only relevant that the components that are exposed to FSC MUST enabled TLS. All other communication between committer components can be insecure for our testing purpose.

If we remove --insecure, by default the built-in crypto material in the container is used to configure TLS; we need to carefully wire the things together; that is ... every component that is exposed to FSC need to use crypto material we inject into the container; all other components can be either insecure - or use the built-in material (if that is possible).

WDYT?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I've implemented conditional logic for the --insecure flag. It's now only added if TLS is disabled globally in the network topology. When TLSEnabled is true, we remove the flag to ensure all exposed components use the injected crypto material, aligning the sidecar with the rest of the FSC environment.

peerTLSDir := peerDockerTLSDir(e.network, scPeer)
ordererTLSCACert := path.Join("/", "root", "artifacts", "crypto", "ordererOrganizations", e.network.OrdererOrgs()[0].Domain, "orderers", fmt.Sprintf("%s.%s", e.network.Orderers[0].Name, e.network.OrdererOrgs()[0].Domain), "tls", "ca.crt")

containerEnvOverride := envVars[committerVersion](peerMSPDir, peerTLSDir, scMSPID, e.channel.Name, ordererEndpoint, e.network.TLSEnabled, ordererTLSCACert)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I know it was misleading already before, this is the chance we fix the bad naming. We should use scMSPID, scMSPDir, and scTLSDir as all belongs to the committer.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Renamed peerMSPDir to scMSPDir and peerTLSDir to scTLSDir across the scv2 and v3 extensions to clarify that they belong to the sidecar committer. I've also updated the ContainerEnvVars signature accordingly. :D

Comment on lines +20 to +21
return filepath.Join(
return path.Join(
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Why not using filepath?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I initially used path.Join because these paths are used inside the Linux container (where forward slashes are required). However, I've switched them back to filepath.Join to maintain consistency with the rest of the project. Fixed in the latest commit.

@Rozerxshashank Rozerxshashank force-pushed the issue-1295-fabricx-tls branch 14 times, most recently from 40639ad to 3b7e431 Compare April 24, 2026 23:44
… tests

Signed-off-by: Shashank <yshashank959@gmail.com>
@Rozerxshashank Rozerxshashank force-pushed the issue-1295-fabricx-tls branch from 3b7e431 to b7ac71f Compare April 25, 2026 00:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Fabric-x NWO All about our testing infrastructure

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fabric-x: enable TLS for committer-all-in-one test container

2 participants