Fuse 6 is no longer supported
As of February 2025, Red Hat Fuse 6 is no longer supported. If you are using Fuse 6, please upgrade to Red Hat build of Apache Camel.Questo contenuto non è disponibile nella lingua selezionata.
Chapter 1. Security for HTTP-Compatible Bindings
Abstract
Overview Copia collegamentoCollegamento copiato negli appunti!
Generating X.509 certificates Copia collegamentoCollegamento copiato negli appunti!
- Use a commercial third-party to tool to generate and manage your X.509 certificates.
- Use the free openssl utility (which can be downloaded from http://www.openssl.org) and the Java keystore utility to generate certificates (see Section 2.5.3, “Use the CA to Create Signed Certificates in a Java Keystore”).
Certificate format Copia collegamentoCollegamento copiato negli appunti!
Enabling HTTPS Copia collegamentoCollegamento copiato negli appunti!
- HTTPS specified in the WSDL contract—you must specify the endpoint address in the WSDL contract to be a URL with the https: prefix, as shown in Example 1.1, “Specifying HTTPS in the WSDL”.
Example 1.1. Specifying HTTPS in the WSDL
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Where thelocationattribute of thesoap:addresselement is configured to use a HTTPS URL. For bindings other than SOAP, you edit the URL appearing in thelocationattribute of thehttp:addresselement. - HTTPS specified in the server code—you must ensure that the URL published in the server code by calling
Endpoint.publish()is defined with a https: prefix, as shown in Example 1.2, “Specifying HTTPS in the Server Code”.Example 1.2. Specifying HTTPS in the Server Code
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
HTTPS client with no certificate Copia collegamentoCollegamento copiato negli appunti!
Example 1.3. Sample HTTPS Client with No Certificate
- 1
- The TLS security settings are defined on a specific WSDL port. In this example, the WSDL port being configured has the QName,
{http://apache.org/hello_world_soap_http}SoapPort. - 2
- The
http:tlsClientParameterselement contains all of the client’s TLS configuration details. - 3
- The
sec:trustManagerselement is used to specify a list of trusted CA certificates (the client uses this list to decide whether or not to trust certificates received from the server side).Thefileattribute of thesec:keyStoreelement specifies a Java keystore file,truststore.jks, containing one or more trusted CA certificates. Thepasswordattribute specifies the password required to access the keystore,truststore.jks. See Section 3.2.2, “Specifying Trusted CA Certificates for HTTPS”.NoteInstead of thefileattribute, you can specify the location of the keystore using either theresourceattribute (where the keystore file is provided on the classpath) or theurlattribute. In particular, theresourceattribute must be used with applications that are deployed into an OSGi container. You must be extremely careful not to load the truststore from an untrustworthy source. - 4
- The
sec:cipherSuitesFilterelement can be used to narrow the choice of cipher suites that the client is willing to use for a TLS connection. See Chapter 4, Configuring HTTPS Cipher Suites for details.
HTTPS client with certificate Copia collegamentoCollegamento copiato negli appunti!
Example 1.4. Sample HTTPS Client with Certificate
- 1
- The
sec:keyManagerselement is used to attach an X.509 certificate and a private key to the client. The password specified by thekeyPasswodattribute is used to decrypt the certificate’s private key. - 2
- The
sec:keyStoreelement is used to specify an X.509 certificate and a private key that are stored in a Java keystore. This sample declares that the keystore is in Java Keystore format (JKS).Thefileattribute specifies the location of the keystore file,wibble.jks, that contains the client’s X.509 certificate chain and private key in a key entry. Thepasswordattribute specifies the keystore password which is required to access the contents of the keystore.It is expected that the keystore file contains just one key entry, so it is not necessary to specify a key alias to identify the entry. If you are deploying a keystore file with multiple key entries, however, it is possible to specify the key in this case by adding thesec:certAliaselement as a child of thehttp:tlsClientParameterselement, as follows:<http:tlsClientParameters> ... <sec:certAlias>CertAlias</sec:certAlias> ... </http:tlsClientParameters><http:tlsClientParameters> ... <sec:certAlias>CertAlias</sec:certAlias> ... </http:tlsClientParameters>Copy to Clipboard Copied! Toggle word wrap Toggle overflow For details of how to create a keystore file, see Section 2.5.3, “Use the CA to Create Signed Certificates in a Java Keystore”.NoteInstead of thefileattribute, you can specify the location of the keystore using either theresourceattribute (where the keystore file is provided on the classpath) or theurlattribute. In particular, theresourceattribute must be used with applications that are deployed into an OSGi container. You must be extremely careful not to load the truststore from an untrustworthy source.
HTTPS server configuration Copia collegamentoCollegamento copiato negli appunti!
Example 1.5. Sample HTTPS Server Configuration
- 1
- The
busattribute references the relevant CXF Bus instance. By default, a CXF Bus instance with the ID,cxf, is automatically created by the Apache CXF runtime. - 2
- On the server side, TLS is not configured for each WSDL port. Instead of configuring each WSDL port, the TLS security settings are applied to a specific IP port, which is
9001in this example. All of the WSDL ports that share this IP port are therefore configured with the same TLS security settings. - 3
- The
http:tlsServerParameterselement contains all of the server’s TLS configuration details.ImportantYou must setsecureSocketProtocoltoTLSv1on the server side, in order to protect against the Poodle vulnerability (CVE-2014-3566) - 4
- The
sec:keyManagerselement is used to attach an X.509 certificate and a private key to the server. The password specified by thekeyPasswodattribute is used to decrypt the certificate’s private key. - 5
- The
sec:keyStoreelement is used to specify an X.509 certificate and a private key that are stored in a Java keystore. This sample declares that the keystore is in Java Keystore format (JKS).Thefileattribute specifies the location of the keystore file,cherry.jks, that contains the client’s X.509 certificate chain and private key in a key entry. Thepasswordattribute specifies the keystore password, which is needed to access the contents of the keystore.It is expected that the keystore file contains just one key entry, so it is not necessary to specify a key alias to identify the entry. If you are deploying a keystore file with multiple key entries, however, it is possible to specify the key in this case by adding thesec:certAliaselement as a child of thehttp:tlsClientParameterselement, as follows:<http:tlsClientParameters> ... <sec:certAlias>CertAlias</sec:certAlias> ... </http:tlsClientParameters><http:tlsClientParameters> ... <sec:certAlias>CertAlias</sec:certAlias> ... </http:tlsClientParameters>Copy to Clipboard Copied! Toggle word wrap Toggle overflow NoteInstead of thefileattribute, you can specify the location of the keystore using either theresourceattribute or theurlattribute. You must be extremely careful not to load the truststore from an untrustworthy source.For details of how to create such a keystore file, see Section 2.5.3, “Use the CA to Create Signed Certificates in a Java Keystore”. - 6
- The
sec:trustManagerselement is used to specify a list of trusted CA certificates (the server uses this list to decide whether or not to trust certificates presented by clients).Thefileattribute of thesec:keyStoreelement specifies a Java keystore file,truststore.jks, containing one or more trusted CA certificates. Thepasswordattribute specifies the password required to access the keystore,truststore.jks. See Section 3.2.2, “Specifying Trusted CA Certificates for HTTPS”.NoteInstead of thefileattribute, you can specify the location of the keystore using either theresourceattribute or theurlattribute. - 7
- The
sec:cipherSuitesFilterelement can be used to narrow the choice of cipher suites that the server is willing to use for a TLS connection. See Chapter 4, Configuring HTTPS Cipher Suites for details. - 8
- The
sec:clientAuthenticationelement determines the server’s disposition towards the presentation of client certificates. The element has the following attributes:wantattribute—Iftrue(the default), the server requests the client to present an X.509 certificate during the TLS handshake; iffalse, the server does not request the client to present an X.509 certificate.requiredattribute—Iftrue, the server raises an exception if a client fails to present an X.509 certificate during the TLS handshake; iffalse(the default), the server does not raise an exception if the client fails to present an X.509 certificate.