Linux VM Setup
Installing and setting up on premise infrastructure
The recommended order for installing and setting up the solution is:
- Install ADDI in a Windows VM (following the ADDI cookbook this will get you to the point of setting up the server, front end, and creating a project).
- Install Refactoring Assistant in a Linux VM.
- Configure the two products to connect securely.
- Provision an IBM watsonx Code Assistant service in IBM Cloud, including creating the Db2 database.
- Create an API key to access the watsonx Code Assistant service.
- Configure ADDI to use the Cloud Db2 database.
- Set up the Data Generator for transformation.
- Install Visual Studio Code and add the Z Open Editor extension and Language Support for Java extension.
- Run through the end to end scenario.
Installing ADDI
As mentioned earlier, the process for Installing ADDI is explained in the ADDI cookbook. After you have installed and set up ADDI, you are ready to install and configure the Refactoring Assistant.
Installing the Refactoring Assistant:
- Log in in your RHEL 8.x env via SSH e.g:
ssh root@<your-test-host-name>
- By default, you are in the /root directory. Download the latest Refactoring Assistant (either directly on the RHEL VM or move it there afterwards).
- Extract the tar file:
tar -xzvf <refactoring-assistant_file_version>.tgz
- Move the refactoring assistant outside to the root folder
mv <path_to_refactoring_assistant> /root/refactoring-assistant
- You should now have a new directory /root/refactoring-assistant. Navigate to that directory there:
cd /root/refactoring-assistant
- Run the setup file
./setup.sh
You may need to expose port 9443 for the Refactoring Assistant Web UI
Configuring Refactoring Assistant
You need an ADDI environment ID before continuing with the RA configuration.
- In your RHEL 8.x env go to:
cd /root/refactoring-assistant
- Create a configuration from the template by copying and then editng it:
cp config/template.properties config/config.properties
- Then update config/config.properties as follow:
config.properties
CERTS_LOCATION=/root/certificate
PROTOCOL=https
AD_HOST_PORT=<FQDN Address of your Windows VM>:2181
ENVIRONMENT_ID=<Your ADDI Environment ID>
DEX_HOST_PORT=
Important details on these fields.
- CERTS_LOCATION - Absolute path to directory where certificates and keys are kept. These items will need to be created
- PROTOCOL - Protocol to use to communicate with AD services
- AD_HOST_PORT - The IBM AD configuration (ZooKeeper) connection string, e.g. <hostname.mydomain.com>:2281 ( use port 2181 if connection is unsecured )
- ENVIRONMENT_ID - The environment ID, which can be obtained from the IBM Application Discovery Configuration Service Admin dashboard, more details on this webpage https://www.ibm.com/docs/en/addi/latest?topic=configuring-by-using-ad-configuration-service
- DEX_HOST_PORT - The location of the DEX authentication server, defaults to $PROTOCOL://$AD_HOST:7600 if unset
Additional properties you can add to this file are listed below:
- Ports of the AD mainframe projects and file services respectively
AD_PROJ_PORT=7650
AD_FILE_PORT=7700 - Outbound mail settings to enable email notifications
MAIL_HOST=
MAIL_PORT=
MAIL_USERNAME=
MAIL_PASSWORD= - Extra Java mail properties, which can be specified by using MAIL_PROPERTIES_ prefix followed by the property name with dot separators replaced by underscores
MAIL_PROPERTIES_MAIL_SMTP_AUTH=true
- If your system has Security-Enhanced Linux (SELinux) feature enabled, you need to add the following additional property
RA_MOUNT_OPTIONS=:Z
Make sure you save and confirm your changes.
cat config/config.properties
Additional RA settings using HTTPS
- In your RHEL 8.x test env go to: cd /root/refactoring-assistant
- To prepare the required certificates, run ./start.sh --prepare-only /root/certificate
- From /root/certificate, copy the root.crt certificate to your Windows VM
- In your Windows env, use PowerShell and use a command like this :
scp root@<your-host-Lin>:/root/certificate/root.crt C:\Users\Administrator\Downloads
- In your Windows env, use PowerShell and use a command like this :
- Continue with the ADDI setup on section Prepare Security Certificates for ADDI and RA, step #8 - Once completed that section, resume here(you should have the zookeeper certificate by then)
- Take the zookeeper.crt certificate, copy it two times and name the copies “ad.crt” and “dex.crt”
- Edit the config.properties configuration file to match these conditions:
PROTOCOL=https
Change the port number of AD_HOST_PORT to 2281 - Restart RA
warning
< stop.sh all > will stop all the services including the database store, deleting all the files in your project. Use < ./stop.sh > without the all flag to stop only the RA service
./stop.sh all
./start.sh
Configure ADDI(DEX)
- In your ADDI Windows env, go to https://localhost:9443/ad/admin/configure?tab=environments and locate the ADDI Environment ID
- Go to C:\Program Files\IBM Application Discovery and Delivery Intelligence\Authentication Server (DEX)\conf\ and edit the dex.yaml file
- Edit the issuer value to be:
https://localhost:7600/dex
- Add the following to the list of static clients:
staticClients:
-
id: refactoring-assistant
redirectURIs:
- https://<your RA Linux hostname>:9443
name: Refactoring Assistant
secret: pkce
There are further settings for Authentication Server (DEX) in the “Enable Security in ADDI Dashboard” section, for now don’t worry about the status of DEX.
Prepare Security Certificates for ADDI and RA
- Download and install prerequisites
- Download the SSL certificate (DigiCertGlobalRootCA) to your Windows VM
- You can find the link to download the SSL certificate in the email sent you with your access details in the DB2 section.
tip
For an integration test team, look in your
\Downloads
for something likeDigiCertGlobalRootCA_wca4z-int-test-db2-<-suffix>.crt
- Generate a public and private key pair using the Java keytool utility:
- Open a command prompt terminal and navigate to the Downloads directory
- Replace the FQDN of your Windows VM in the command below and execute it.
keytool
-genkeypair
-alias "<FQDN of your Windows VM>"
-keyalg RSA -keysize 2048
-dname "cn=< FQDN of your Windows VM>"
-keypass password
-keystore server_keystore.p12
-storepass password
-storetype PKCS12
-ext BasicConstraints:critical=ca:true
-ext san=dns:<FQDN of your Windows VM>noteBy default, such certificates are valid for only 90 days. Passing an additional argument
-validity 366
will extend the validity of the self-signed certificate to a year (in general: to the given number of days)
C:\Users\Administrator\Downloads\server_keystore.p12
- Export the certificate:
You should get certificate stored in file
keytool
-exportcert
-alias "<FQDN of your Windows VM>"
-keystore "server_keystore.p12"
-file "server_certificate.crt"
-storepass "password"<server_certificate.crt>
in the directory you're working on. - Re-import the certificate into the keystore:
You should recieve a prompt stating:
keytool -keystore server_keystore.p12 -import -file "server_certificate.crt" -alias "self-signed-root"
Enter keystore password: <”password” is your password>
Certificate already exists in keystore under alias <FQDN of VM>
Do you still want to add it? [no]: yes"Certificate was added to keystore"
- Use the openSSL command prompt to generate the server.key file:
A server key file should be generated. Example location:
openssl pkcs12 -in server_keystore.p12 -nocerts -nodes -out server.key
Enter Import Password: passwordC:\Users\Administrator\Downloads\server.key
- To generate the server_certificate.crt file run the following command:
keytool -list -keystore server_keystore.p12 -rfc > server_certificate.crt
Enter Keystore Password: password - Import the Db2 SSL certificate into the keystore:
keytool -import -trustcacerts -alias "DB2-ssl-cert" -file <path to the DigiCertGlobalRootCA downloaded from Db2> -keystore server_keystore.p12 -storepass password
Certificate already exists in system-wide CA keystore under alias <digicertglobalrootca [jdk]>
Do you still want to add it to your own keystore? [no]: yes
Certificate was added to keystore- Import the root.crt into the keystore - You can download root.crt from your RA Linux machine to your Windows env with the command:
scp root@<your-host-Win>:/root/certificate/root.crt C:\Users\Administrator\Downloads
keytool -importcert -alias ad-core-server -keystore "server_keystore.p12" -file root.crt -storepass password -ext BasicConstraints:critical=ca:true -ext san=dns:<FQDN of your Windows VM>
Trust this certificate? [no]: yes
- Import the root.crt into the keystore - You can download root.crt from your RA Linux machine to your Windows env with the command:
- Install the DigiCertGlobalRootCA, the
server_certificate.crt
and theroot.crt
(from the RA setup) into the Windows VM’s trusted root certificate authorities.
For all three certificates:
- Right-click the certificate and select
Install certificate
- If
Security Warning
is displayed, selectOpen
, otherwise continue with the next step - Select
Local Machine
, selectNext
- Select
Place all certificates in the following store
- Click
Browse…
- Select
Trusted Root certificate authorities
- Click
OK
, thenNext
- Click
Finish
( you’ll see pop up alert stating “The import was successful.” )- The pop-up message takes some time. to be displayed. Select
OK
.
- The pop-up message takes some time. to be displayed. Select
- Install the
DigiCertGlobalRootCA
, theserver_certificate.crt
and theroot.crt
into Java’s cacerts keystore:- Open a command prompt in the directory containing the new
server_keystore.p12
- Enter the following command to import all certificates from the server_keystore into the cacerts keystore:
keytool -importkeystore -srckeystore "server_keystore.p12" -srcstorepass "password" -destkeystore "%JAVA_HOME%\lib\security\cacerts" -deststorepass "changeit"
Importing keystore server_keystore.p12 to C:\Program
Files\OpenLogic\jre-11.0.20.8-hotspot\lib\security\cacerts...
Entry for alias <…hostname…> successfully imported.
Entry for alias self-signed-root successfully imported.
Entry for alias db2-ssl-cert successfully imported.
Entry for alias ad-core-server successfully imported.
Import command completed: 4 entries successfully imported, 0
entries failed or cancellednotecacerts location could be different depending on your Java installation. In Openlogic Java 11 the cacerts are found in
%JAVA_HOME%\lib\security\cacerts v/s
%JAVA_HOME%\jre\lib\security\cacerts - From the ADDI dashboard (
https://localhost:9443/ad/admin/dashboard
), restart the “Configuration service”
- Open a command prompt in the directory containing the new
- Get the
zookeeper.crt
certificatekeytool -exportcert -alias "<FQDN of your Windows VM>" -keystore "server_keystore.p12" -rfc -file zookeeper.crt -storepass password -ext BasicConstraints:critical=ca:true -ext san=dns:<FQDN of your Windows VM>
- Copy the
zookeeper.crt
file to/root/certificate
on your RHEL VM.- From your Windows env, you can upload
zookeeper.crt
with the following command on PowerShell terminal:scp C:\Users\Administrator\Downloads\zookeeper.crt root@<Your-Linux-FQDN>:/root/certificate/
- From your Windows env, you can upload
At this point you’re ready to finish setting up the HTTPS connection and certificates for the Refactoring Assistant.
Finishing the configuration of Refactoring Assistant to use HTTPS
- Take the
zookeeper.crt
certificate, copy it two times and name the copiesad.crt
anddex.crt
- Restart RA
./stop.sh all
./start.sh - When asked for the OrientDB password, enter
inittest
Enabling security in the ADDI Dashboard
- In the ADDI dashboard, go to
Configure
-><environment-name>
->General
and check that the “IP or host” field has the FQDN of your Windows VM - Next, go to
Servers and security
->Security
- Select
Protocol
typeHTTPS
- Drag and drop the below files from your Windows File Explorer to your web browser under the Security and certificate files
server_keystore.p12
server.key
server_certificate.crt - After selecting the files, enter “password” for the keystore password
- Click
Save
thenOK
( this step may take some time) - Your dex.yaml file should now looks like this:
dex.yaml
schemaVersion: 0
issuer: https://localhost:7600/dex
storage:
type: sqlite3
config:
file: dex.db
frontend:
theme: addi
web:
https: 0.0.0.0:7600
TLSCert: C:\Program Files\IBM Application Discovery and Delivery
Intelligence\security\<…hash-path-goes-here…>\server_certificate.crt
TLSKey: C:\Program Files\IBM Application Discovery and Delivery
Intelligence\security\<…hash-path-goes-here…>\server.key
oauth2:
skipApprovalScreen: true
passwordConnector: ldap
connectors: []
staticClients:
-
id: refactoring-assistant
redirectURIs:
- https://<your RA Linux FQDN>:9443
name: Refactoring Assistant
secret: pkce
enablePasswordDB: true
staticPasswords:
-
email: tester@servicedesigner.com
hash: $2a$12$m2dGtrCtc320uPbjgIOydeYxjePRhPU3WZ34z4CF.iK7oiYcEwRwe
username: null
userID: nulltipIf your DEX service does not start, have a look at
C:\Program Files\IBM Application Discovery and Delivery Intelligence\Authentication Server (DEX)\dex.log
- Restart services by navigating to the ADDI dashboard and selecting the three dots next to the service.
- From the ADDI dashboard restart the following:
- Authentication Server (DEX)
- File Service
- From the start menu, find and open the Services system app
- Select
IBM Application Discovery WebSphere Liberty Profile Service
and restart it (the ADDI dashboard might be unavailable even some time after the WebSphere Liberty Service is shown as Running again)
- From the ADDI dashboard restart the following:
Configuring AD Analyze for TLS
By default, the IBM AD Analyze Client runs in unencrypted mode. The ADDI cookbook doesn’t cover steps to use TLS support. So if you want to securely connect to the server from the IBM AD Analyze Client with TLS support, you need to perform the following steps:
- Make sure HTTPS is configured from the Security Page in the IBM ADDI Dashboard.
- Close the Eclipse Analyze Client
- Go to the location where you unzipped the Eclipse package, for example
C:\eclipse
- Open
eclipse.ini
file and add the following lines, in the-vmargs
section (if vmargs section is missing you can add new one). Avoid blank lines in the-vmargs
section.eclipse.ini -vmargs-Dzookeeper.client.secure=true
-Dzookeeper.ssl.keyStore.location=<the location on disk where the keystore was stored>
-Dzookeeper.ssl.keyStore.password=<keystore password>
-Dzookeeper.ssl.trustStore.location=<the location on disk where the truststore was stored>
-Dzookeeper.ssl.trustStore.password=<truststore password>
-Dclient.ssl.enabled=true
-Djavax.net.ssl.keyStore=<the location on disk where the keystore was stored>
-Djavax.net.ssl.keyStorePassword=<keystore password>
-Djavax.net.ssl.trustStore=<the location on disk where the truststore was stored>
-Djavax.net.ssl.trustStorePassword=<truststore password>noteThe security keystore you add to Analyze Client needs to be configured with the Fully Qualified Domain Name of the Server VM in the Subject (CN) and Subject Alternative Name (SAN) fields. If IP address is used with the security certs then you might hit the following error message in Analyze Client:
Caused by: java.security.cert.CertificateException: No subject alternative names matching IP address 9.46.97.193 found
- Save and close the file
- Restart Eclipse/Analyze Client
- In Eclipse go to
Window
->Preferences
->Application Discovery
->Environment
sections - Update below data with TLS information (You can get Environment ID and Name from the ADDI Dashboard in the Configure tab):
Host: <FQDN of the Windows VM>
Port: 2281
Unique ID: <ADDI Environment ID>
Name: <ADDI Environment Name> - Restart Eclipse/Analyze Client