Network

The central port configuration is central Ports configuration via bpc.env.sh and the configuration of Secure connection (TLS/HTTPS) is recommended.

TL;DR

OPENSEARCH_CONFIG_VERZEICHNIS/opensearch.yml
http.port: 9200
transport.tcp.port: 9300
os-bpc-plugin.websocket.port: 9203
karaf/etc/en.virtimo.bpc.core.cfg
de.virtimo.bpc.core.opensearch.port = 9200
karaf/etc/org.apache.karaf.shell.cfg
sshPort = 8101
karaf/etc/org.apache.karaf.management.cfg
rmiRegistryPort = 1099
rmiServerPort = 44444
karaf/etc/org.ops4j.pax.web.cfg
org.osgi.service.http.port = 8181
org.osgi.service.http.port.secure = 8282
org.osgi.service.http.enabled = false
org.osgi.service.http.secure.enabled = true
export ORG_APACHE_KARAF_SHELL_SSHPORT=8181
export ORG_APACHE_KARAF_MANAGEMENT_RMIREGISTRYPORT=1099
export ORG_APACHE_KARAF_MANAGEMENT_RMISERVERPORT=4444
export ORG_OPS4J_PAX_WEB_ORG_OSGI_SERVICE_HTTP_PORT=8181
export ORG_OPS4J_PAX_WEB_ORG_OSGI_SERVICE_HTTP_PORT_SECURE=8282
export DE_VIRTIMO_BPC_CORE_DE_VIRTIMO_BPC_CORE_OPENSEARCH_PORT=9200
export DE_VIRTIMO_BPC_CORE_DE_VIRTIMO_BPC_CORE_OPENSEARCH_TRANSPORT_PORT=9300
export DE_VIRTIMO_BPC_CORE_DE_VIRTIMO_BPC_CORE_OPENSEARCH_WEBSOCKET_PORT=9203

export ORG_OPS4J_PAX_WEB_ORG_OSGI_SERVICE_HTTP_ENABLED=false
export ORG_OPS4J_PAX_WEB_ORG_OSGI_SERVICE_HTTP_SECURE_ENABLED=true

Um mehrere getrennte Instanzen auf einem Server zu betreiben, müssen diverse Parameter umgesetzt werden. Auch aus anderen Gründen (bereits belegte Ports, …​), können diese Anpassungen nötig sein und sollen hier näher beschrieben werden.

Es wird empfohlen, ausschließlich verschlüsselte Verbindungen zu verwenden. Siehe dazu: Secure connection (TLS/HTTPS).

Relevante Anpassungsparameter

Grundsätzlich sind folgende Parameter zu berücksichtigen:

  • OpenSearch-Ports (Default 9200-9300 und 9300-9400 Erläuterung siehe unten)

  • OpenSearch-ClusterID (Default opensearch_virtimo)

  • Karaf BPC-Instanz-Name (Default BPC)

  • Karaf-Ports für:

    • HTTP (Default 8181)

    • HTTPS (Default 8282)

    • SSH (Default 8101)

    • JMX/RMI-Port (Default 1099, 44444)

Anpassungsdetails

Unten stehende Karaf-Parameter können auch über die Karaf-Console gesetzt werden (Syntax: config:property-set -p de.virtimo.bpc.core CONFIGKEY CONFIGVALUE). An dieser Stelle wird allerdings immer die Konfiguration via Konfigurationsdatei beschrieben, da diese auch "offline" durchgeführt und einfacher auf weitere Instanzen übernommen werden kann.

OpenSearch-Ports

Die OpenSearch-Ports müssen sowohl im OpenSearch als auch im Karaf angepasst werden, damit beide Produkte wieder miteinander kommunizieren können.

OpenSearch hat im Auslieferungszustand 2 Port Ranges definiert (9200-9300 und 9300-9400) und nimmt sich jeweils den niedrigsten nicht belegten Port. Dies sollte unbedingt geändert und auf einen festen Port definiert werden, da Karaf ohnehin nur genau einen Port abfragt und ansonsten möglicherweise unbewusst mehrere Instanzen des gleichen OpenSearch ausgeführt werden (und auch funktionieren, da sich jede neue Instanz einfach den nächsten Port schnappt und dann sagt "Hey Cluster, ich bin einer von Euch, sprecht mit mir").

OpenSearch selbst liest seine Port-Konfiguration aus der Datei OPENSEARCH_CONFIG_VERZEICHNIS/opensearch.yml. Es genügt daher, am Ende der Datei diese drei Werte mit den neuen Ports zu definieren:

http.port: 9200
transport.tcp.port: 9300
# Default: 9203
os-bpc-plugin.websocket.port: 9204

In order for Karaf to reach OpenSearch via the new Port, this must be stored in the BPC config file <Karaf_Root>/etc/de.virtimo.bpc.core.cfg (value of the Parameters http.port from the OpenSearch configuration):

de.virtimo.bpc.core.opensearch.port = 9200

The BPC/Karaf establishes a websocket connection to OpenSearch (value of the Parameters os-bpc-plugin.websocket.port from the OpenSearch configuration). The Port does not need to be configured in the BPC, as it is queried by OpenSearch at runtime.

Both services must then be restarted.

BPC instance name

The session cookie is stored without port information, i.e. for a host regardless of the port used (thanks to RFC6265 "cookies for a given host are shared across all the ports on that host"). As a result, you would try to use a session across several instances. BPC correctly recognizes that it does not know this session (of another BPC instance) and disposes of it. This means that you cannot log in to several instances of a host at the same time. There is now an instance name as a prefix for the session information, which can be used to manage several sessions within a browser for the same target host. The following key with a new instance name must be set within the file <Karaf_Root>/etc/de.virtimo.bpc.core.cfg:

de.virtimo.bpc.core.name = BPC

Then restart the Karaf.

Karaf ports

Karaf uses different protocols and ports for communication. For example, it provides an SSH, an HTTP and an HTTPS interface. A JMX/RMI interface is also offered and should be adapted if ports are already occupied.

The note on restarting Karaf after any port changes should be obsolete at this point.

SSH port

Karaf provides an SSH interface for configuration and analysis purposes under Linux as well as under Windows. This is accessible under Port 8101 by default. This can be changed in the file <Karaf_Root>/etc/org.apache.karaf.shell.cfg using the following setting:

sshPort = 8101

To prevent the post from also being accessible externally, the following option can be bound to Localhost or another local interface, for example (0.0.0.0 = Global/all IPv4 addresses of the host):

sshHost = 0.0.0.0

HTTP(S)-Port

The Ports for HTTP and HTTPS are defined in the file <Karaf_Root>/etc/org.ops4j.pax.web.cfg:

org.osgi.service.http.port = 8181
org.osgi.service.http.port.secure = 8282

The respective protocol can also be enabled/disabled separately here (e.g. to only allow HTTPS):

org.osgi.service.http.enabled = false
org.osgi.service.http.secure.enabled = true

JMX/RMI ports

The ports for the JMX/RMI interface are configured in the file <Karaf_Root>/etc/org.apache.karaf.management.cfg using the following Parameters:

rmiRegistryPort = 1099
rmiServerPort = 44444

To make JMX/RMI only available locally, you can also bind the listener from the global 0.0.0.0 to any local interface (e.g. 127.0.0.1) here (analogous to SSH):

rmiRegistryHost = 0.0.0.0
rmiServerHost = 0.0.0.0

Keywords: