I want to host a game called Minecraft and let people upload their own Java JAR.
Now I want to restrict them to a certain port range.
As running all JVM's in virtual boxes is overkill we just stack them, but how do I prevent a user of using the default port?
Maybe something with javaagent in startup line?
Would this be a good sample code?
System.setSecurityManager(...); // invoke the jar with a URLClassLoader
preguntado el 01 de febrero de 12 a las 14:02
You should be able to modify the security policy for the JVM to restrict network access. Some info here: http://docs.oracle.com/javase/1.4.2/docs/guide/security/permissions.html#SocketPermission