JVM dns cache disabling works only from property file
Platform: Windows XP/Sun Java 6
It works when I disable DNS caching in the java.security file: networkaddress.cache.ttl = 0
But when I tried to pass this param from an applet, it doesn't seem to work:
<applet id="MiaApplet"
.....
<property name="networkaddress.cache.ttl" value="0"/>
</applet>
Same issue when I use setProperty programmatically. I开发者_JS百科 did read about bugs in the JVM implementation.
Any pointers on how to make this work using System property passing approach to an applet as above or programmatic way? File way is a hassle.
An applet is code from outside, hence the JVM typically runs it under restriction by a security manager.
DNS spoofing being a popular way to attack a system, the property networkaddress.cache.ttl
, which you'd like to change, is placed under the authority of the security manager; the value can be configured in C:\Programme\Java\jre6\lib\security\java.security
.
The Java documentation page "Networking Properties" for Java 6 says that the default value for this property is -1 in the presence of a security manager, which means forever.
The security manager will likely veto your applet's attempt to change this property.
Java security: How to install the security manager and customize your security policy http://www.javaworld.com/javaworld/jw-11-1997/jw-11-hood.html
精彩评论