Search This Blog

2024-04-22

SAP BODS JobServer: Enabling IPv6

Product: SAP Data Services

Version: 4.2.x

Overview

SAP BODS product bundled with following 2 software:

  • IPS
  • Data Services JobServer - I will refer to it as JobServer
  • Tomcat

Following are the default ports each listening on

  • IPS - TCP port 6400
  • JobServer - TCP port 3500
  • Tomcat - TCP port 8080

This post mainly write about IPv6, as certain people might have IPv6 setup, and would like to use it.  I won't discuss about Tomcat, as its IPv4 & IPv6 network configuration follows Apache Tomcat's documentation.

IPS has both IPv4 and IPv6 enabled during installation.  However, JobServer only enable IPv4, and the product document does not show how to enable IPv6.  The confusing part is that their product document, and SAP KB have several places that indicate IPv6 is supported, yet no documentation how to enable it.

Enabling IPv6 for JobServer

Follow these steps to enable IPv6 (and keeps IPv4) for JobServer

1. cd $LINK_DIR/bin

2. Append SAP_IPv6_ACTIVE=Y into al_env.sh: echo "export SAP_IPv6_ACTIVE=Y >> al_env.sh"

3. Restart JobServer: svrcfg

3.1. In the menu, choose stop JobServer, then start JobServer

Verify IPv6 enabled for JobServer

When I raised SAP support ticket, SAP keeps saying IPv6 is enabled, so I have to provide proof that it is not.  You can use this command to verify that IPv6 is enable
1. Linux: netstat -an | grep 3500 | grep LISTEN
2. Windows: Run cmd as Administrator
2..1. netstat -an | findstr "3500" | findstr "LISTEN"

Sample output that shows IPv6 works in port 3500
tcp   0    0 0.0.0.0:3500    0.0.0.0:*    LISTEN
tcp6   0    0 0.0.0.0:3500    0.0.0.0:*    LISTEN

The first column, "tcp6"means it is for IPv6, while "tcp" means it is for IPv4

2024-04-16

IBM Cognos Analytics: Content Store JDBC Configuration for Oracle

Product: IBM Cognos Analytics

Version: 10.2.1 - 12.0.0

OS: Windows, Linux

IBM Cognos Analytics documentation about Content Store's configuration using Oracle database is very limited.

This post will list down several configurations

Option 1: Using TNS from tnsnames.ora. Most Recommended

Using TNS name is the most preferred method for following reasons:

1. Changing of Oracle hostname doesn't need to change Cognos configuration, and can be done in real time

2. You can leverage Oracle scan listener functionality in tnsnames.ora

3. You can leverage fail-over Oracle functionality in tnsnames.ora

4. You can leverage standby fail-over Oracle functionality in tnsnames.ora

5. You can troubleshoot Cognos content store connectivity to Oracle DB using tnsping [TNS name] command

6. Supports Oracle RAC through tnsnames.ora

Steps:

1. Delete all entries under Data Access > Content Manager

2. Create new Content Store, and pick "Oracle database (Advanced)"

3. Enter the pre-configured Oracle TNS name from tnsnames.ora under "Database specifier"

4. In this example, "ora21c" is the TNS name entry that already configured in tnsnames.ora


Option 2: Uses URL syntax

Uses a JDBC URL syntax of //[hostname]:[port]/[service name] will leverage Oracle Service functionality, as well as making the entry easy to maintain.

There is not much advantage to this approach compare to above, so I will only list down disadvantage:

1. Changing of Oracle hostname, port, service name will required to shutdown Cognos daemon

2. Not possible to perform connectivity test using exact URL

3. Doesn't support Oracle RAC

4. Doesn't support Oracle standby

5. Doesn't support Oracle fail-over

Steps:

1. Delete all entries under Data Access > Content Manager

2. Create new Content Store, and pick "Oracle database (Advanced)"

3. Enter //[hostname]:[port]/[service name] under "Database specifier"

3.1. hostname - Oracle database server's hostname

3.2. port - Oracle listener's port. Default is 1521

3.3. service name - Oracle listener's service name as shown in "lsnrctl status [listener]"

4. In this example, "//ora-db-21c:1521/ora21c.abc.com" will connects to host ora-db-21c on port 1521, with Oracle service name  ora21c.abc.com


Option 3: Uses long TNS syntax

This is an lengthy and poor readability configuration, but it offers some advantages:
1. You can leverage Oracle scan listener functionality in tnsnames.ora

