Big Bug Ban

兴趣 践行 创新

tomcat6 policy.d 安全策略

 

新买的vps总是奇奇怪怪的..

tomcat一启动就250M内存占了..

之前是不能改端口..除了8080的端口都无效.

现在是不能访问/tmp.

搞了半天原来是tomcat6的安全策略

直接编辑服务文件

vim /etc/init.d/tomcat6

把里面的TOMCAT6_SECURITY改掉

# Use the Java security manager? (yes/no)
TOMCAT6_SECURITY=no
# Default Java options
# Set java.awt.headless=true if JAVA_OPTS is not set so the
# Xalan XSL transformer can work without X11 display on JDK 1.4+
# It also looks like the default heap size of 64M is not enough for most cases
# so the maximum heap size is set to 128M
if [ -z "$JAVA_OPTS" ]; then
        JAVA_OPTS="-Djava.awt.headless=true -Xmx64M"
fi

另外也可以启用它..然后在tomcat的配置目录下.一般是/etc/tomcat6/policy.d/

里面有几个配置文件..都是管理tomcat的权限..比如是否可以读写某文件啊.

是否可以获取操作系统信息啊.等等之类的

permission java.io.FilePermission "/tmp", "read,write,delete";

也可以这样加上自己的

还有更多的权限可以参考这个

http://download.oracle.com/javase/1.4.2/docs/api/java/security/Permission.html

Written by princehaku

8月 26th, 2010 at 9:12 下午

Posted in java

Tagged with

with one comment

One Response to 'tomcat6 policy.d 安全策略'

Subscribe to comments with RSS or TrackBack to 'tomcat6 policy.d 安全策略'.

  1. 啊四大四大

    princehaku

    26 8月 10 at 11:28 下午

Leave a Reply