Win a copy of Terraform in Action this week in the Cloud forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Rob Spoor
  • Bear Bibeault
Saloon Keepers:
  • Jesse Silverman
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • Al Hobbs
  • salvin francis

Java2 Security Permissions

 
Ranch Hand
Posts: 173
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Help. I'm lost in the muck of Java2 Security. I'm fine until I get to connecting to the database, the BOOM! it blows up. I have a was.policy set up in the META-INF of both the EAR and the WAR. Here's the error:

110.110.110.110:4100 : access denied (java.net.SocketPermission 110.110.110.110:4100 connect,resolve)

Here's my was.policy:

grant codeBase "file:${application}" {
permission java.security.AllPermission;
};

grant codeBase "file:${jars}" {
permission java.security.AllPermission;
};

grant codeBase "file:${connectorComponent}" {
permission java.security.AllPermission;
};

grant codeBase "file:${webComponent}" {
permission java.security.AllPermission;
};

grant codeBase "file:${ejbComponent}" {
permission java.security.AllPermission;
};

grant {
permission java.security.AllPermission;
};

// The following permissions apply to all the components under the application.
grant codeBase "file:${application}" {
// The following are required by JavaMail
permission java.io.FilePermission "${was.install.root}${/}lib${/}mail-impl.jar","read";
permission java.io.FilePermission "${was.install.root}${/}lib${/}activation-impl.jar","read";
permission java.net.SocketPermission "*", "connect,resolve";
permission java.util.PropertyPermission "*", "read";
};

// The following permissions apply to all utility .jar files (other
// than enterprise beans JAR files) in the application.
grant codeBase "file:${jars}" {
permission java.net.SocketPermission "*", "connect,resolve";
permission java.util.PropertyPermission "*", "read";
};

// The following permissions apply to connector resources within the application
grant codeBase "file:${connectorComponent}" {
permission java.net.SocketPermission "*", "connect,resolve";
permission java.util.PropertyPermission "*", "read";
};

// The following permissions apply to all the Web modules (.war files)
// within the application.
grant codeBase "file:${webComponent}" {
permission java.io.FilePermission "${was.module.path}${/}-", "read, write";
// where "was.module.path" is the path where the Web module is
// installed. Refer to Dynamic policy concepts for other symbols.
permission java.lang.RuntimePermission "*";
permission java.net.SocketPermission "*", "connect,resolve";
permission java.util.PropertyPermission "*", "read";
};

// The following permissions apply to all the EJB modules within the application.
grant codeBase "file:${ejbComponent}" {
permission java.lang.RuntimePermission "*";
permission java.net.SocketPermission "*", "connect,resolve";
permission java.util.PropertyPermission "*", "read";
};

Obviously, I've copied things throughout since I have very little clue as to what I'm doing. Can anyone clue me in? Thanks.

Pat
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic