Remote connector server

Remote connector server is a standalone daemon used for interfacing some of the more difficult systems. You deploy connector bundles into the connector server. Then, you configure CzechIdM to use connectors from within the remote connector server. As far as IdM is concerned, there is no difference if actions on end system are performed by connector server or IdM itself. The only difference is in the point of origin of network communication.

CzechIdM comes bundled only with certain types of connectors. For some deployments, it is necessary to use Remote connector server ("connector server" from now on). There are generally four reasons for this:

  • We cannot run Java code on the target system (e. g. .NET code is needed).
  • The OS does not have some normal API (e. g. old Windows without WinRM) so we need to run commands on it locally.
  • Security reasons - we do not want to run the connector code under the same user as the CzechIdM.
  • You need to use two different versions of one connector (or two connectors which bundle different versions of the same library - for example Apache CXF). If you did deploy them both into one Java context, libraries would break due to Java Class FQDN conflicts.

The remote server connector configuration form behaves just like the local connector form - this means that definition is stored in the EAV attributes for system which it belongs to. System name, connector name and connector version are the key to EAV attributes in the CzechIdM. It is therefore possible to have multiple connectors with different versions in one remote connector server.

  • Simply download the all-in-one prepared bundle from there.
If you need to do some other things or if you have a do-it-yourself attitude, you can base the setup on original ConnId Connector Server.
  1. Download connector server from the ConnId project.
  2. Use version 1.4.5.1 of remote connector server and version 1.4.3.0 of connector framework.
  3. Download following libraries and add them to the lib directory of the connector server:
    • jackson-annotations-2.9.8
    • jackson-core-2.9.8
    • jackson-databind-2.9.8
  4. Add those libraries to the classpath inside ConnectorServer.sh script (for Linux) or ConnectorServer.bat script (for Windows).
  1. Install Java 11 (OpenJDK headless is preferred).
  2. Create new OS user the connector server will run under. By default, we create user connector-server with home under /opt.
useradd -b /opt -m -s /bin/bash connector-server
chmod 750 /opt/connector-server/
  1. Copy over the connector server and unpack it.
cp connector-server-master.tar.gz /opt/connector-server/
chown connector-server:connector-server /opt/connector-server/connector-server-master.tar.gz
su - connector-server
cd /opt/connector-server
tar xzf connector-server-master.tar.gz
rm connector-server-master.tar.gz
  1. Correct directory permissions:
cd /opt/connector-server/connid-connector-server
chmod 750 bin/ bundles/ certs/ conf/ lib/ logs/ scripts/
  1. Your setup should look like this:
ls -l /opt/connector-server/
total 4
drwxrwxr-x 9 connector-server connector-server 4096 Oct 10 16:45 connid-connector-server

ls -l /opt/connector-server/connid-connector-server/
total 23448
drwxr-x--- 5 connector-server connector-server     4096 Mar 10 10:09 bin
drwxr-x--- 2 connector-server connector-server     4096 Oct 18 09:08 bundles
drwxr-x--- 2 connector-server connector-server     4096 Mar 10 10:14 certs
drwxr-x--- 2 connector-server connector-server     4096 Mar 10 10:04 conf
-rw-rw-r-- 1 connector-server connector-server 11976830 Oct 10 16:45 datetime
drwxr-x--- 3 connector-server connector-server     4096 Oct 10 16:45 lib
-rw-rw-r-- 1 connector-server connector-server    19982 Oct 10 16:45 LICENSE
drwxr-x--- 2 connector-server connector-server     4096 Mar 10 11:02 logs
drwxr-x--- 3 connector-server connector-server     4096 Mar 10 09:50 scripts
-rw-rw-r-- 1 connector-server connector-server 11976825 Oct 10 16:45 sys
  1. Set executable permission on the main script.
cd connid-connector-server
chmod +x bin/ConnectorServer.sh
  1. Create strong password for the connector server (use pwgen -1 16 or something similar).
./bin/ConnectorServer.sh -setKey -key PASSWORD_HERE -properties conf/connectorserver.properties
  1. If you plan to connect to remote connector server remotely (not locally on localhost), edit the conf/connectorserver.properties and set/comment out the connectorserver.ifaddress.
  2. As root, create systemd unit /etc/systemd/system/connector-server.service:
connector-server.service
[Unit]
Description=Java Connector Server Service
After=network-online.target
 
[Service]
User=connector-server
WorkingDirectory=/opt/connector-server/connid-connector-server
ExecStart=/bin/bash /opt/connector-server/connid-connector-server/bin/ConnectorServer.sh -run -properties /opt/connector-server/connid-connector-server/conf/connectorserver.properties
SuccessExitStatus=143
 
[Install]
WantedBy=multi-user.target
  1. Reload systemd, start and enable the connector server.
systemctl daemon-reload
systemctl start connector-server
systemctl enable connector-server
  1. For additional configuration, see conf/connectorserver.properties and conf/logging.properties files.
  2. Connector server is now configured. You can deploy connector bundles into it. You have to restart the connector server for changes to take effect.
    1. Add connector bundles (.jars) into the bundles directory.
    2. Add custom scripts the CzechIdM will use under the scripts directory.
    3. Add certificates to be used under cert directory. CzechIdM scripts by default look there.

Configuring log rotation

The principle of rotating logs on Linux is the same as for the CzechIdM. Just create a proper logrotate file /etc/logrotate.d/connector-server:

/opt/connector-server/connid-connector-server/logs/connectorserver*.log {
    rotate 90
    daily
    dateext
    copytruncate
    missingok
    notifempty
    compress
}

Configuring SSL truststore

When you interface end systems remotely, you have to secure the communication with TLS. For this to work, you need a Java truststore. This short howto will show you how to create one.

  1. Get (or create - as we do there) a certificate of the end system.
su - connector-server
cd /opt/connector-server/connid-connector-server/conf
openssl genrsa -out fakecert.key
openssl req -new -key fakecert.key -out fakecert.csr -subj "/C=CZ/ST=Czech Republic/L=Prague/O=BCV/CN=Connector placeholder cert"
openssl x509 -req -in fakecert.csr -signkey fakecert.key -days 1 -sha256 -out fakecert.crt
  1. Import the certificate into the truststore. If the truststore.jks does not exist, the keytool will create it.
keytool -importcert -file fakecert.crt -alias placeholder-cert -keystore truststore.jks
    Enter keystore password:  ENTER SOME PASSWORD HERE AND REMEMBER IT FOR LATER
    Re-enter new password:
    ...
    Trust this certificate? [no]:  yes
    Certificate was added to keystore
  1. Just some cleanup.
rm fakecert.key fakecert.csr fakecert.crt
chmod 644 truststore.jks
# the connector server user should not be able to write the truststore, only read it
chown root:connector-server truststore.jks
  1. Add truststore to startup script ConnectorServer.sh:
cd /opt/connector-server/connid-connector-server
vim bin/ConnectorServer.sh

# add this snippet to the command line that executes the connector server
-Djavax.net.ssl.trustStore=/opt/connector-server/connid-connector-server/conf/truststore.jks -Djavax.net.ssl.trustStorePassword=PUT_KEYSTORE_PASSWORD_HERE
  1. Restart the connector server.

1) Install Java 1.8 (OpenJDK headless is preferred).

Use version 1.8 and not later versions!

2) Unpack connector server to his root directory "C:\connid-connector-server".

3) Create trustore for connector server. Use git bash in direcotory "C:\connid-connector-server\conf".

  • Get (or create - as we do there) a certificate of the end system.
openssl genrsa -out fakecert.key
openssl req -new -key fakecert.key -out fakecert.csr -subj "/C=CZ/ST=Czech Republic/L=Prague/O=BCV/CN=Connector placeholder cert"
openssl x509 -req -in fakecert.csr -signkey fakecert.key -days 1 -sha256 -out fakecert.crt
  • Import the certificate into the truststore. If the truststore.jks does not exist, the keytool will create it.
/c/Program\ Files/Java/jdk-1.9.8/bin/keytool -importcert -file fakecert.crt -alias placeholder-cert -keystore truststore.jks
    Enter keystore password:  ENTER SOME PASSWORD HERE AND REMEMBER IT FOR LATER
    Re-enter new password:
    ...
    Trust this certificate? [no]:  yes
    Certificate was added to keystore
  • Just some cleanup.
rm fakecert.key fakecert.csr fakecert.crt

4) Add trustore location and password to service installation in „bin\ConnectorServer.bat“(windows). These parameters are in script already, so just trustore path and password.

"-Djavax.net.ssl.trustStore=C:\connid-connector-server\conf\truststore.jks";"-Djavax.net.ssl.trustStorePassword=TODO_PASSWORD"

5) Start CMD under system admin. Then go to connector-server root directory.

cd C:\connid-connector-server
bin\ConnectorServer.bat /setkey
Run the setkey command from the path C:\connid-connector-server

6) Add connectors to "C:\connid-connector-server\bundles" and scripts to "C:\connid-connector-server\scripts".

7) Then setup connector-server key and install windows service(connector_server).

bin\ConnectorServer.bat /install connector_server

8) Then start service in "services.msc". If connector_server service started correctly set this service to automatic start.

@since 10.8.0

Standalone connector server agenda is available from main menu SystemConnector servers:

  • Remote connector servers can be configured here, configuration is effective for all related systems,
  • connectors installed on the same server together with CzechIdM are shown,
  • systems related to remote connector server or to concrete connector can be found on server or connector detail.

  1. In CzechIdM, go to SystemsConnector servers from menu and add new remote connector server.
  2. In the detail of this remote connector server fill in every form field that IdM needs to connect to the remote system. It is necessary to supply the host and port on which the connector is available on remote server. If the server is secured by password, you will need to fill in the password in order to successfully connect to the remote connector server. Password will be stored in local confidential storage.
  3. When you are done, save the form.
  4. In CzechIdM, on the system tab, create a new system.
  5. In the detail of this system, select previously added remote connector server in Use remote connector server field.
  6. When you are done, save the form.
  7. Go to the Configurations tab. There, only connectors that are deployed inside remote connector server, will be available.
  8. Configure everything else as you would do if you were not using remote connector server.
If you change the key (password) of the remote connector server, you must change the key also in the remote connector server configuration in IdM. You may need to restart IdM (i.e. the application server Tomcat) to force the IdM to start using the new key. Otherwise, you would get this exception when testing the connection:
org.identityconnectors.framework.common.exceptions.InvalidCredentialException: Remote framework key is invalid
  • by urbanl