-
Notifications
You must be signed in to change notification settings - Fork 18
/
run.sh
executable file
·55 lines (43 loc) · 2.39 KB
/
run.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#!/bin/bash
. set-env.sh
mkdir -p "$SPNEGO_TEST_DIR"
cd "$SPNEGO_TEST_DIR"
echo "Building Kerberos test server"
git clone git://github.com/kwart/kerberos-using-apacheds.git
cd kerberos-using-apacheds
mvn clean package
cp test.ldif target/kerberos-using-apacheds.jar "$SPNEGO_TEST_DIR"
cd "$SPNEGO_TEST_DIR"
echo "Starting Kerberos server"
java -Dkerberos.bind.address=$BIND_ADDRESS -jar kerberos-using-apacheds.jar test.ldif > kerberos.out 2>&1 &
sleep 10
echo "Authenticate [email protected] in Kerberos"
kinit [email protected] << EOT
secret
EOT
echo "Genereate keytab for $JBOSS_SPN"
java -classpath kerberos-using-apacheds.jar org.jboss.test.kerberos.CreateKeytab $JBOSS_SPN httppwd http.keytab
echo "Install WildFly"
cd "$SPNEGO_TEST_DIR"
wget "${JBOSS_INST}"
unzip -q "${JBOSS_INST##*/}"
echo "Configuring WildFly"
cat << EOT > "$SPNEGO_TEST_DIR/cli-commands.txt"
embed-server
/subsystem=security/security-domain=host:add(cache-type=default)
/subsystem=security/security-domain=host/authentication=classic:add(login-modules=[{"code"=>"Kerberos", "flag"=>"required", "module-options"=>[ ("debug"=>"true"),("storeKey"=>"true"),("refreshKrb5Config"=>"true"),("useKeyTab"=>"true"),("doNotPrompt"=>"true"),("keyTab"=>"$SPNEGO_TEST_DIR/http.keytab"),("principal"=>"$JBOSS_SPN")]}]) {allow-resource-service-restart=true}
/subsystem=security/security-domain=SPNEGO:add(cache-type=default)
/subsystem=security/security-domain=SPNEGO/authentication=classic:add(login-modules=[{"code"=>"SPNEGO", "flag"=>"required", "module-options"=>[("serverSecurityDomain"=>"host")]}]) {allow-resource-service-restart=true}
/subsystem=security/security-domain=SPNEGO/mapping=classic:add(mapping-modules=[{"code"=>"SimpleRoles", "type"=>"role", "module-options"=>[("[email protected]"=>"Admin"),("[email protected]"=>"User")]}]) {allow-resource-service-restart=true}
/system-property=java.security.krb5.conf:add(value="$SPNEGO_TEST_DIR/krb5.conf")
/system-property=java.security.krb5.debug:add(value=true)
/system-property=jboss.security.disable.secdomain.option:add(value=true)
EOT
"$JBOSS_HOME/bin/jboss-cli.sh" "--file=$SPNEGO_TEST_DIR/cli-commands.txt" 2>&1 | tee jboss_as_config.out
echo "Starting WildFly"
"$JBOSS_HOME/bin/standalone.sh" > "$SPNEGO_TEST_DIR/jboss_as.out" 2>&1 &
cd "$SPNEGO_TEST_DIR"
git clone git://github.com/kwart/spnego-demo.git
cd spnego-demo
mvn clean package
cp target/spnego-demo.war "$JBOSS_HOME/standalone/deployments/"