davsclaus opened a new pull request, #31023:
URL: https://github.com/apache/camel/pull/31023

   JIRA: https://issues.apache.org/jira/browse/CAMEL-27670
   
   ## What was wrong
   
   `AsteriskConnection.connect()` always created the Asterisk Manager Interface 
(AMI) connection with
   `ManagerConnectionFactory.createManagerConnection()`, which opens a plain 
TCP socket. There was no option for TLS, so
   the AMI username and secret, the actions and the events were sent in clear 
text, also when the Asterisk server accepts
   AMI over TLS.
   
   ## What changed
   
   - New endpoint option `ssl` (boolean, default `false`, label `security`).
   - When it is `true`, `AsteriskConnection` creates the connection with 
`createSecureManagerConnection()` of
     asterisk-java (3.42.2), for both the consumer and the producer. 
asterisk-java opens the socket with the default
     `SSLSocketFactory` of the JVM, so the certificate of the server is checked 
with the default trust store of the JVM
     (`javax.net.ssl.trustStore`).
   - The old 3-argument `AsteriskConnection` constructor is kept and uses plain 
TCP.
   - No `sslContextParameters` option: asterisk-java does not take a custom SSL 
socket factory or context
     (`SocketConnectionFacadeImpl` calls `SSLSocketFactory.getDefault()`), so 
such an option could not be applied. The
     docs say so, and that the host name of the server is not checked against 
the certificate.
   
   The default stays plain TCP, so nothing changes for existing routes; no 
upgrade-guide entry.
   
   Note: #31013 (CAMEL-27627) adds a `port` option to the same classes. 
Asterisk listens for AMI over TLS on the port of
   `tlsbindaddr` (5039 by default), so once both are merged a TLS route sets 
`ssl=true&port=5039`. The second one to merge
   needs a small rebase and a regeneration of the asterisk JSON and the 
endpoint DSL.
   
   ## Tests
   
   - `AsteriskSslTest` (2 tests): `ssl` is off by default; with `ssl=true` the 
option reaches the `ManagerConnection` of
     the producer and of the consumer (`isSsl()`). No Asterisk server is 
needed, as creating the connection does not
     connect.
   - Without the fix in `AsteriskConnection.connect()`, 
`sslReachesTheManagerConnection` fails
     (`expected: <true> but was: <false>`).
   - All tests of the module pass.
   
   ## Docs
   
   New "TLS" section in `asterisk-component.adoc` (and the catalog copy): how 
to enable it, the `manager.conf` settings,
   and the trust store of the JVM. Regenerated the component JSON (and catalog 
copy) and the endpoint DSL.
   
   _Claude Code on behalf of Claus Ibsen_
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)
   


-- 
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