Skip to content

Conversation

@dean-amar
Copy link
Contributor

@dean-amar dean-amar commented Oct 22, 2025

Type of change

  • New feature
  • Improvement (improvement to code, performance, etc)
  • Test update

Description

  • Add support for DB connection with TLS.
  • Add a secured database node creation (PostgreSQL or YugabyteDB).
  • Add file extensions to the TLS certificates.

Related issues

@dean-amar dean-amar added enhancement New feature or request security labels Oct 22, 2025
@dean-amar dean-amar marked this pull request as ready for review October 30, 2025 17:31
Signed-off-by: Dean Amar <[email protected]>
// is ready to accept connections.
// It repeatedly executes `pg_isready` until the command
// returns a successful exit code (0) or the timeout is reached.
func (dc *DatabaseContainer) EnsurePostgresNodeReadiness(t *testing.T, port string) {
Copy link
Contributor

Choose a reason for hiding this comment

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

YugabyteDB should support pg_isready

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It is, but not naturally. We need to export the path to its postgres tools. It's easier to monitor its readiness by its logs.

func (dc *DatabaseContainer) ReadPasswordFromContainer(t *testing.T, filePath string) string {
t.Helper()
output, exitCode := dc.ExecuteCommand(t, []string{"cat", filePath})
require.Zero(t, exitCode)
Copy link
Contributor

Choose a reason for hiding this comment

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

major: If the file doesn't exist, it fails the test.
But if it exists, and doesn't contain the password, it won't fail the tests.
This inconsistency is not justified.
Please fix or add a comment to justify this.

Copy link
Contributor Author

@dean-amar dean-amar Nov 10, 2025

Choose a reason for hiding this comment

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

We use this method only when a secured YugabyteDB node is started. If the file doesn’t exist, the test should fail. If the file exists but doesn’t contain a password, we fall back to the default password.

I'll add the above to the function's comment.

Copy link
Contributor

Choose a reason for hiding this comment

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

But if we try the default password for the secured test, it will not work, right? So, isn't it best to fail the test?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Actually, I’m not sure how the database behaves in that case, but for consistency, we’ll fail the test in this scenario as well.

@dean-amar dean-amar merged commit 2f40bb4 into hyperledger:main Nov 11, 2025
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request security

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Enable TLS Authentication for PostgreSQL Enable TLS Authentication for YugabyteDB

2 participants