Installing and configuring the Luna HSM client
Install and configure the Luna HSM client on the same machine on which the eperi eperi sEcure Platform is installed. Alternatively, you can also add it to a Docker container as described here: Installing Luna Minimal Client on Linux Using Docker. The eperi sEcure Platform uses the client to access the Luna HSM.
Procedure
-
Install the Luna HSM client as described in the manual provided by the
manufacturer.
Part of this installation will be the Java JCE provider and it’s JNI part which can be found at:
- /usr/safenet/lunaclient/jsp/lib/libLunaAPI.so
- /usr/safenet/lunaclient/jsp/lib/LunaProvider.jar
-
Register the path to the above libraries as follows:
- Edit the file /opt/eperi/gateway/tomcat/conf/javaopts.
-
Add the following path info at the end of the first line:
-Djava.library.path=$PATH:/usr/safenet/lunaclient/jsp/lib/E.g. if the first line contains the following:
Modify it as follows:-Xmx1024m -XX:MaxPermSize=128m-Xmx1024m -XX:MaxPermSize=128m -Djava.library.path=$PATH:/usr/safenet/lunaclient/jsp/lib/ - Save the javaopts file.
-
Make sure that the following directories and their contents all belong to the
group
hsmusers:/usr/safenet/lunaclient/cert /usr/safenet/lunaclient/cert/server /usr/safenet/lunaclient/bin /usr/safenet/lunaclient/lib /usr/safenet/lunaclient/jsp /usr/safenet/lunaclient/jsp/lib /etc/Chrystoki.conf -
Add the
eperiuser to thehsmusersgroup:sudo gpasswd --add eperi hsmusersNote: In case of insufficient permissions the eperi sEcure Platform will not be able to connect to the Luna HSM properly which will result in the following error:java.io.IOException: function 'CrystokiConnect failed' returns 0x0 -
Copy the Luna Chrystoki library file to the folder
JAVA_HOME/jre/lib.
Note: Please check the manufacturer's manual to find out which library to use for your operating system.
- Copy the LunaProvider.jar file to the folder /opt/eperi/gateway/tomcat/webapps/ROOT/WEB-INF/lib.
-
Optional: To facilitate troubleshooting, you could switch on logging by adding
the following entry to the /etc/Chrystoki.conf (Linux) or
C:\Program Files\SafeNet\LunaClient\crystoki.ini
(Windows):
For Linux:
Chrystoki2 = { LibUNIX=/usr/lib/libcklog2.so; } CkLog2 = { LibUNIX=/usr/lib/libCryptoki2.so; Enabled=1; File=/tmp/cklog.txt; Error=/tmp/error.txt; NewFormat=1; LoggingMask=ALL_FUNC; }For Windows:
[Chrystoki2] LibNT=c:\Program Files\SafeNet\LunaClient\cklog201.dll [CkLog2] LibNT=c:\Program Files\SafeNet\LunaClient\cryptoki.dll Enabled=1 File=c:\Program Files\SafeNet\LunaClient\cklog2.txt Error=c:\Program Files\SafeNet\LunaClient\error2.txt NewFormat=1 LoggingMask=ALL_FUNCCAUTION: Never insert TAB characters into the crystoki.ini (Windows) or crystoki.conf (Linux) file! -
Restart the eperi sEcure Platform by executing the following command:
sudo systemctl restart eperi-gatewayImportant: In a cluster setup, the changes must be made on every eperi sEcure Platform instance and each eperi sEcure Platform instance must be restarted.
