You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/guides/server/db.adoc
+254Lines changed: 254 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -439,6 +439,260 @@ The `transaction-default-timeout` option takes precedence over the unsupported `
439
439
If you are using the Quarkus property, migrate to the supported `transaction-default-timeout` option and remove the Quarkus property from your configuration.
440
440
====
441
441
442
+
== Secure the database connection
443
+
444
+
Encrypting the traffic between {project_name} and the database is recommended for increased security, as it prevents third parties from examining the network traffic.
445
+
446
+
It is recommended to go a step further and enable certificate verification to prevent more complex attacks such as DNS poisoning and address hijacking, whereby {project_name} could be directed to a different server than intended.
447
+
To perform the certificate validation, the database certificate, or the Certificate Authority (CA) certificate, must be added to the {project_name} truststore.
448
+
449
+
This section provides guidance on how to enable these settings in {project_name} and configure the JDBC driver properly.
450
+
Configuring the database server with the private keys and certificates is outside the scope of this section.
451
+
Consult your vendor documentation on how to do it.
452
+
453
+
=== Using {project_name} CLI options
454
+
455
+
{project_name} provides unified CLI options to configure database TLS settings across different database vendors.
456
+
These options simplify the configuration by abstracting vendor-specific JDBC properties and providing a consistent interface.
457
+
458
+
The following options are available:
459
+
460
+
`db-tls-mode`::
461
+
Sets the TLS mode for the database connection.
462
+
Valid values are `disabled` and `verify-server`.
463
+
When set to `verify-server`, it enables encryption and server identity verification.
464
+
Default: `disabled`
465
+
466
+
`db-tls-trust-store-file`::
467
+
The path to the truststore file containing the database server certificates or Certificate Authority (CA) certificates used to verify the database server's identity.
468
+
469
+
`db-tls-trust-store-password`::
470
+
The password to access the truststore file (if required and supported by the JDBC driver).
471
+
472
+
`db-tls-trust-store-type`::
473
+
The type of the truststore file.
474
+
Common values include `JKS` (Java KeyStore) and `PKCS12`.
475
+
If not specified, the driver's default truststore type is used.
476
+
477
+
NOTE: These unified CLI options are the recommended approach for configuring database TLS.
478
+
{project_name} automatically translates these options to the appropriate vendor-specific JDBC properties.
479
+
480
+
The following example demonstrates how to configure database TLS using these options for a PostgreSQL database.
Alternatively, instead of using the Java truststore with `--truststore-paths`, you can configure each database driver to use its own certificate file or truststore directly through JDBC properties.
575
+
This approach is useful when you want to keep database certificates separate from the Java truststore.
576
+
577
+
==== PostgreSQL
578
+
579
+
PostgreSQL supports specifying the certificate file directly using the `sslrootcert` property.
580
+
581
+
[%autowidth]
582
+
|===
583
+
|JDBC Property |Value | Description
584
+
585
+
m|sslmode
586
+
m|verify-full
587
+
|Encrypts the network traffic and validates the server identity.
588
+
589
+
m|sslrootcert
590
+
m|/path/to/cert.pem
591
+
|The path to the server's certificate file on the client machine.
.description("Sets the TLS mode for the database connection. If disabled, it uses the driver's default value. When set to verify-server, it enables encryption and server identity verification. The database server certificate or Certificate Authority (CA) certificate is required.")
.description("The path to the truststore file containing the database server certificates or Certificate Authority (CA) certificates used to verify the database server's identity.")
.description("The type of the truststore file. Common values include 'JKS' (Java KeyStore) and 'PKCS12'. If not specified, it uses the driver's default.")
145
+
.build();
146
+
147
+
// TLS hidden options, per vendor, to configure TLS in the driver
0 commit comments