|
|
@ -4,10 +4,11 @@ import java.io.FileDescriptor;
|
|
|
|
import java.security.Permission;
|
|
|
|
import java.security.Permission;
|
|
|
|
|
|
|
|
|
|
|
|
import com.alibaba.arthas.deps.org.slf4j.Logger;
|
|
|
|
import com.alibaba.arthas.deps.org.slf4j.Logger;
|
|
|
|
|
|
|
|
import com.alibaba.arthas.deps.org.slf4j.LoggerFactory;
|
|
|
|
|
|
|
|
|
|
|
|
public class ArthasSecurityManager extends SecurityManager {
|
|
|
|
public class ArthasSecurityManager extends SecurityManager {
|
|
|
|
|
|
|
|
|
|
|
|
private Logger logger;
|
|
|
|
private Logger logger = LoggerFactory.getLogger(ArthasSecurityManager.class);
|
|
|
|
private SecurityManager delegate;
|
|
|
|
private SecurityManager delegate;
|
|
|
|
|
|
|
|
|
|
|
|
public ArthasSecurityManager(SecurityManager securityManager) {
|
|
|
|
public ArthasSecurityManager(SecurityManager securityManager) {
|
|
|
@ -16,227 +17,227 @@ public class ArthasSecurityManager extends SecurityManager {
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public void checkPermission(Permission perm) {
|
|
|
|
public void checkPermission(Permission perm) {
|
|
|
|
|
|
|
|
logger.info("checkPermission, perm: {}", perm);
|
|
|
|
if (this.delegate == null) {
|
|
|
|
if (this.delegate == null) {
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
logger.info("checkPermission, perm: {}", perm);
|
|
|
|
|
|
|
|
this.delegate.checkPermission(perm);
|
|
|
|
this.delegate.checkPermission(perm);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public void checkPermission(Permission perm, Object context) {
|
|
|
|
public void checkPermission(Permission perm, Object context) {
|
|
|
|
|
|
|
|
logger.info("checkPermission, perm: {}", perm);
|
|
|
|
if (this.delegate == null) {
|
|
|
|
if (this.delegate == null) {
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
logger.info("checkPermission, perm: {}", perm);
|
|
|
|
|
|
|
|
this.delegate.checkPermission(perm, context);
|
|
|
|
this.delegate.checkPermission(perm, context);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public void checkCreateClassLoader() {
|
|
|
|
public void checkCreateClassLoader() {
|
|
|
|
|
|
|
|
logger.info("checkCreateClassLoader");
|
|
|
|
if (this.delegate == null) {
|
|
|
|
if (this.delegate == null) {
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
logger.info("checkCreateClassLoader");
|
|
|
|
|
|
|
|
this.delegate.checkCreateClassLoader();
|
|
|
|
this.delegate.checkCreateClassLoader();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public void checkAccess(Thread t) {
|
|
|
|
public void checkAccess(Thread t) {
|
|
|
|
|
|
|
|
logger.info("checkAccess, thread: {}", t);
|
|
|
|
if (this.delegate == null) {
|
|
|
|
if (this.delegate == null) {
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
logger.info("checkAccess, thread: {}", t);
|
|
|
|
|
|
|
|
this.delegate.checkAccess(t);
|
|
|
|
this.delegate.checkAccess(t);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public void checkAccess(ThreadGroup g) {
|
|
|
|
public void checkAccess(ThreadGroup g) {
|
|
|
|
|
|
|
|
logger.info("checkAccess, ThreadGroup: {}", g);
|
|
|
|
if (this.delegate == null) {
|
|
|
|
if (this.delegate == null) {
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
logger.info("checkAccess, ThreadGroup: {}", g);
|
|
|
|
|
|
|
|
this.delegate.checkAccess(g);
|
|
|
|
this.delegate.checkAccess(g);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public void checkExit(int status) {
|
|
|
|
public void checkExit(int status) {
|
|
|
|
|
|
|
|
logger.info("checkExit, status: {}", status);
|
|
|
|
if (this.delegate == null) {
|
|
|
|
if (this.delegate == null) {
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
logger.info("checkExit, status: {}", status);
|
|
|
|
|
|
|
|
this.delegate.checkExit(status);
|
|
|
|
this.delegate.checkExit(status);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public void checkExec(String cmd) {
|
|
|
|
public void checkExec(String cmd) {
|
|
|
|
|
|
|
|
logger.info("checkExec, cmd: {}", cmd);
|
|
|
|
if (this.delegate == null) {
|
|
|
|
if (this.delegate == null) {
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
logger.info("checkExec, cmd: {}", cmd);
|
|
|
|
|
|
|
|
this.delegate.checkExec(cmd);
|
|
|
|
this.delegate.checkExec(cmd);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public void checkLink(String lib) {
|
|
|
|
public void checkLink(String lib) {
|
|
|
|
|
|
|
|
logger.info("checkLink, checkLink: {}", lib);
|
|
|
|
if (this.delegate == null) {
|
|
|
|
if (this.delegate == null) {
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
logger.info("checkLink, checkLink: {}", lib);
|
|
|
|
|
|
|
|
this.delegate.checkLink(lib);
|
|
|
|
this.delegate.checkLink(lib);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public void checkRead(FileDescriptor fd) {
|
|
|
|
public void checkRead(FileDescriptor fd) {
|
|
|
|
|
|
|
|
logger.info("checkRead, fd: {}", fd);
|
|
|
|
if (this.delegate == null) {
|
|
|
|
if (this.delegate == null) {
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
logger.info("checkRead, fd: {}", fd);
|
|
|
|
|
|
|
|
this.delegate.checkRead(fd);
|
|
|
|
this.delegate.checkRead(fd);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public void checkRead(String file) {
|
|
|
|
public void checkRead(String file) {
|
|
|
|
|
|
|
|
logger.info("checkRead, file: {}", file);
|
|
|
|
if (this.delegate == null) {
|
|
|
|
if (this.delegate == null) {
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
logger.info("checkRead, file: {}", file);
|
|
|
|
|
|
|
|
this.delegate.checkRead(file);
|
|
|
|
this.delegate.checkRead(file);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public void checkRead(String file, Object context) {
|
|
|
|
public void checkRead(String file, Object context) {
|
|
|
|
|
|
|
|
logger.info("checkRead, file: {}", file);
|
|
|
|
if (this.delegate == null) {
|
|
|
|
if (this.delegate == null) {
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
logger.info("checkRead, file: {}", file);
|
|
|
|
|
|
|
|
this.delegate.checkRead(file, context);
|
|
|
|
this.delegate.checkRead(file, context);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public void checkWrite(FileDescriptor fd) {
|
|
|
|
public void checkWrite(FileDescriptor fd) {
|
|
|
|
|
|
|
|
logger.info("checkWrite, fd: {}", fd);
|
|
|
|
if (this.delegate == null) {
|
|
|
|
if (this.delegate == null) {
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
logger.info("checkWrite, fd: {}", fd);
|
|
|
|
|
|
|
|
this.delegate.checkWrite(fd);
|
|
|
|
this.delegate.checkWrite(fd);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public void checkWrite(String file) {
|
|
|
|
public void checkWrite(String file) {
|
|
|
|
|
|
|
|
logger.info("checkWrite, file: {}", file);
|
|
|
|
if (this.delegate == null) {
|
|
|
|
if (this.delegate == null) {
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
logger.info("checkWrite, file: {}", file);
|
|
|
|
|
|
|
|
this.delegate.checkWrite(file);
|
|
|
|
this.delegate.checkWrite(file);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public void checkDelete(String file) {
|
|
|
|
public void checkDelete(String file) {
|
|
|
|
|
|
|
|
logger.info("checkDelete, file: {}", file);
|
|
|
|
if (this.delegate == null) {
|
|
|
|
if (this.delegate == null) {
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
logger.info("checkDelete, file: {}", file);
|
|
|
|
|
|
|
|
this.delegate.checkDelete(file);
|
|
|
|
this.delegate.checkDelete(file);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public void checkConnect(String host, int port) {
|
|
|
|
public void checkConnect(String host, int port) {
|
|
|
|
|
|
|
|
logger.info("checkConnect, host: {}, port: {}", host, port);
|
|
|
|
if (this.delegate == null) {
|
|
|
|
if (this.delegate == null) {
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
logger.info("checkConnect, host: {}, port: {}", host, port);
|
|
|
|
|
|
|
|
this.delegate.checkConnect(host, port);
|
|
|
|
this.delegate.checkConnect(host, port);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public void checkConnect(String host, int port, Object context) {
|
|
|
|
public void checkConnect(String host, int port, Object context) {
|
|
|
|
|
|
|
|
logger.info("checkConnect, host: {}, port: {}", host, port);
|
|
|
|
if (this.delegate == null) {
|
|
|
|
if (this.delegate == null) {
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
logger.info("checkConnect, host: {}, port: {}", host, port);
|
|
|
|
|
|
|
|
this.delegate.checkConnect(host, port, context);
|
|
|
|
this.delegate.checkConnect(host, port, context);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public void checkListen(int port) {
|
|
|
|
public void checkListen(int port) {
|
|
|
|
|
|
|
|
logger.info("checkListen, port: {}", port);
|
|
|
|
if (this.delegate == null) {
|
|
|
|
if (this.delegate == null) {
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
logger.info("checkListen, port: {}", port);
|
|
|
|
|
|
|
|
this.delegate.checkListen(port);
|
|
|
|
this.delegate.checkListen(port);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public void checkAccept(String host, int port) {
|
|
|
|
public void checkAccept(String host, int port) {
|
|
|
|
|
|
|
|
logger.info("checkAccept, host: {}, port: {}", host, port);
|
|
|
|
if (this.delegate == null) {
|
|
|
|
if (this.delegate == null) {
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
logger.info("checkAccept, host: {}, port: {}", host, port);
|
|
|
|
|
|
|
|
this.delegate.checkAccept(host, port);
|
|
|
|
this.delegate.checkAccept(host, port);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public void checkPropertiesAccess() {
|
|
|
|
public void checkPropertiesAccess() {
|
|
|
|
|
|
|
|
logger.info("checkPropertiesAccess");
|
|
|
|
if (this.delegate == null) {
|
|
|
|
if (this.delegate == null) {
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
logger.info("checkPropertiesAccess");
|
|
|
|
|
|
|
|
this.delegate.checkPropertiesAccess();
|
|
|
|
this.delegate.checkPropertiesAccess();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public void checkPropertyAccess(String key) {
|
|
|
|
public void checkPropertyAccess(String key) {
|
|
|
|
|
|
|
|
logger.info("checkPropertyAccess, key: {}", key);
|
|
|
|
if (this.delegate == null) {
|
|
|
|
if (this.delegate == null) {
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
logger.info("checkPropertyAccess, key: {}", key);
|
|
|
|
|
|
|
|
this.delegate.checkPropertyAccess(key);
|
|
|
|
this.delegate.checkPropertyAccess(key);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public void checkPrintJobAccess() {
|
|
|
|
public void checkPrintJobAccess() {
|
|
|
|
|
|
|
|
logger.info("checkPrintJobAccess");
|
|
|
|
if (this.delegate == null) {
|
|
|
|
if (this.delegate == null) {
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
logger.info("checkPrintJobAccess");
|
|
|
|
|
|
|
|
this.delegate.checkPrintJobAccess();
|
|
|
|
this.delegate.checkPrintJobAccess();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public void checkPackageAccess(String pkg) {
|
|
|
|
public void checkPackageAccess(String pkg) {
|
|
|
|
|
|
|
|
logger.info("checkPackageAccess, pkg: {}", pkg);
|
|
|
|
if (this.delegate == null) {
|
|
|
|
if (this.delegate == null) {
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
logger.info("checkPackageAccess, pkg: {}", pkg);
|
|
|
|
|
|
|
|
this.delegate.checkPackageAccess(pkg);
|
|
|
|
this.delegate.checkPackageAccess(pkg);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public void checkPackageDefinition(String pkg) {
|
|
|
|
public void checkPackageDefinition(String pkg) {
|
|
|
|
|
|
|
|
logger.info("checkPackageDefinition, pkg: {}", pkg);
|
|
|
|
if (this.delegate == null) {
|
|
|
|
if (this.delegate == null) {
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
logger.info("checkPackageDefinition, pkg: {}", pkg);
|
|
|
|
|
|
|
|
this.delegate.checkPackageDefinition(pkg);
|
|
|
|
this.delegate.checkPackageDefinition(pkg);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public void checkSetFactory() {
|
|
|
|
public void checkSetFactory() {
|
|
|
|
|
|
|
|
logger.info("checkSetFactory");
|
|
|
|
if (this.delegate == null) {
|
|
|
|
if (this.delegate == null) {
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
logger.info("checkSetFactory");
|
|
|
|
|
|
|
|
this.delegate.checkSetFactory();
|
|
|
|
this.delegate.checkSetFactory();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public void checkSecurityAccess(String target) {
|
|
|
|
public void checkSecurityAccess(String target) {
|
|
|
|
|
|
|
|
logger.info("checkSecurityAccess, target: {}", target);
|
|
|
|
if (this.delegate == null) {
|
|
|
|
if (this.delegate == null) {
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
logger.info("checkSecurityAccess, target: {}", target);
|
|
|
|
|
|
|
|
this.delegate.checkSecurityAccess(target);
|
|
|
|
this.delegate.checkSecurityAccess(target);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|