This blog contains experience gained over the years of implementing (and de-implementing) large scale IT applications/software.

SAP HANA – SSL Security Essential

The HeartBleed hack exposed the consequences of security holes in software designed to provide encryption of network traffic.
However, this doesn’t mean that all encryption software has holes and it’s certainly better to have some form of encryption than none at all.

I’ve watched numerous online demos, official training videos and worked on real life HANA instances.  All of these systems so far, have not enabled SSL (now called TLS)  between the HANA Studio and the SAP Host Agent or the HANA Studio to the HANA database.
This means that specific communication between the HANA Studio, the SAP Host Agent and the HANA database indexserver, is not encrypted.

The HTTP protocol has been around for a long time now (thanks Tim).
It is inherently insecure when using HTTP BASIC authentication, since the username and password which is passed over HTTP to a server that has requested authentication, is sent in the clear (unencrypted) but encoded in BASE64.
The BASIC authentication is used to authenticate the HANA Studio with the SAP Host Agent.

What does this mean with regards to SAP HANA and the SAP HANA Studio?
Well, it means that any user with a network packet sniffer (such as Wireshark) could intercept one vital password, that of the <sid>adm SUSE Linux user.

In a SAP HANA system, the software is installed and owned by the <sid>adm Linux user.  Usually <sid> is a unique identifier for each HANA system in a SAP landscape.  As an example, H10 or HAN or any other 3 alphanumeric combination (within certain SAP restrictions) can be used.
When the HANA Studio is used to control the HANA database instance (start up and shutdown), the HANA Studio user is prompted to enter the username and password for the <sid>adm user.
This username and password is then sent via HTTP to the SAP Host Agent installed on the HANA server.  The SAP Host Agent uses the username and password to start or stop the HANA database instance.
If the password for the <sid>adm user is obtained, it is possible for a malicious user to establish an SSH connection directly to the SUSE Linux server where the HANA instance is installed, then control the instance, or access the database directly using a command line interface for executing SQL statements.

Here’s a 6-step example which took me 10 minutes to setup, trace, collect the data and then login to the Linux server as an authorised user.

Step 1, Install and open Wireshark (on your PC) and start tracing for TCP connections to the HANA server on the Host Agent TCP port 5<xx>13.
Step 2, Launch HANA Studio (on your PC) and in the navigator right click and choose “Log On”:

HANA  Logon without SSL

Step 3, If you haven’t elected to save the username and password during previous use of the HANA Studio, you will be prompted.  Otherwise, the system will auto-logon to the Host Agent.
Step 4, Analyse the Wireshark capture.  You’re looking for the text “Authorization: Basic” in the TCP packets:

HANA Logon Wireshark trace

The actual string will look something like: 
Authorization: Basic aDEwYWRtOmhhbmFoYW5h
I’ve copied an example HTTP POST out to a text editor for easy viewing:

HANA SAPControl HTTP POST

POST /SAPControl HTTP/1.1
Accept: text/xml, text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2
Authorization: Basic aDEwYWRtOmhhbmFoYW5h
Content-Type: text/xml; charset=utf-8
Cache-Control: no-cache
Pragma: no-cache
User-Agent: Java/1.7.0_45
Host: hana01.fqdn.corp:51013
Connection: keep-alive
Content-Length: 248

Step 5, Decode the username and password in the BASIC authentication string using a base64 decoder.  It’s possible to use an online one:

HANA SAPControl HTTP POST BASE64 decoder

The output includes the username and password in the following format:
USERNAME:PASSWORD

Step 6, With our new found details, log onto the HANA server using an SSH terminal:

HANA Server Logon

From this point onward it’s possible to access any data in the HANA database using command line tools.

SUMMARY:
You MUST enable SSL (TLS) encryption of the HTTP communications between the HANA Studio and the SAP Host Agent.  Without this, you might as well put the password on a post-it note on your screen.
See https://service.sap.com/sap/support/notes/1718944

Another option would be to segregate the HANA Studio users on their own vLAN, or to firewall the SAP HANA Host Agent and HANA database indexserver ports, tying them to specific user PCs only.
Incidentally, the password for the SYSTEM user of the HANA database, is encrypted with SHA256.  The encrypted string is then compared with the already encrypted password in the HANA database in order to authenticate a user.
However, if you have not enabled SSL between the HANA Studio and the HANA database indexserver, then all the of data retrieved from the database is sent in the clear.  You don’t need to authenticate to the database if you can just read the network packets.  This is true of most database connections.

HANA Studio – Diagnosis Mode Connection Overload

Be careful when using HANA Studio in Diagnosis Mode with the refresh interval set to a low value.
When set to 5 seconds (the default), the number of connections opened to the HANA DB is one every 5 seconds:

HANA Diagnosis Mode refresh interval

If you check the number of connections with a tool such as TCPView or Process Monitor, you will see a very high number of ESTABLISHED connections over time:

 HANA client connections established

Note that the HANA DB SQL port is 3<xx>15.

Under certain heavy network load, you could be causing more strain on your PC, the network and the HANA server.

Simply decrease the refresh time and this will allow your PC to close off the un-wanted connections in time to create the new ones, reducing your CPU consumption.

HowTo: Check HANA LM Is Running

Scenario: You want to check if the SAP HANA Lifecycle Manager is running/installed.

The SAP HANA Lifecycle Manager is installed separately the HANA DB and runs in its own Java VM.
It’s installed by default into the “/usr/sap/hlm_bootstraps” directory and occupies ~700MB of disk space.

By default the HLM is not usually started with the instance.  It gets started when you call it from the HANA Studio, or if you manually start it from the Linux command line using the bootstrap-hlm.sh script located in “/usr/sap/hlm_bootstraps/<SID>/HLM”.

From HANA Studio, right click the HANA instance as SYSTEM, then select “Lifecycle Management“:

image

From the command line on the Linux server, as the <sid>adm Linux user:

> cd /usr/sap/hlm_bootstraps/H10/HLM
> ./bootstrap-hlm.sh

You will be dropped into the OSGI (Open Service Gateway Interface, see here: https://www.osgi.org/) command line.

HowTo: Disable HANA Web Dispatcher

Scenario: The SAP HANA Web Dispatcher seems to be automatically running in HANA 1.0 SPS70.  I am supposing that this is mainly for the XS-Engine.

If you have already removed the XS-Engine (see my post here), then you can also disable the Web Dispatcher as follows (this will save around 300MB of memory).

From HANA Studio, change the daemon.ini configuration parameter “sapwebdisp -> instances” to “0” for your host(s):

HANA sapwebdisp instances

Restart the HANA instance.
The Web Dispatcher process will be no longer present:

HANA processes no sapwebdisp

No more Web Dispatcher.

HowTo: Install HANA Lifecycle Manager

Scenario:  You’ve followed my previous post on how to install a basic HANA DB and now you would like to install HANA LM into the same instance so that you can patch HANA and perform other LM tasks.

What you will need:
– A working HANA DB instance.
– The HANA installation media (usually an ISO file).

This will take less than 10 minutes if you already have the install media.
I have already converted the HANA install media DVD into an ISO file so that I can easily mount it as a virtual cdrom in a VM.
If you haven’t converted the install media to an ISO, you can always upload the media directly, or if you’re working in a VM, you can use the Shared Folders functionality to share a folder directly from the host O/S to the guest SUSE Linux VM.

Mount the ISO as a cdrom (I’m using a Virtual Machine as my SUSE HANA server).

On the cdrom you will have a directory containing the installation media for the HANA LM tool:

# cd /media/DATA_UNITS/SAPHANALM_LINUX_X86_64

As the root Linux user, run the installation tool (note: your HANA system can be shutdown during this process, especially if you have a low amount of memory):

# ./hdbinst

SAP HANA Lifecycle Manager installation kit detected.

SAP HANA Database Installation Manager – SAP HANA HLM Installation 1.50.00.000000
*********************************************************************************
Options:
  SAP HANA system ID | Description
  ———————————————————
  H10                | SAP HANA Database H10 1.00.70.386119

Enter SAP HANA system ID [H10]:

Root user password. Mandatory for Distributed system with not configured Trusted SSH Connectivity, or                    else not applicable. [“”]:

Root user SSH passphrase. Optional for Distributed system with configured Trusted SSH Connectivity, or                    else not applicable. [“”]:

Checking installation…
Preparing package “SAP HANA lifecycle manager”…
Installing SAP HANA Lifecycle Manager to /hana/shared/H10/HLM…
Installing package ‘SAP HANA lifecycle manager’ …

Installation takes approximately 10 minutes.

From HANA Studio, you can now open the Lifecycle Manager:

SAP HANA Lifecycle Manager install