Thursday 3 March 2016

Using a Policy File with the Default Security Manager

Now that we’ve gone to the trouble of creating a policy file, let’s use it. You can tell the default security manager to use the policy file with another command-line option to the java interpreter:

 C:\> java -Djava.security.manager -Djava.security.policy=EvilEmpire.policy  
 EvilEmpire  
 Connected!  
EvilEmpire can now make its socket connection because we have explicitly granted it permission with a policy file. The default security manager still protects us in other ways, however. EvilEmpire cannot write or read files on the disk except in the directory it came from, and it cannot make connections to any other network addresses except the one we specified

0 comments:

Post a Comment