2. You can leverage fail-over Oracle functionality in tnsnames.ora

3. You can leverage standby fail-over Oracle functionality in tnsnames.ora

4. You can troubleshoot Cognos content store connectivity to Oracle DB using tnsping [TNS name] command

5. Supports Oracle RAC through tnsnames.ora

Disadvantage:

1. Length to type, and potentially make mistake

2. Difficult and time consuming to modify

3. Modification of hostname, port, service name will require to restart Cognos daemon

4. using tnsping to perform connectivity test is challenging for those who doesn't know the syntax that has been long forgotten

Steps:

1. Delete all entries under Data Access > Content Manager

2. Create new Content Store, and pick "Oracle database (Advanced)"

3. Under "Database specifier," enter "(DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = ora-db-21c)(PORT = 1521))) (CONNECT_DATA = (SERVICE_NAME = ora21c.abc.com)))"

3.1. HOST - Oracle database server's hostname

3.2. PORT - Oracle listener's port. Default is 1521

3.3. SERVICE_NAME - Oracle listener's service name as shown in "lsnrctl status [listener]"

Option 4: Uses SID

This is the least recommended approach, but remains in Cognos product documentation for the longest time.  The main reason is that Oracle documentation has recommended not to use SID to login for any application since late 1990s.

The syntax is hostname:port:SID, which is very similar to URL syntax above, but it uses ":" instead of "/"

There is not much advantage to this approach compare to above, so I will only list down disadvantage:

1. Changing of Oracle hostname, port, service name will required to shutdown Cognos daemon

2. Not possible to perform connectivity test using exact URL

3. Doesn't support Oracle RAC

4. Doesn't support Oracle standby

5. Doesn't support Oracle fail-over

6. SID might be different than service name that Oracle DBA is familiar, and might cause communication gap, and confusion during connectivity troubleshooting

Steps:

1. Delete all entries under Data Access > Content Manager

2. Create new Content Store, and pick "Oracle database (Advanced)"

3. Under "Database specifier," enter "[hostname]:[port]:[SID]"

3.1. hostname- Oracle database server's hostname

3.2. port- Oracle listener's port. Default is 1521

3.3. SID - Oracle DB's SID, but not service name



2024-02-05

Oracle sqlplus Login Failure Handling in Shell Script

 Product: Oracle RDBS

Command: sqlplus, shell script

Overview

I would like to document how to create a shell script that will report whether the username credential that stores in a file can successfully login to Oracle DB, or filed.

Without specifying any sqlplus parameter, sqlplus will always return exit code of 0 to the shell script.  I have seen people uses text processing utility to search for the login failure command to detect login failure, but they should use parameter "/l" to do that.

Moreover, in a shell script, I will suggest to turn off the login banner to make the output less verbose by using parameter "/s"

Instruction

Suggested command is "sqlplus /s /l username@TNS"

To automate the password, my suggested command is "echo [password] | sqlplus /s /l username@TNS"

Later, the shell script can uses the OS return code's build-in parameter $? with following meaning:

  • 0 - login successful
  • 1 - login failed


2023-10-20

SSL Setup - Java https, smtp, MS SQL Server

Technology: Java using SSL Certificate, or TLS1.2 - 1.3 encryption

Product: web server (https), SMTP email, force encryption MS SQL Server

There are several steps involve in setup SSL for various servers besides following standard

1. Create new SSL certificate for the virtual hostname used by the applications

2. Import the SSL certificate to the application servers

2.1. For Java, you need to import into Java keystore. For OpenJDK or Oracle Java (JRE), it is located in [java_jre_home]\lib\security, or [java_jdk_home\jre\lib\security.

2.2. For Linux or Windows binary programs, you need to import into OS. For RHEL, the SSL certificate file will be /etc/ssl/certs

3. Configures the application server to enable SSL, and indirectly specified the SSL certificate to use

4. Configures the application client to enable SSL, and optionally

4.1. Java - optionally specifies SSL keystore if not using default

Now, let's pick an application that leverages multiple technologies, and gives real picture what needs to be configured to enable SSL

Cognos Analytics report server

This reporting server has following functionality (typical, but could be more) that will has SSL encryption:

1. Web server - it is severing the report in html, so it is a web server

2. Web client - it is able to forward its traffic to a customer facing web server (IIS, Apache httpd, IBM httpd), so for this communication, it is a web client

3. SMTP email client - its interactive report and scheduled report can be sent out as email attachment (pdf, html)

4. DB client - it needs a "Content Store" DB to stores user credential and report template. It can has additional audit DB to store additional application data for audit functionality.  Any DB that it is querying to display the reports are all act as a DB client

5. Authentication client - OOTB LDAP (Windows only) server, custom LDAP, Okta, IBM OpenConnect, etc authentication that it supports, it is acting as client

Therefore, for above 5 typical server & client functionality, SSL can be enabled and encrypts the traffic between remote servers and clients.

For all the above functionality, you need to understand that the product is a pure Java J2EE application.  Therefore, all the SSL configuration will follow Java (standard) and IBM documentation (application specific).

Several and multiple SSL certificates involve in this encryption setup:

1. Java keystore located in [cognos_home]\configuration\certs\CAMKeystore (default password NoPassWordSet)

1.1. CAMKeystore keeps the SSL cert for web/https access for Cognos Analytics server. If there are multiple virtual hostname (such as internal access, intranet access, internet access), then there are multiple SSL certs (unless the SSL cert contains multiple virtual hostname)
1.2. CAMKeystore keeps the SSL cert for Cognos Analytics server's databases access, e.g. Content DB, audit DB, data store DB. Example is MS SQL Server force encryption. Each remote DB server uses different SSL cert, and CA root
1.3. CAMKeystore keeps the SSL cert for SMTP server, which used for email of report, or email notification functionality. Example is smtp protocol with STARTTLS that enforce SSL, or smtps protocol. Typically only 1 SMTP server, so only 1 SSL cert
1.4. CAMKeystore keeps the SSL cert for client side https with remote customer users facing web server
1.5. CAMKeystore keeps the SSL cert for remote authentication server, e.g. LDAP , ActiveDirectory, and SSO. Each authentication server has its own SSL cert

Procedure:

1. Determine the root certificate for all 5 components above.  Each server will have its own SSL cert, and might not use the same CA root certificate

2. Verify in [cognos_home]\configuration\certs\CAMKeystore that the CA root certificate is already there, and will be recognize

2.1. Follows Cognos Analytics doc: DLS_SSL_CertImportTool.bat (Windows), or sh (Linux) - https://www.ibm.com/docs/en/cognos-analytics/11.2.0?topic=server-enabling-secure-tls-connection-your-email

3. Even if it is in CAMKeystore, verify that it is not expired

4. If not there, or expired, then export the CA root cert from remote server

5. Import into CAMKeystore, which is the IBM Java keystore

6. For DB used in data store, import the SSL cert into [cognos_home]\ibm-jre\jre\lib\security\cacerts

6. Follows various IBM Cognos Analytics document to enable SSL encryption

6.1. For Cognos Analytics 12.0.0 SMTP - https://www.ibm.com/docs/en/cognos-analytics/12.0.0?topic=server-enabling-secure-tls-connection-your-email

6.2. For Cognos Analytics 11.2.0 Content DB, audit DB, logging DB as database client - https://www.ibm.com/docs/en/cognos-analytics/11.2.0?topic=communications-enabling-ssl-db2-informix-databases

6.3. For data store as DB client - https://www.ibm.com/docs/en/cognos-analytics/11.2.0?topic=communications-enabling-ssl-db2-informix-databases

Tools

There are various DOS utilities that can troubleshoot SSL communication, but none for Java.  Some sample Java programs are available, but you have to compile, as well as familiar with SSL logging parameters that you have to manually specify.

Tools for

1. Windows: openssl

2. UNIX, Linux - openssl, curl

3. Java SMTP - Oracle javamail-samples.zip that based on Oracle javax.mail.jar library that you need to download. It contains sample SMTP with STARTTLS sample code that you need to modify the Java program to specify SMTP port (default port 25)

4. Java MS SQL Server client - Microsoft provided sample https://learn.microsoft.com/en-us/sql/connect/jdbc/connection-url-sample?view=sql-server-ver16

Tool - opemnssl for SMTP

For SMTP that uses STARTTLS to enable encryption, uses following command to troubleshoot SSL issue

openssl s_client -starttls smtp -crlf -connect [remote email server hostname]:[smtp port]

This relies on OS SSL certificate store, so not applicable for Java SMTP troubleshooting

Tool - opemnssl for SMTPS

Same as above, but uses SMTPS SSL encryption, not SMTP + STARTTLS

openssl s_client  smtps -crlf -connect [remote email server hostname]:[smtp port]

Tool - curl for SMTP

curl is preinstalled in Linux.  It can login to SMTP email server, and send out email.  Therefore, it is useful to ensure the remote SMTP server is properly configured to allow your application server to send out email. This uses SMTP + STARTTLS protocol

curl -v  smtp://email-smtp.us-east-1.amazonaws.com:587  --user "login-user-name:password-to-be-filled" --mail-from "[username that allow to be used to send out" --mail-rcpt "email addr to receive the email"  -T emailcontent.txt --ssl

Tool - curl for SMTPS

Same as above, but uses SMTPS instead of SMTP + STARTTLS

curl -v  smtps://email-smtp.us-east-1.amazonaws.com:587  --user "login-user-name:password-to-be-filled" --mail-from "[username that allow to be used to send out" --mail-rcpt "email addr to receive the email"  -T emailcontent.txt

Tool - Test-NetConnection

PowerShell Test-NetConnection can be used to verify the application server machine can reach remote SMTP/DB/LDAP/Okta/SSO/web server.  This will give you a quick indication that the firewall, router, DNS, AWS Security Group, etc are configured to allow them to talk before you perform application side of testing, such as openssl, or curl above

test-netconnection [remote server hostname] -port [remote server port]

Example for MS SQL Server: test-netconnection [remote MS SQL Server virtual hostname] -port 1433

Example for web server: test-netconnection [remote web server virtual hostname] -port 443

Example for Oracle DB: test-netconnection [remote Oracle virtual hostname] -port 1521

Tool - Java

Enable following SSL debug parameter when running sample MS SQL Server, Oracle sample JavaMail program, etc

Example for using Oracle JavaMail sample called smtpsend.java: java  -cp .;..\javax.mail.jar;..\javax.activation-api-1.2.0.jar  -Djavax.net.debug=ssl:handshake smtpsend

2023-05-26

SAP IPS - setup.exe doesn't recognize Product Key

Product: SAP IPS
Version: 4.1 - 4.2

Symptom

Run setup.exe, and enter a valid product key. Installer returns following error

Error
An error has occurred.

The product key is not valid. INS00140

Checked installer log in /tmp/yyyy.mm.dd.hh24.mi.ss/setupengine.log for key validation failure. It is showing following

20:58:18.743 RawArgFormatter - property not set yet: shared.library.keycode.props-4.0-core$ProductKey

20:58:25.692 [validate_ProductKey]argument:  -keycode ********  -version 142 -property BOE.EnableBOE

20:58:26.056 [run_external_executable] cmdLine: cd "/opt/download/sap/bods42sp14pl21/ips42sp9pl7/dunit/product.minibip-4.0-core-32/actions/"; /opt/download/sap/bods42sp14pl21/ips42sp9pl7/dunit/product.minibip-4.0-core-32/actions//isKeycodeValid  -keycode ********  -version 142 -property BOE.EnableBOE

20:58:26.056 [validate_ProductKey]keyTypes [BOE.EnableBOE:142] is bad

Solution

For for full path of program "isKeycodeValid" shown in above log, then run following
chmod u+x <full path from log above>/isKeycodeValid

You should be able to manually test this is success
cd "/opt/download/sap/bods42sp14pl21/ips42sp9pl7/dunit/product.minibip-4.0-core-32/actions/"
isKeycodeValid  -keycode <non case sensitive product key>  -version 142 -property BOE.EnableBOE

2023-05-16

Cognos Analytics 11.1.x - 11.2.x - Installer failed with JRE libraries missing or not compatible

Product: IBM Cognos Analytics
Version: 11.1.0 - 11.2.2
OS: Linux, AIX, PowerPC, all UNIX distributions
Related IBM KB: https://www.ibm.com/support/pages/jre-libraries-are-missing-or-not-compatible

Problem

When executing  the Cognos installer on a Linux,Aix server the installer fails to run the following error:

Preparing to install...
Extracting the JRE from the installer archive...
Unpacking the JRE...
Extracting the installation resources from the installer archive...
Configuring the installer for this system's environment...

Launching installer...

JRE libraries are missing or not compatible....
Exiting...."

Symptom

The installer consistently fail to run with below false alarm:
  • JRE libraries are missing - not applicable as the installer is downloaded many times from IBM as a valid zip file, as well as across many different version of Cognos from 11.1.0 - 11.2.2
  • JRE not compatible - not possible, as the installer bundled IBM Java in /tmp/install.dir.[nnnnn]/Linux/resource/jre/bin
(login as UNIX cognos user that created to own the application)
$ echo $TMP
[empty]
$ grep noexec /etc/fstab
UUID=c7aac85c-4dfd-4e40-bd6c-bf57c8284c0c       /       xfs     defaults,noexec
$ echo "echo 012345" > /tmp/test_exec.sh
$ sh /tmp/tst_exec.sh
/tmp/tst_exec.sh: Permission denied
/tmp/install.dir.[nnnnn]/Linux/resource/jre/bin/java -version
/tmp/install.dir.[nnnnn]/Linux/resource/jre/bin/java: : Permission denied

Cause #1

/tmp mount point is mounted without execute permission for security reason (checks /etc/fstab with value noexec).
It is confirmed by tst_exec.sh that created above that it failed to run


Cause #2

A wrong installer for other OS is downloaded.  For Intel Linux, you should expect following output

$ file analytics-installer-3.6.46-linuxx86.bin
analytics-installer-3.6.46-linuxx86.bin: data

Following is expected for Intel x86 64-bit Linux
file /tmp/install.dir.*/Linux/resource/jre/bin/java
/tmp/install.dir.15939/Linux/resource/jre/bin/java: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.18, not stripped


Following is for PowerPC Linux, not Intel x86
$ file /tmp/install.dir.*/Linux/resource/jre/bin/java
/tmp/install.dir.15939/Linux/resource/jre/bin/java: ELF 64-bit LSB executable, 64-bit PowerPC or cisco 7500, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.32, BuildID[sha1]=c07e00748dd7b5ca30b6feb0e2d7c911cec024d7, not stripped


Resolving the Problem

Option #1: Identify a directory that user is allow to run the installer program, i.e. java.  Specify Cognos installer OS environment variable IATEMPDIR to that location before execute the installer

$ export IATEMPDIR=~/tmp
$ analytics-installer-3.6.46-linuxx86.bin

Option #2: Coordinate with Linux SA to remove "noexec" from /etc/fstab, or provides another mount point that doesn't contain "noexec" security option. Assumes the mount point is called /tmp2, then set Cognos installer OS environment variable IATEMPDIR to that mount point before execute the installer

$ export IATEMPDIR=/tmp2
$ analytics-installer-3.6.46-linuxx86.bin

2023-02-27

Oracle Timezone: Clarification of 2 Timezone Setting

Product: Oracle Database
Version: All
OS: All

History

Many years ago, Oracle database relies on OS clock, as well as no date column type that can store timezone setting (similar to MS SQL Server today).

Timezone aware column type, TIMESTAMP WITH TIME ZONE, introduced much later, but many DBA and developers don't have a good knowledge about OS timezone.

Date DB Function

In Oracle 12c to 21c, DB has following 4 date functions, which has different behavior on timezone
  • sysdate - Uses OS timezone
    • E.g. select sysdate from dual;
    • E.g. insert into [user table] values (sysdate);
  • systimestamp - Uses OS timezone
    • E.g. select systimestamp from dual;
    • E.g. insert into [user table] values (systimestamp);
  • current_date - uses DB session timezone, similar to sysdate
    • E.g. select sessiontimezone from dual;
    • E.g. insert into [user table] values (sessiontimezone);
  • LOCALTIMESTAMP
  •  - uses DB session timezone, similar to systimestamp
    • E.g. select sessiontimezone from dual;
    • E.g. insert into [user table] values (sessiontimezone);

Timezone Configuration At DB Level

I won't discuss OS timezone configuration, as this post is mainly clarifying DB level timezone setting that confused many DBA or developers.

In above DB functions, the DB session's timezone depends on sessiontimezone. Default is DB timezone, which set by following:
  • ALTER DATABASE SET TIME_ZONE = 'US/New_York';
  • CREATE DATABASE ..... TIME_ZONE = 'US/New_York';
At user level, you can configure it using
  • ALTER SESSION SET TIME_ZONE='US/Eastern';
You can check its current value by using:
  • sessiontimezone - uses DB session timezone, similar to sysdate
    • E.g. select sessiontimezone from dual;

Troubleshooting Highlight

When verifying it, always display the sessiontimezone together with 1 systimestamp, and 1 current_date, e.g.
select sessiontimezone , sysdate, current_date from dual;

This will ensure that you cover both OS and DB timezone, and displaying DB timezone value

Note: systimestamp will display OS timezone value

Ref: Oracle 19c DB Time Functions: https://docs.oracle.com/en/database/oracle/oracle-database/19/nlspg/datetime-data-types-and-time-zone-support.html