Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Policy File

 
Farouk Mohamed1
Ranch Hand
Posts: 113
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi
I am having a swing app for start/stop and uses RMIsecurity Manager set and as well a policy file. But when it is trying to get the access for key "user.dir" it throws an AccessControlException .
I am using Visual Age for java3.0 jdk1.2 and the properties for the application is set to Djava.security.policy="C:\\IBMVJava2\\ide\\project_resources\\SCJD4\\scjd.policy"
the policy file is

/* AUTOMATICALLY GENERATED ON Sat Nov 10 22:54:34 GMT+00:00 2001*/
/* DO NOT EDIT */
grant {
permission java.util.PropertyPermission "user.dir", "read";
permission java.util.PropertyPermission "file.separator", "read";
permission java.net.SocketPermission "*:1024-65535", "connect,accept";
permission java.net.SocketPermission "*:80", "connect,accept, resolve";
permission java.io.FilePermission "<>", "read, execute, write";
};
When i debug it fails with AccessControlException when it finds access for key "user.dir" and i dont understand how and where will the policy file intervene and say you have access the code steps thro doesnt seem to touch the policy file, Can you pelase
Explain
Thanks in advance
Farouk
Please can anyone tell
 
Farouk Mohamed1
Ranch Hand
Posts: 113
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please guys
Farouk
 
Mark Spritzler
ranger
Sheriff
Posts: 17278
6
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Not that this is a direct answer to your question. But I had the same problem. My solution was not to use the RMISecurityManager in my Server (GUI). I am however using it in the client, and it works fine there.
In both Server and Client I am still starting java with a policy file.
Mark
 
Farouk Mohamed1
Ranch Hand
Posts: 113
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Mark
I dont understand why we need a policy file inthe client because the client does a lookup and it is up to the server to allow the client or not.
The idea of having a RMISecurityManager in the server is to completely block request and all allow only those which policy gives access to .
So if you say you have no RMISecurity Manager present then by default all access is given to the server.
Please tell me if I am wrong and also In either case can you tell me why you have policy file in the client?
And how policy file is used?
Farouk
 
Mark Spritzler
ranger
Sheriff
Posts: 17278
6
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The reason why I said I wasn't sure if that was the answer that you were looking for, is that I am not positive that my way is correct either.
However, my thinking was, that the Server is on the server, and the person starting and running the server has to be on the server and therefore can do anything they want anyway. You can not start the server remotely, or not so in my case
But the reason why I have it on the client, is that the client could be anyone, and I would only want them to only have certain permissions.
Think about Applets, where is the security there, on the client, so that an applet can't hurt the client. At least that's what I believe, and I have been known to be wrong, often.
Mark
 
Farouk Mohamed1
Ranch Hand
Posts: 113
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Mark
Thanks for your reply, An applet runs under browser security and if you need the applet to do anything with client machine then it has to be signed otherwise unsigned applets are not allowed to touch the client machine. This is how security in applet works so in either case you dont need a policy file in a client and it means nothing to the client.
In case of applications that is why we provide our own security manager and use a policy file to provide permissions
Please your comments
Farouk
 
Mark Spritzler
ranger
Sheriff
Posts: 17278
6
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I still think that it is the client that needs the policy and such. When the server is run, it is run by someone directly on the server, which means they already have permission to do stuff to the server computer, so why would you need security.
You need to block the client from 1) getting hurt by the server, and 2, that it does nothing to the server. I think that both of these are handled at the client.
Mark
 
Farouk Mohamed1
Ranch Hand
Posts: 113
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Mark
The client can hurt the server in many ways
If the server opens the machine and welcomes any request then the client can affect the server with a malicious request.
As well if the server do not want the clients to access any file in the system exept db.db file then they should stop clients accessing them. So that is why we introduce RMISecurityManager which blocks everytthing and allow a policy file to granct specific permissions.
The client doesnt not need a policy file to run the application as he is not doing anythin with his machine resources and everything is accessed remotely
Please getting more intrested
Comments
Farouk
 
Farouk Mohamed1
Ranch Hand
Posts: 113
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Mark and peter have you left me alone?
Farouk
 
Mark Spritzler
ranger
Sheriff
Posts: 17278
6
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I still think that the only person that can access the db.db file is the Server itself. Whether there is or isn't an RMISecurityManager. If the server doesn't have one, but the client does, I think that stops the client form accessing the Server db.db file.
Here is my thinking. If I have a client with no RMIScerutiy, I can write the client to do anything to the server, without calling our RMI Server. I mean it doesn't ahve to lookup the object, it could just set a URL to the server, and do something. I am just taking our DB Server out of the equation and thinking what could the client still do to contact the Server machine.
I am using the word think, becuase I could be wrong.
Mark
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic