
If we start with one container for A and one container for B without anything on them and after:
* deploying the Gateway BC on each of the container of A and B.
* adding the transport listener on the Gateway BC of A.
* deploying the Consumes SU on the Gateway BC of A and the Provides SU on the Gateway BC of B.
{tip}The order of deployment is not very important as by default, the Provides SU will try to reconnect until it succeeds.{tip}
We can see that no endpoints have been deployed on B: this is expected because A will only propagate existing endpoints.
Now if we deploy some endpoints on domain A:
* {{InterfaceX:ServiceX:endpointX}}, then no endpoint will be activated on B.
* {{Interface1:Service1a:endpoint1a}}, then {{Interface1:Service1a:xxx}} will be activated on B.
* {{Interface1:Service1a:*endpoint1a*}} and {{Interface1:Service1a:*endpoint1b*}}, then {{Interface1:Service1a:xxx}} will be activated on B.
* {{Interface1:*Service1a*:endpoint1a}} and {{Interface1:*Service1b*:endpoint1b}}, then {{Interface1:*Service1a*:xxx}} and {{Interface1:*Service1b*:xxx}} will be activated on B.
* {{Interface2:*Service2*:endpoint2a}} and {{Interface1:*Service2b*:endpoint2b}}, then only {{Interface1:*Service2*:xxx}} will be activated on B.
* {{Interface3:Service3:endpoint3}}, then {{Interface3:Service3:xxx}} will be activated on B.
* Etc.
We can notice that the endpoint name is never propagated because it is considered that the endpoint is only a technical information to locate an endpoint in a domain.
We can also notice that what matters is always the pair interface and service name, and in case no service name is specified in the Consumes SU, then each existing service in the provider domain will be propagated as its own service.
{anchor:ssl}
h1. Using SSL to authenticate and encrypt exchanges between domains
In order to secure connections between provider and consumer domain, it is possible to rely on SSL.
SSL itself takes care of the encryption, but it is necessary for the provider domain, and optionally for the consumer domain, to have a certificate shared between parties to authenticate them.
There can't thus be encryption without authentication of at least the provider domain and ideally also of the consumer domain!
h2. Authenticating only the Provider Domain
For a provider domain, using SSL means to define a certificate that consumer domains that connect to it can use to authenticate it.
The certificate is a public information and the provider domain owns also a private key that it can use to answers authentication challenges from the consumer domain.
h3. Provider Domain A
On the provider side, the {{consumer-domain}} element must be updated with the following parameters:
{code:lang=xml}
<?xml version="1.0" encoding="UTF-8"?>
<jbi:jbi ...>
<jbi:services binding-component="true">
...
<g:consumer-domain id="domainB" transport="transport1">
<g:auth-name>UniquelySharedBetweenA&B</g:auth-name>
<g:certificate>path/to/a/certificate+provider.crt</g:certificate>
<g:key>path/to/the/key.pem</g:key>
<g:passphrase>secret-to-unlock-the-key<g:passphrase>
</g:consumer-domain>
</jbi:services>
</jbi:jbi>
{code}
Note that this means that setting up SSL is done per consumer domain that will connect to this SU, but nothing prevent us to configure the same certificate for multiple consumer domains of course!
h3. Consumer Domain B
On the consumer side, the {{consumer-domain}} element must be updated with the following parameters:
{code:lang=xml}
<?xml version="1.0" encoding="UTF-8"?>
<jbi:jbi ...">
<jbi:services binding-component="true">
<g:provider-domain id="domainA">
<g:remote-ip>domainA-hostname</g:remote-ip>
<g:remote-port>7500</g:remote-port>
<g:remote-auth-name>UniquelySharedBetweenA&B</g:remote-auth-name>
<g:remote-certificate>path/to/the/certificate-provider.crt</g:remote-certificate>
</g:provider-domain>
</jbi:services>
</jbi:jbi>
{code}
h2. Authenticating both the Provider and Consumer domains
Optionally, it is also possible to superpose on this basic SSL setup the use of a certificate that the provider domain will use to authenticate the consumer domain.
The later will also own a private key then.
h3. Provider Domain A
On the provider side, the {{consumer-domain}} element must be updated with the following parameters:
{code:lang=xml}
<?xml version="1.0" encoding="UTF-8"?>
<jbi:jbi ...>
<jbi:services binding-component="true">
...
<g:consumer-domain id="domainB" transport="transport1">
<g:auth-name>UniquelySharedBetweenA&B</g:auth-name>
<g:certificate>path/to/a/certificate-provider.crt</g:certificate>
<g:key>path/to/the/key.pem</g:key>
<g:passphrase>secret-to-unlock-the-key<g:passphrase>
<g:remote-certificate>path/to/the/certificate-consumer.crt
</g:consumer-domain>
</jbi:services>
</jbi:jbi>
{code}
This means that even if multiple Provides SUs connects to this provider domain, they all must use the same certificate as it is a mean to authenticate a consumer domain and not an individual node of this domain.
h3. Consumer Domain B
On the consumer side, the {{consumer-domain}} element must be updated with the following parameters:
{code:lang=xml}
<?xml version="1.0" encoding="UTF-8"?>
<jbi:jbi ...">
<jbi:services binding-component="true">
<g:provider-domain id="domainA">
<g:remote-ip>domainA-hostname</g:remote-ip>
<g:remote-port>7500</g:remote-port>
<g:remote-auth-name>UniquelySharedBetweenA&B</g:remote-auth-name>
<g:remote-certificate>path/to/the/certificate-provider.crt</g:remote-certificate>
<g:certificate>path/to/a/certificate-consumer.crt</g:certificate>
<g:key>path/to/the/key.pem</g:key>
<g:passphrase>secret-to-unlock-the-key<g:passphrase>
</g:provider-domain>
</jbi:services>
</jbi:jbi>
{code}
h1. Service Rewriting
h1. Service Unit Configuration
h2. Consumes SU
In a Consumes SU, one must declare at least one {{consumer-domain}} and some {{consumes}} element to determine the services to be propagated to one or several of these consumer domains.
The {{consumes}} element can't override each other for the same {{consumer-domain}}:
* If there is a {{consumes}} of type {{Interface:Service:endpoint}}, then there can't be another {{consumes}} of type {{Interface:Service:endpoint}}, {{Interface:Service:}} or {{Interface::}} defined for the same {{consumer-domain}}.
* If there is a {{consumes}} of type {{Interface:Service:}}, then there can't be another {{consumes}} of type {{Interface:Service:}} or {{Interface::}} defined for the same {{consumer-domain}}.
* If there is a {{consumes}} of type {{Interface::}}, then there can't be another {{consumes}} of type {{Interface::}} defined for the same {{consumer-domain}}.
h3. Consumer Domain Element
{center}{*}Configuration of a {{consumer-domain}} element *{center}
{table-plus:columnAttributes=,,style="text-align:center;",style="text-align:center;"}
|| Parameter or +Attribute+ || Description || Default || Required ||
| +id+ | A unique name (in the SU) to identify this consumer domain configuration | \- | Yes |
| +transport+ | The identifier of a transport listener configured in the component | \- | Yes |
| auth-name | A unique name (in the transport listener) to be shared with the consumer domain that will connect to this SU | \- | Yes |
| remote-certificate | The path to a shared SSL certificate used to authenticate the consumer domain that will connect to this SU (relative path means in the SU, absolute path means on the filesystem) | \- | No |
| certificate | The path to a shared SSL certificate used to secure the connections (relative path means in the SU, absolute path means on the filesystem) | \- | Yes if {{remote-certificate}} is specified |
| key | The path to a private SSL key for the SSL certificate specified with {{certificate}} (relative path means in the SU, absolute path means on the filesystem) | \- | Yes if {{certificate}} is specified, else ignored |
| passphrase | The passphrase to unlock the SSL key specified with {{key}} | \- | Only if {{key}} is specified and needs a passphrase, else ignored |
| +propagation-polling-max-delay+ | The maximum delay between polling done by this SU to check new or removed endpoints in the domain (a 0 or negative value means no polling) in milliseconds| {{5000}} | Yes |
| +propagation-polling-acceleration+ | The polling starts at 5sec and is multiplied by this factor after each polling until the maximum delay is attained (a value equals to 1 or less means no acceleration, i.e., the delay is always at the configured maximum) | 2.0 | Yes |