gnodet-bot commented on code in PR #31051:
URL: https://github.com/apache/camel/pull/31051#discussion_r4723383525


##########
components/camel-pg-replication-slot/src/main/docs/pg-replication-slot-component.adoc:
##########
@@ -58,6 +58,22 @@ instead of `INSERT`, etc). This will make sure repeated 
messages won't affect yo
 The log sequence number (LSN) of a message is in the 
`CamelPgReplicationSlotLsn` header. It is not unique: several
 messages can have the same LSN, for example the `BEGIN` and the first change 
of a transaction with `test_decoding`.
 
+=== TLS
+
+The `sslMode` option sets how the connection uses TLS. When it is not set, the 
default of the PostgreSQL JDBC driver
+applies, which is `prefer`: TLS when the server offers it, without checking 
the server certificate, and a plain
+connection otherwise. To require TLS and check the server, use `verify-full` 
(certificate and host name) or
+`verify-ca` (certificate only), with the root certificates of the server in 
`sslRootCert`:
+
+[source,text]
+----
+pg-replication-slot:db.example.com:5432/mydb/myslot:test_decoding?user=replicator&password=RAW(secret)&sslMode=verify-full&sslRootCert=/etc/certs/root.crt
+----
+
+For a server that checks client certificates, set `sslCert` and `sslKey` (and 
`sslPassword` when the key has a
+password). The PostgreSQL JDBC driver expects the key in PKCS-8 DER format, or 
a PKCS-12 file (`.p12` or `.pfx`) that
+holds the certificate and the key.

Review Comment:
   The description lists "PKCS-8 DER format, or a PKCS-12 file" but the [pgjdbc 
driver](https://jdbc.postgresql.org/documentation/use/) also accepts 
PEM-encoded PKCS-8 keys (`.pem` extension, or auto-detected via `-----BEGIN 
PRIVATE KEY-----` header), and plain DER without a specific extension. The 
current wording may mislead users who already have a PEM key into thinking they 
need to convert it.
   
   ```suggestion
   password). The PostgreSQL JDBC driver accepts the key as PKCS-8 DER, 
PEM-encoded PKCS-8 (`.pem`), or a PKCS-12 file (`.p12` or `.pfx`) that
   holds the certificate and the key.
   ```



##########
components/camel-pg-replication-slot/src/main/java/org/apache/camel/component/pg/replication/slot/PgReplicationSlotEndpoint.java:
##########
@@ -105,6 +109,31 @@ public class PgReplicationSlotEndpoint extends 
ScheduledPollEndpoint {
                             + " while the route is stopped.",
               label = "advanced", defaultValue = "true")
     private Boolean autoCreateSlot = true;
+    @UriParam(description = "The SSL mode of the connection to the PostgreSQL 
server: disable, allow, prefer, require,"
+                            + " verify-ca or verify-full. When not set, the 
default of the PostgreSQL JDBC driver applies,"
+                            + " which is prefer: TLS when the server offers 
it, without checking the server certificate, and"
+                            + " a plain connection otherwise. Use verify-full 
to require TLS and check both the certificate"
+                            + " and the host name of the server.",
+              label = "security", enums = 
"disable,allow,prefer,require,verify-ca,verify-full")
+    private String sslMode;
+    @UriParam(description = "The file of the root certificates (PEM) that the 
server certificate is checked against with"
+                            + " sslMode verify-ca or verify-full. When not 
set, the PostgreSQL JDBC driver reads"
+                            + " root.crt in the .postgresql folder of the home 
directory of the user.",
+              label = "security")
+    private String sslRootCert;
+    @UriParam(description = "The file of the client certificate (PEM) for a 
server that checks client certificates. When"
+                            + " not set, the PostgreSQL JDBC driver reads 
postgresql.crt in the .postgresql folder of the home"
+                            + " directory of the user, if it exists.",
+              label = "security")
+    private String sslCert;
+    @UriParam(description = "The file of the private key of the client 
certificate: PKCS-8 in DER format, or a PKCS-12 file"
+                            + " (.p12 or .pfx) that holds the certificate and 
the key, as the PostgreSQL JDBC driver expects."
+                            + " When not set, the driver reads postgresql.pk8 
in the .postgresql folder of the home directory"
+                            + " of the user, if it exists.",
+              label = "security")

Review Comment:
   Same minor inaccuracy as the .adoc doc — the driver also accepts PEM-encoded 
PKCS-8 (`.pem`) in addition to DER and PKCS-12. Consider updating the 
description to avoid user confusion.
   
   ```suggestion
       @UriParam(description = "The file of the private key of the client 
certificate. The PostgreSQL JDBC driver"
                               + " accepts PKCS-8 DER format (.der or .pk8), 
PEM-encoded PKCS-8 (.pem), or a PKCS-12 file"
                               + " (.p12 or .pfx) that holds the certificate 
and the key."
                               + " When not set, the driver reads 
postgresql.pk8 in the .postgresql folder of the home directory"
                               + " of the user, if it exists.",
                 label = "security")
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to