PTA not starting - Failed to get password to java keystore
Symptom
PTA won't start.
The following errors appear in the diamond log:-
LOG | [2023-01-10|14:26:12.735|CET] | ERROR | {aid=serviceInvoker} | {sid=} | {rid=} | {tid=main} | com.cyberark.diamond.utils.SecurityUtil.getKeyStorePassword(SecurityUtil.java:393) - GNL0197E :: Failed to get password to java keystore.
java.nio.file.AccessDeniedException: /opt/tomcat/diamond-resources/components_keystore.key
...
LOG | [2023-01-10|14:26:13.306|CET] | ERROR | {aid=serviceInvoker} | {sid=} | {rid=} | {tid=main} | com.cyberark.diamond.utils.SecurityUtil.getKeyStorePassword(SecurityUtil.java:393) - GNL0197E :: Failed to get password to java keystore.
java.nio.file.AccessDeniedException: /opt/tomcat/diamond-resources/keystore.key
Environment
N/A Privileged Access Manager (PAM, self-hosted) PTA
PTA
Cause
This is caused by incorrect permissions on the keystore files, the containing directory or the logical link pointing to the true location of the keystore files.
Ensure that the .key and .keystore files in /opt/tomcat/diamond-resources (/etc/opt/pta/diamond-resources) have the following permissions and the correct user and group owners :-
-rwxrwx---. 1 tomcat pta_server 44 Oct 10 2020 components_keystore_encryption.key
-rwxrwx---. 1 tomcat pta_server 44 Oct 10 2020 components_keystore.key
-rwxrwx---. 1 tomcat pta_server 3307 Jan 19 13:51 components_pwd.keystore
-rwxrwx---. 1 tomcat pta_server 44 Oct 10 2020 keystore_encryption.key
-rwxr-x---. 1 tomcat pta_server 44 Oct 10 2020 keystore.key
-rwxrwx---. 1 tomcat pta_server 294 Oct 10 2020 public.key
-rwxrwx---. 1 tomcat pta_server 3300 Jan 24 23:50 pwd.keystore
Also check in the parent directory, (/opt/tomcat), that the logical link to the true location of the diamond-resources directory has the following permissions and user and group owners:-
lrwxrwxrwx. 1 tomcat pta_server 30 Jan 3 19:43 diamond-resources -> /etc/opt/pta/diamond-resources
Resolution
Change any incorrect permissions using the chmod command. For example, to make permissions to the public.key file to be -rwxrwx--- enter the following on the PTA server from the containing directory:-
chmod 770 public.key
(changing keystore.key to -rwxr-x--- would be chmod 750 keystore.key)
Change any incorrect owner using the chown command. To change the owner of the public.key file to tomcat, enter the following command:-
chown tomcat public.key
Change any incorrect group owner using the chgrp command. To change the group owner of the public.key file to pta_server, enter the following command:-
chgrp pta_server public.key