I am running into a Java security problem. I have an agent which uses the pdfbox-1.7.1.jar to decrypt a PDF whose password I know. The jar has been placed in /jvm/lib/ext on both the server and my client, and I get this little beauty of a stack trace:
java.lang.SecurityException
at java.lang.SecurityManager.checkPermission(SecurityManager.java:582)
at COM.ibm.JEmpower.applet.AppletSecurity.checkSecurityPermission(AppletSecurity.java:1332)
at COM.ibm.JEmpower.applet.AppletSecurity.checkPermission(AppletSecurity.java:1613)
at COM.ibm.JEmpower.applet.AppletSecurity.checkPermission(AppletSecurity.java:1464)
at java.lang.SecurityManager.checkSecurityAccess(SecurityManager.java:1725)
at java.security.Security.insertProviderAt(Security.java:190)
at java.security.Security.addProvider(Security.java:210)
at org.apache.pdfbox.pdmodel.encryption.SecurityHandlersManager.getInstance(SecurityHandlersManager.java:146)
at org.apache.pdfbox.pdmodel.PDDocument.openProtection(PDDocument.java:1365)
at org.apache.pdfbox.pdmodel.PDDocument.decrypt(PDDocument.java:798)
at com.magerman.hremail.prep1docc.PDFDecryptor.decrypt(Unknown Source)
at com.magerman.hremail.prep1docc.MetaAttachment.decrypt(Unknown Source)
at com.magerman.hremail.prep1docc.MetaDocContainingAttachments.removePasswordOfPDFAttachments(Unknown Source)
at com.magerman.hremail.prep1docc.EPDFPreparerFactory.generateAttachmentsTriggerDocs(Unknown Source)
at com.magerman.hremail.prep1docc.EPDFPreparerFactory.run(Unknown Source)
at com.magerman.hremail.prep1docc.BaseClass.NotesMain(Unknown Source)
at lotus.domino.AgentBase.runNotes(Unknown Source)
at lotus.domino.NotesThread.run(Unknown Source)
Both Client and Server are using 8.5.3. The Agent security level is set to 3. Putting the jars in the agent itself does not help. The signer of the agent is full admin on the server. The security exception seems to point at "insertProviderAt"
This is what I tried:
putting
grant {
permission java.security.AllPermission;
}
solves my problem, but I will never get this past my eagle-eyed admin.
I am trying to reduce the scope of the permission to just the database but the documentation here: http://docs.oracle.com/javase/7/docs/technotes/guides/security/PolicyFiles.html did not really tell me how to input a notes database.
I looked into Stephan Wissel's article on Xpages Java security here: http://www.wissel.net/blog/d6plinks/SHWL-8JYAT5 and inserted the following into my /jvm/lib/security/java.policy file:
grant codeBase "xspnsf://server:0/development/hre-mail/hre-mail2_0/hre-mail_(2_0)_dev.nsf/-" {
permission java.security.AllPermission;
};
but that did not work either, I suppose because my codeBase syntax is not valid for the nsf database but only for webpages.
I am also trying to reduce the Permission to that which is really needed, and looking at the documentation here: http://docs.oracle.com/javase/1.4.2/docs/guide/security/permissions.html
implies that I have to do something like
java.security.SecurityPermission "insertProvider.{name}"
but I have no idea what {name} should be.
I also read Mikkel's article on http://lekkimworld.com/2013/06/20/java_in_notes_domino_explained_on_java_security_and_how_it_relates_to_notes_domino.html
but my brain fried at about the middle of the page. In particular, I am not sure how to actually implement this method. Could you hold my hand and walk me through please?
Whilst I'm at it, am I right in assuming that whenever I put new jars in /jvm/lib/ext, all I need to do is a
tell http restart
to have the JVM reload? I am assuming Domino is using a single JVM for Xpages, Agents, and the HTTP Task, is this right.
Also, am I right that I need to restart the server for any new policies in java.policy to be effective?
Any ideas?