EJBCA with Luna HSM issues #801
Replies: 4 comments 1 reply
-
I believe your are in containerized environment so you need to move the luna crypto library libCryptoki2_64.so or libCryptoki2.so in your container fillesystem to make it work. Besides this you must also need to edit web.properties. to check the container file system you can run the following command docker container exec ls to copy any file with continer file system you can run following command |
Beta Was this translation helpful? Give feedback.
-
I do it by mounting. There is actually a command last in the Docker Hub page that gives an example: Mounting it in the right path makes it so you don't have to edit any properties files. There are more detailed HSM integration examples on out GitHub: https://github.com/Keyfactor/keyfactorcommunity/tree/main/hsm-integration If the log says "PKCS#11 library /usr/safenet/lunaclient/lib/libCryptoki2_64.so was not detected in file system and will not be available." typically means privilege issues if you have mounted the filesystem in the right location. The file accessed by the container... |
Beta Was this translation helpful? Give feedback.
-
@martincorr , just in case review the permissions of
|
Beta Was this translation helpful? Give feedback.
-
thanks guys, got it working in the end. for anyone with a similar issue this is what I did: I tried installing the minimal luna client install within docker but it just wasnt finding libraries. The thales guides on this arent that clear (to me) Instead I:
In some versions of java, internal classes within sunpkcs11 are not exported. Ejbca uses the sunpkcs11 classes for mechanisms etc so it was throwing exceptions around classes not being exported. So in the app server startup I modified the java options to include:
as an aside, ejbca standard docker image comes with all the supported hsms included in the config. You should be able to override this by supplying your own web.properties but this didnt seem to have any effect. So I just had to make the pkcs11 lib appear in the expected place. After restart I could see the hsm and enumerate the slots when adding a crypto token. thanks all for your help and advice. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi Im trying to get ejbca to work with Luna HSM but failing. luna client is installed and I can view the slots via lunacm. running ejbca standard docker image. running docker as root.
When I start ejbca with debug logging I see this:
ejbca-ce | 2025-02-04 15:16:27,563+0000 DEBUG [org.ejbca.config.WebConfiguration] (default task-1) PKCS#11 library /usr/safenet/lunaclient/lib/libCryptoki2_64.so was not detected in file system and will not be available.
but the file is there:
sh-4.2$ pwd
/usr/safenet/lunaclient/lib
sh-4.2$ ls -l
total 32164
-rwxr-xr-x 1 root root 974536 Mar 22 2024 libcklog2.so
-rwxr-xr-x 1 root root 10716192 Mar 22 2024 libCryptoki2_64.so
-rwxr-xr-x 1 root root 10716192 Jan 20 13:47 libCryptoki2.so
-rwxr-xr-x 1 root root 146272 Mar 22 2024 libethsm.so
-rwxr-xr-x 1 root root 4849824 Mar 22 2024 libshim.so
-r-xr-x--- 1 root hsmusers 5519032 Mar 22 2024 libSoftToken.so
Ive followed the guide here https://hub.docker.com/r/keyfactor/ejbca-ce Im running on aws and when I change my local config I can toggle seeing the aws token or not.
Any ideas what Im doing wrong or what else I can check?
Thanks, Martin
Beta Was this translation helpful? Give feedback.
All reactions