Skip to content

Instantly share code, notes, and snippets.

@alacambra
Last active August 29, 2015 14:25
Show Gist options
  • Save alacambra/c185dc7013fefbbbcbd0 to your computer and use it in GitHub Desktop.
Save alacambra/c185dc7013fefbbbcbd0 to your computer and use it in GitHub Desktop.
###DB security domain
batch
/subsystem=security/security-domain=poolingpeopledomain/:add
/subsystem=security/security-domain=poolingpeopledomain:write-attribute(name=cache-type,value=default)
/subsystem=security/security-domain=poolingpeopledomain/authentication=classic:\
add( \
login-modules=[{ \
"code"=>"Database", \
"flag"=>"required", \
"module-options"=>[ \
"dsJndiName"="java:/datasources/poolingpeople-mysql", \
"principalsQuery"="select psw from USERS where username=?", \
"rolesQuery"="select role, 'Roles' from USER_ROLES where username=?" \
"password-stacking"="useFirstPass" \
] \
}])
run-batch
###change interface value
/interface=management/:write-attribute(name=inet-address,value=${jboss.bind.address.management:0.0.0.0})
###Add mysql module /(jar must be in $JBOSS_HOME/bin)
module add --name=com.mysql --resources=mysql-connector-java-5.1.35-bin.jar --dependencies=javax.api,javax.transaction.api
/subsystem=datasources/jdbc-driver=mysql:add(driver-name=mysql,driver-module-name=com.mysql,driver-class-name=com.mysql.jdbc.Driver)
/subsystem=datasources/data-source=poolingpeople-mysql:add( \
jndi-name=java:/datasources/poolingpeople-mysql, \
driver-name=mysql, \
connection-url=jdbc:mysql://localhost:13306/poolingpeople, \
user-name=root, \
password=lacambra \
)
### add user (mo cli)
./add-user.sh user psw0. --silent
###SSL
###java key gen: keytool -genkeypair -keystore wildfly.keystore -storepass mypassword -keypass mypassword -keyalg RSA -validity 180 -alias wildfly -dname "cn=packtpub,o=PackPub,c=GB"
/core-service=management/security-realm=CertificateRealm:add
/core-service=management/security-realm=CertificateRealm/server-identity=ssl:add(keystore-path="wildfly.keystore", keystore-relative-to="jboss.server.config.dir", keystore-password="mypassword")
/subsystem=undertow/server=default-server/https-listener=https:add(socket-binding="https",security-realm="CertificateRealm")
####Local Datasourc/subsystem=datasources/data-source=rha:add( \
/subsystem=datasources/data-source=rha:add( \
jndi-name=java:jboss/datasources/rha, \
driver-name=mysql-connector-java-5.1.34-bin.jar_com.mysql.jdbc.Driver_5_1, \
driver-class=com.mysql.jdbc.Driver, \
connection-url=jdbc:mysql://192.168.59.103:3306/rha, \
user-name=usr, \
password=psw, \
check-valid-connection-sql=SELECT 1, \
validate-on-match=true, \
background-validation=false, \
background-validation-millis=3000 \
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment