Re: error Dynamic stub download

Gregg Wonderly <[email protected]>
Newsgroups gmane.comp.java.sun.rmi
Message-ID <[email protected]>
Deleep Kumar wrote:
> 3. error that i am getting here is
>   the  client stub not found
> java.lang.ClassNotFoundException: SimuClient_Stub (no security manager:
> RMI class loader disabled)

Yes, you must configure a security manager using something like

        if( System.getSecurityManager() == null ) {
                System.setSecurityManager( new RMISecurityManager() );
        }

in the startup of your application that will download code.  You must also
install a security policy with

        -Djava.security.policy=<path to file>

This policy would typically provide grants to the codesource URLs to allow the
downloaded code to perform specific actions.  The wide open security policy,

grant {
        permission java.security.AllPermission;
};

is what most people use for quick testing setups.  A mild level of protection is
better with something like

grant codebase http://myserver.url:port/jarfile.jar {
        permission java.security.AllPermission;
};

This will keep code from random places from being able to access resources on
your machine (except for threading and memory exhaustion, see the note below
about JERI).

For a more publically visible, or externally modified jar file, you can include
signing constraints, and also enumerate all the permissions that you want to
give that code.

The RMI JRMP implementation does not provide protection against deserialization
attacks.  The Jini Extensible Remote Invocation (JERI) stack that is available
as part of Jini2.0 and later includes protection from deserialization attacks
through the use of authentication and authorizations for download permissions.

With JRMP, as a remote procedure call comes into the VM, the arguments to the
method call, are deserialized prior to having permissions applied, because the
code sources are not resolved until the download and instantiation of the
objects is complete.  During the deserialization process, certain attacks are
possible.  JERI provides a door you can close to this by using authentication as
the barrier that has to be crossed before deserialization occurs.  Thus, the
server can ask for a valid, trusted authentication to be asserted.  If none is,
the method call stops there, with no deserialization occuring.

Gregg Wonderly

===========================================================================
To unsubscribe, send email to [email protected] and include in the body
of the message "signoff RMI-USERS".  For general help, send email to
[email protected] and include in the body of the message "help".

For a list of frequently asked RMI questions please refer to:
http://java.sun.com/j2se/1.3/docs/guide/rmi/faq.html

To view past RMI-USERS postings, please see:
http://archives.java.sun.com/archives/rmi-users.html
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.