Skip to content
This repository was archived by the owner on Nov 12, 2025. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/guide/yaml/example_yaml/appserver-configured.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
name: appserver-configured
location: localhost
services:
- type: brooklyn.entity.webapp.jboss.JBoss7Server
war: http://search.maven.org/remotecontent?filepath=io/brooklyn/example/brooklyn-example-hello-world-sql-webapp/0.6.0/brooklyn-example-hello-world-sql-webapp-0.6.0.war
Expand Down
1 change: 1 addition & 0 deletions software/webapp/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
perspective of the Brooklyn/Apache contribution.
-->
<exclude>src/main/resources/brooklyn/entity/webapp/jboss/jboss7-standalone.xml</exclude>
<exclude>src/main/resources/brooklyn/entity/webapp/jboss/wildfly8-standalone.xml</exclude>
<exclude>src/main/resources/brooklyn/entity/webapp/jetty/jetty-brooklyn.xml</exclude>
</excludes>
</configuration>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,10 @@
import brooklyn.util.task.Tasks;
import brooklyn.util.task.ssh.SshTasks;

import com.google.common.base.Charsets;
import com.google.common.collect.ImmutableList;
import com.google.common.hash.Hashing;
import com.google.common.io.BaseEncoding;

public abstract class JavaWebAppSshDriver extends JavaSoftwareProcessSshDriver implements JavaWebAppDriver {

Expand Down Expand Up @@ -197,4 +200,28 @@ public void undeploy(String targetName) {
public FilenameToWebContextMapper getFilenameContextMapper() {
return new FilenameToWebContextMapper();
}

/**
* Creates a hash of a username, password and security realm that is suitable for use
* with AS7 and Wildfly 8.
* <p/>
* Although AS7 has an <code>add-user.sh</code> script it is unsuitable for use in
* non-interactive modes. (See AS7-5061 for details.) Versions 7.1.2+ (EAP) accept
* a <code>--silent</code> flag. When this entity is updated past 7.1.1 we should
* probably use that instead.
* <p/>
* This method mirrors AS7 and Wildfly 8's method of hashing user's passwords. Refer
* to its class <code>UsernamePasswordHashUtil.generateHashedURP</code> for their
* implementation.
*
* @see <a href="https://issues.jboss.org/browse/AS7-5061">AS7-5061</a>
* @see <a href="https://github.com/jboss-remoting/jboss-sasl/blob/master/src/main/java/org/jboss/sasl/util/UsernamePasswordHashUtil.java">
* UsernamePasswordHashUtil.generateHashedURP</a>
* @return <code>HEX(MD5(username ':' realm ':' password))</code>
*/
public static String hashPassword(String username, String password, String realm) {
String concat = username + ":" + realm + ":" + password;
byte[] hashed = Hashing.md5().hashString(concat, Charsets.UTF_8).asBytes();
return BaseEncoding.base16().lowerCase().encode(hashed);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -169,11 +169,6 @@ public String getManagementBindAddress() {
public String getUnsecureBindAddress() {
return getConfig(BIND_ADDRESS);
}

// If empty-string, disables Management security (!) by excluding the security-realm attribute
public String getHttpManagementInterfaceSecurityRealm() {
return "";
}

public int getDeploymentTimeoutSecs() {
return getConfig(DEPLOYMENT_TIMEOUT);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,7 @@
import brooklyn.util.ssh.BashCommands;
import brooklyn.util.text.Strings;

import com.google.common.base.Charsets;
import com.google.common.base.Preconditions;
import com.google.common.hash.Hashing;
import com.google.common.io.BaseEncoding;

public class JBoss7SshDriver extends JavaWebAppSshDriver implements JBoss7Driver {

Expand Down Expand Up @@ -249,28 +246,4 @@ protected List<String> getCustomJavaConfigOptions() {
.add("-XX:MaxPermSize=400m")
.build();
}

/**
* Creates a hash of a username, password and security realm that is suitable for use
* with AS7 and Wildfire.
* <p/>
* Although AS7 has an <code>add-user.sh</code> script it is unsuitable for use in
* non-interactive modes. (See AS7-5061 for details.) Versions 7.1.2+ (EAP) accept
* a <code>--silent</code> flag. When this entity is updated past 7.1.1 we should
* probably use that instead.
* <p/>
* This method mirrors AS7 and Wildfire's method of hashing user's passwords. Refer
* to its class <code>UsernamePasswordHashUtil.generateHashedURP</code> for their
* implementation.
*
* @see <a href="https://issues.jboss.org/browse/AS7-5061">AS7-5061</a>
* @see <a href="https://github.com/jboss-remoting/jboss-sasl/blob/master/src/main/java/org/jboss/sasl/util/UsernamePasswordHashUtil.java">
* UsernamePasswordHashUtil.generateHashedURP</a>
* @return <code>HEX(MD5(username ':' realm ':' password))</code>
*/
public static String hashPassword(String username, String password, String realm) {
String concat = username + ":" + realm + ":" + password;
byte[] hashed = Hashing.md5().hashString(concat, Charsets.UTF_8).asBytes();
return BaseEncoding.base16().lowerCase().encode(hashed);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package brooklyn.entity.webapp.jboss;

import brooklyn.entity.webapp.JavaWebAppDriver;

public interface Wildfly8Driver extends JavaWebAppDriver{

/**
* The path to the keystore file on the Wildfly 8 server machine.
* Result is undefined if SSL is not enabled/configured.
*/
public String getSslKeystoreFile();
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package brooklyn.entity.webapp.jboss;

import brooklyn.catalog.Catalog;
import brooklyn.config.ConfigKey;
import brooklyn.entity.basic.ConfigKeys;
import brooklyn.entity.basic.SoftwareProcess;
import brooklyn.entity.proxying.ImplementedBy;
import brooklyn.entity.trait.HasShortName;
import brooklyn.entity.webapp.JavaWebAppSoftwareProcess;
import brooklyn.event.AttributeSensor;
import brooklyn.event.basic.BasicAttributeSensorAndConfigKey;
import brooklyn.event.basic.BasicAttributeSensorAndConfigKey.StringAttributeSensorAndConfigKey;
import brooklyn.event.basic.PortAttributeSensorAndConfigKey;
import brooklyn.event.basic.Sensors;
import brooklyn.util.flags.SetFromFlag;
import brooklyn.util.javalang.JavaClassNames;

@Catalog(name="Wildfly 8 Application Server", description="Wildfly: an open source Java application server from JBoss", iconUrl="classpath:///jboss-logo.png")
@ImplementedBy(Wildfly8ServerImpl.class)
public interface Wildfly8Server extends JavaWebAppSoftwareProcess, HasShortName {

@SetFromFlag("version")
ConfigKey<String> SUGGESTED_VERSION =
ConfigKeys.newConfigKeyWithDefault(SoftwareProcess.SUGGESTED_VERSION, "8.2.0.Final");

@SetFromFlag("downloadUrl")
BasicAttributeSensorAndConfigKey<String> DOWNLOAD_URL = new StringAttributeSensorAndConfigKey(
SoftwareProcess.DOWNLOAD_URL, "http://download.jboss.org/wildfly/${version}/wildfly-${version}.tar.gz");

@SetFromFlag("bindAddress")
BasicAttributeSensorAndConfigKey<String> BIND_ADDRESS =
new StringAttributeSensorAndConfigKey("jboss.bind.address",
"Address of interface JBoss should listen on, defaulting 0.0.0.0 (but could set e.g. to attributeWhenReady(HOSTNAME)",
"0.0.0.0");

@SetFromFlag("managementHttpPort")
PortAttributeSensorAndConfigKey MANAGEMENT_HTTP_PORT =
new PortAttributeSensorAndConfigKey("webapp.jboss.managementHttpPort", "Management port", "9990+");

@SetFromFlag("managementHttpsPort")
PortAttributeSensorAndConfigKey MANAGEMENT_HTTPS_PORT =
new PortAttributeSensorAndConfigKey("webapp.jboss.managementHttpsPort", "Management port", "9443+");

@SetFromFlag("managementNativePort")
PortAttributeSensorAndConfigKey MANAGEMENT_NATIVE_PORT =
new PortAttributeSensorAndConfigKey("webapp.jboss.managementNativePort", "Management native port", "10999+");

/**
* Port increments are the standard way to run multiple instances of Wildfly on the same machine.
*/
@SetFromFlag("portIncrement")
ConfigKey<Integer> PORT_INCREMENT =
ConfigKeys.newConfigKey("webapp.jboss.portIncrement", "Port increment for all ports in config file", 0);

@SetFromFlag("deploymentTimeout")
ConfigKey<Integer> DEPLOYMENT_TIMEOUT =
ConfigKeys.newConfigKey("webapp.jboss.deploymentTimeout", "Deployment timeout, in seconds", 600);

ConfigKey<String> TEMPLATE_CONFIGURATION_URL = ConfigKeys.newConfigKey(
"webapp.jboss.templateConfigurationUrl", "Template file (in freemarker format) for the standalone.xml file",
JavaClassNames.resolveClasspathUrl(Wildfly8Server.class, "wildfly8-standalone.xml"));

@SetFromFlag("managementUser")
ConfigKey<String> MANAGEMENT_USER = ConfigKeys.newConfigKey("webapp.jboss.managementUser",
"A user to be placed in the management realm. Brooklyn will use this user to poll sensors",
"brooklyn");

@SetFromFlag("managementPassword")
ConfigKey<String> MANAGEMENT_PASSWORD =
ConfigKeys.newStringConfigKey("webapp.jboss.managementPassword", "Password for MANAGEMENT_USER.");

AttributeSensor<String> MANAGEMENT_URL =
Sensors.newStringSensor("webapp.jboss.managementUrl", "URL where management endpoint is available");

AttributeSensor<Integer> MANAGEMENT_STATUS =
Sensors.newIntegerSensor("webapp.jboss.managementStatus", "HTTP response code for the management server");

AttributeSensor<Boolean> MANAGEMENT_URL_UP =
Sensors.newBooleanSensor("webapp.jboss.managementUp", "Management server is responding with OK");

public static final AttributeSensor<String> PID_FILE = Sensors.newStringSensor( "jboss.pid.file", "PID file");

}
Loading