From e41557be6f74866ac5309830d3fcede4a7895e8b Mon Sep 17 00:00:00 2001 From: Phillip Ross Date: Wed, 28 Oct 2015 04:09:14 -0400 Subject: [PATCH] Set an admin password and enable secure admin mode during provisioning. --- README.md | 2 ++ provision.sh | 16 +++++++++++++++- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 739cb02..5e53dd9 100644 --- a/README.md +++ b/README.md @@ -4,6 +4,8 @@ Vagrantfile for Payara. Currently it uses ubuntu/trusty64 as a base and gets the Java EE Web profile of Payara 4.1.1.154, extracting to /opt/payara/payara-$PAYARA_VERSION. The provision.sh script contains PAYARA_VERSION and PAYARA_ED variables which can be changed to point to a different version/edition of Payara. OpenJDK 7 is installed, since that is the latest Java currently available in the Ubuntu repos. +During provisioning, both domains (`domain1` and `payaradomain`) are configured to enable secure admin mode with a username of `admin` and password of `payara0payara`. + There is still work to be done, but at this point, the file is usable for development/testing purposes. ### WARNING diff --git a/provision.sh b/provision.sh index 7ac026a..73f8a77 100644 --- a/provision.sh +++ b/provision.sh @@ -95,7 +95,21 @@ installPayara() { wget -q $PAYARA_ED -O temp.zip > /dev/null # Download Payara sudo mkdir -p $PAYARA_HOME # Make dirs for Payara unzip -qq temp.zip -d $PAYARA_HOME # unzip Payara to dir - sudo chown -R vagrant:vagrant $PAYARA_HOME # Make sure vagrant owns dir + + echo "Enabling secure admin mode for domains (u/p = admin/payara0payara)" + PWDFILE=/tmp/pwdfile + DOMAINS_DIR="${PAYARA_HOME}/payara41/glassfish/domains" + echo "AS_ADMIN_PASSWORD=payara0payara" > ${PWDFILE} + for DOMAIN in domain1 payaradomain; do + echo "admin;{SSHA256}Rzyr/2/C1Zv+iZyIn/VnL0zDYESs8nTH8t/OMlOpazehMGn5L9ejkg==;asadmin" > "${DOMAINS_DIR}/${DOMAIN}/config/admin-keyfile" + ${PAYARA_HOME}/payara41/bin/asadmin start-domain ${DOMAIN} + ${PAYARA_HOME}/payara41/bin/asadmin --user admin --passwordfile "${PWDFILE}" enable-secure-admin + ${PAYARA_HOME}/payara41/bin/asadmin stop-domain ${DOMAIN} + done + rm "${PWDFILE}" + + echo "Setting ownership of ${PAYARA_HOME} content" + sudo chown -R vagrant:vagrant $PAYARA_HOME # Make sure vagrant owns dir } -- 2.39.5