use of org.jboss.as.jdr.util.Sanitizer in project wildfly by wildfly.
the class AS7Plugin method getCommands.
@Override
public List<JdrCommand> getCommands() throws Exception {
Sanitizer xmlSanitizer = Sanitizers.xml("//password");
Sanitizer passwordSanitizer = Sanitizers.pattern("password=.*", "password=*");
return Arrays.asList(new TreeCommand(), new JarCheck(), new CallAS7("configuration").param("recursive", "true"), new CallAS7("dump-services").operation("dump-services").resource("core-service", "service-container"), new CallAS7("cluster-proxies-configuration").resource("subsystem", "modcluster"), new CallAS7("jndi-view").operation("jndi-view").resource("subsystem", "naming"), new CollectFiles("*/standalone/configuration/*").sanitizer(xmlSanitizer, passwordSanitizer), new CollectFiles("*/domain/configuration/*").sanitizer(xmlSanitizer, passwordSanitizer), new CollectFiles("*server.log").limit(50 * Utils.ONE_MB), new CollectFiles("*.log").omit("*server.log"), new CollectFiles("*gc.log.*"), new CollectFiles("*.properties").sanitizer(passwordSanitizer), new CollectFiles("*.xml").sanitizer(xmlSanitizer), new CollectFiles("*/modules/system/*/.overlays/.overlays"), new CollectFiles("*/.installation/*.conf"), new CollectFiles("*/.installation/*.txt"), new SystemProperties().sanitizer(passwordSanitizer), new DeploymentDependencies(), new LocalModuleDependencies());
}
use of org.jboss.as.jdr.util.Sanitizer in project wildfly by wildfly.
the class SystemProperties method execute.
@Override
public void execute() throws Exception {
if (!this.env.isServerRunning())
return;
StringWriter stringWriter = new StringWriter();
PrintWriter printWriter = new PrintWriter(stringWriter);
Properties properties = System.getProperties();
Enumeration<?> names = properties.propertyNames();
while (names.hasMoreElements()) {
String name = (String) names.nextElement();
printWriter.println(name + "=" + properties.getProperty(name));
}
InputStream stream = new ByteArrayInputStream(stringWriter.toString().getBytes(StandardCharsets.UTF_8));
for (Sanitizer sanitizer : this.sanitizers) {
stream = sanitizer.sanitize(stream);
}
this.env.getZip().addAsString(stream, "system-properties.txt");
Utils.safelyClose(stream);
}
use of org.jboss.as.jdr.util.Sanitizer in project wildfly by wildfly.
the class CollectFiles method execute.
@Override
public void execute() throws Exception {
VirtualFile root = VFS.getChild(this.env.getJbossHome());
List<VirtualFile> matches = root.getChildrenRecursively(Filters.and(this.filter, this.blacklistFilter));
// get some limit on that set, which probably would be wrong.
if (sorter != null) {
Collections.sort(matches, sorter);
}
// limit how much data we collect
Limiter limiter = new Limiter(limit);
Iterator<VirtualFile> iter = matches.iterator();
while (iter.hasNext() && !limiter.isDone()) {
VirtualFile f = iter.next();
InputStream stream = limiter.limit(f);
for (Sanitizer sanitizer : this.sanitizers) {
if (sanitizer.accepts(f)) {
stream = sanitizer.sanitize(stream);
}
}
this.env.getZip().add(f, stream);
Utils.safelyClose(stream);
}
}
Aggregations