agora inbox for pljava-dev@postgresql.org  
help / color / mirror / Atom feed
[Pljava-dev] How to configure security manager?
6+ messages / 0 participants
[nested] [flat]

* [Pljava-dev] How to configure security manager?
@ 2005-10-29 01:56 
  2005-10-29 08:45 ` [Pljava-dev] How to configure security manager? 
  0 siblings, 1 reply; 6+ messages in thread

From:  @ 2005-10-29 01:56 UTC (permalink / raw)

Hi,
  The user guide didn't seem to have the depth for this, but how can I change 
the _java_ security policy to relieve the restriction below? I want to have a 
function/trigger with certain (full) system permissions (files,sockets, 
system, etc.)

Thank you!
Darren

rath.msnm.NotificationProcessor:
java.lang.reflect.InvocationTargetException
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:324)
        at rath.msnm.AbstractProcessor.run(AbstractProcessor.java:373)
Caused by: java.lang.ExceptionInInitializerError
        at 
rath.msnm.NotificationProcessor.processAuth(NotificationProcessor.java:360)
        ... 5 more
Caused by: java.lang.SecurityException
        at 
org.postgresql.pljava.internal.Backend$PLJavaSecurityManager.assertPermission(Backend.java:153)
        at 
org.postgresql.pljava.internal.Backend$PLJavaSecurityManager.nonRecursiveCheck(Backend.java:128)
        at 
org.postgresql.pljava.internal.Backend$PLJavaSecurityManager.checkPermission(Backend.java:106)
        at java.lang.System.setProperty(System.java:654)
        at rath.msnm.util.TWN.<clinit>(TWN.java:61)
        ... 6 more




^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* [Pljava-dev] How to configure security manager?
  2005-10-29 01:56 [Pljava-dev] How to configure security manager? 
@ 2005-10-29 08:45 ` 
  0 siblings, 0 replies; 6+ messages in thread

From:  @ 2005-10-29 08:45 UTC (permalink / raw)

Hi Darren,
Short version:
You need to declare your special trigger with 'LANGUAGE javaU' and use 
an administrator account when you install it.

Longer...
PostgreSQL stipulates that a PL should provider one trusted and one 
untrusted language handler. The convention is that the untrusted one 
uses the name of the trusted with an appended 'U'. A trusted handler 
cannot access external resources (the file system in particular) but the 
untrusted one has no such restrictions. Only administrator accounts can 
install the latter but anyone can call it once its installed. PL/Java 
uses a standard SecurityManager to enforce this behavior and there's no 
way to configure that manager at present.

Regards,
Thomas Hallgren

dgovoni at metadapt.com wrote:
> Hi,
>   The user guide didn't seem to have the depth for this, but how can I change 
> the _java_ security policy to relieve the restriction below? I want to have a 
> function/trigger with certain (full) system permissions (files,sockets, 
> system, etc.)
>
> Thank you!
> Darren
>
> rath.msnm.NotificationProcessor:
> java.lang.reflect.InvocationTargetException
>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>         at 
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>         at 
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>         at java.lang.reflect.Method.invoke(Method.java:324)
>         at rath.msnm.AbstractProcessor.run(AbstractProcessor.java:373)
> Caused by: java.lang.ExceptionInInitializerError
>         at 
> rath.msnm.NotificationProcessor.processAuth(NotificationProcessor.java:360)
>         ... 5 more
> Caused by: java.lang.SecurityException
>         at 
> org.postgresql.pljava.internal.Backend$PLJavaSecurityManager.assertPermission(Backend.java:153)
>         at 
> org.postgresql.pljava.internal.Backend$PLJavaSecurityManager.nonRecursiveCheck(Backend.java:128)
>         at 
> org.postgresql.pljava.internal.Backend$PLJavaSecurityManager.checkPermission(Backend.java:106)
>         at java.lang.System.setProperty(System.java:654)
>         at rath.msnm.util.TWN.<clinit>(TWN.java:61)
>         ... 6 more
> _______________________________________________
> Pljava-dev mailing list
> Pljava-dev at gborg.postgresql.org
> http://gborg.postgresql.org/mailman/listinfo/pljava-dev
>   





^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* [Pljava-dev] How to configure security manager?
@ 2005-10-29 20:28 
  2005-10-29 22:52 ` [Pljava-dev] How to configure security manager? 
  0 siblings, 1 reply; 6+ messages in thread

From:  @ 2005-10-29 20:28 UTC (permalink / raw)

Hi Thomas,
  Kind thanks for the response. Yeah, I tried both 'java' and 'javaU' 
installing as user 'postgres' under linux. Should I do so as root? I also 
tried changing the java.security policy for the jvm in the library path to 
grant 'all permission' (as a long shot) with same result. I removed and 
reinstalled said jars. I'm sure I'm missing something, but will keep trying.

Regards,
Darren




^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* [Pljava-dev] How to configure security manager?
  2005-10-29 20:28 [Pljava-dev] How to configure security manager? 
@ 2005-10-29 22:52 ` 
  2005-10-30 00:59   ` [Pljava-dev] How to configure security manager? 
  0 siblings, 1 reply; 6+ messages in thread

From:  @ 2005-10-29 22:52 UTC (permalink / raw)

dgovoni at metadapt.com wrote:
> Hi Thomas,
>   Kind thanks for the response. Yeah, I tried both 'java' and 'javaU' 
> installing as user 'postgres' under linux. Should I do so as root? I also 
> tried changing the java.security policy for the jvm in the library path to 
> grant 'all permission' (as a long shot) with same result. I removed and 
> reinstalled said jars. I'm sure I'm missing something, but will keep trying.
>   
Sorry. I got confused when you said you wanted to use files and sockets. 
Now I see that you are getting a security exception while attempting to 
set a system property that begins with the string 'java.'. Those 
properties are not allowed to change even in untrusted mode since that 
would blow a hole in the rest of the security scheme. What property are 
you trying to set in the class initializer of  rath.msnm.util.TWN that 
starts with 'java.'?

Regards,
Thomas Hallgren





^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* [Pljava-dev] How to configure security manager?
  2005-10-29 20:28 [Pljava-dev] How to configure security manager? 
  2005-10-29 22:52 ` [Pljava-dev] How to configure security manager? 
@ 2005-10-30 00:59   ` 
  2005-10-30 07:39     ` [Pljava-dev] How to configure security manager? 
  0 siblings, 1 reply; 6+ messages in thread

From:  @ 2005-10-30 00:59 UTC (permalink / raw)

Apparently the third-party code I'm using is trying to do this:

        java.security.Security.addProvider(
            new com.sun.net.ssl.internal.ssl.Provider());
        System.setProperty( "java.protocol.handler.pkgs", 
            "com.sun.net.ssl.internal.www.protocol" );

It's necessary to open https URL connections. Essentially, what I'm trying to 
do is write a trigger that relays data inserted into a table to a MSN instant 
message account. This is the only place it tries to set a system property. Is 
there a way I can set system properties from the postgres.conf file or pljava 
such that the JVM the trigger is running in will see them?

Darren

On Saturday 29 October 2005 18:52, Thomas Hallgren wrote:
> dgovoni at metadapt.com wrote:
> > Hi Thomas,
> >   Kind thanks for the response. Yeah, I tried both 'java' and 'javaU'
> > installing as user 'postgres' under linux. Should I do so as root? I also
> > tried changing the java.security policy for the jvm in the library path
> > to grant 'all permission' (as a long shot) with same result. I removed
> > and reinstalled said jars. I'm sure I'm missing something, but will keep
> > trying.
>
> Sorry. I got confused when you said you wanted to use files and sockets.
> Now I see that you are getting a security exception while attempting to
> set a system property that begins with the string 'java.'. Those
> properties are not allowed to change even in untrusted mode since that
> would blow a hole in the rest of the security scheme. What property are
> you trying to set in the class initializer of  rath.msnm.util.TWN that
> starts with 'java.'?
>
> Regards,
> Thomas Hallgren




^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* [Pljava-dev] How to configure security manager?
  2005-10-29 20:28 [Pljava-dev] How to configure security manager? 
  2005-10-29 22:52 ` [Pljava-dev] How to configure security manager? 
  2005-10-30 00:59   ` [Pljava-dev] How to configure security manager? 
@ 2005-10-30 07:39     ` 
  0 siblings, 0 replies; 6+ messages in thread

From:  @ 2005-10-30 07:39 UTC (permalink / raw)

OK, I'll have to fix that. I'll submit a patch soon. And yes, you can 
use the pljava.vmoptions = '-Dxxx=yyy' to set system properties. If you 
have the source and can compile, you can also remove the 'else if' 
statement that surrounds the line where the exception is generated 
(assertPermission in Backend.java line 153).

Regards,
Thomas Hallgen

dgovoni at metadapt.com wrote:
> Apparently the third-party code I'm using is trying to do this:
>
>         java.security.Security.addProvider(
>             new com.sun.net.ssl.internal.ssl.Provider());
>         System.setProperty( "java.protocol.handler.pkgs", 
>             "com.sun.net.ssl.internal.www.protocol" );
>
> It's necessary to open https URL connections. Essentially, what I'm trying to 
> do is write a trigger that relays data inserted into a table to a MSN instant 
> message account. This is the only place it tries to set a system property. Is 
> there a way I can set system properties from the postgres.conf file or pljava 
> such that the JVM the trigger is running in will see them?
>
> Darren
>
> On Saturday 29 October 2005 18:52, Thomas Hallgren wrote:
>   
>> dgovoni at metadapt.com wrote:
>>     
>>> Hi Thomas,
>>>   Kind thanks for the response. Yeah, I tried both 'java' and 'javaU'
>>> installing as user 'postgres' under linux. Should I do so as root? I also
>>> tried changing the java.security policy for the jvm in the library path
>>> to grant 'all permission' (as a long shot) with same result. I removed
>>> and reinstalled said jars. I'm sure I'm missing something, but will keep
>>> trying.
>>>       
>> Sorry. I got confused when you said you wanted to use files and sockets.
>> Now I see that you are getting a security exception while attempting to
>> set a system property that begins with the string 'java.'. Those
>> properties are not allowed to change even in untrusted mode since that
>> would blow a hole in the rest of the security scheme. What property are
>> you trying to set in the class initializer of  rath.msnm.util.TWN that
>> starts with 'java.'?
>>
>> Regards,
>> Thomas Hallgren
>>     





^ permalink  raw  reply  [nested|flat] 6+ messages in thread


end of thread, other threads:[~2005-10-30 07:39 UTC | newest]

Thread overview: 6+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2005-10-29 01:56 [Pljava-dev] How to configure security manager? 
2005-10-29 08:45 ` 
2005-10-29 20:28 [Pljava-dev] How to configure security manager? 
2005-10-29 22:52 ` 
2005-10-30 00:59   ` 
2005-10-30 07:39     ` 

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox