Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- if [ -z "$JBOSS_USER" ]; then
- JBOSS_USER=wildfly
- fi
- if [ -z "$JBOSS_HOME" ]; then
- JBOSS_HOME="/opt/wildfly/"
- fi
- function enableSSL(){
- service wildfly stop &>/dev/null
- doAction keystore DownloadKeys;
- rm -f /var/lib/jelastic/SSL/wildfly.*;
- local certpass=$(/usr/bin/pwgen 30 1);
- /usr/bin/openssl pkcs12 -export -in /var/lib/jelastic/SSL/jelastic.crt -inkey /var/lib/jelastic/SSL/jelastic.key -certfile /var/lib/jelastic/SSL/jelastic-ca.crt -out /var/lib/jelastic/SSL/wildfly.p12 -password pass:${certpass} &>/dev/null
- $(dirname $(realpath $(which java)))/keytool -importkeystore -srckeystore /var/lib/jelastic/SSL/wildfly.p12 -srcstorepass ${certpass} -srcstoretype pkcs12 -destkeystore /var/lib/jelastic/SSL/wildfly.keystore -deststoretype JKS -keypass $certpass -storepass $certpass &>/dev/null
- cp -f /var/lib/jelastic/SSL/wildfly.keystore ${JBOSS_HOME}/domain/configuration/wildfly.keystore;
- mv -f /var/lib/jelastic/SSL/wildfly.keystore ${JBOSS_HOME}/standalone/configuration/wildfly.keystore;
- chown ${JBOSS_USER}:${JBOSS_USER} ${JBOSS_HOME}/standalone/configuration/wildfly.keystore;
- XML_CONFIG_FILES=("standalone.xml" "standalone-full.xml" "standalone-ha.xml" "standalone-full-ha.xml" "standalone-load-balancer.xml" "standalone-ee8.xml" "../../domain/configuration/host.xml")
- for file in "${XML_CONFIG_FILES[@]}"
- do
- [ -e "${JBOSS_HOME}/standalone/configuration/${file}" ] && sed -i s/keystore-password=\".*\"/keystore-password=\"$certpass\"/ ${JBOSS_HOME}/standalone/configuration/${file};
- done
- XML_CONFIG_FILES=("host.xml" "host-master.xml" "host-slave.xml")
- for file in "${XML_CONFIG_FILES[@]}"
- do
- [ -e "${JBOSS_HOME}/domain/configuration/${file}" ] && sed -i s/keystore-password=\".*\"/keystore-password=\"$certpass\"/ ${JBOSS_HOME}/domain/configuration/${file};
- done
- service wildfly start &>/dev/null
- return 0;
- }
- function disableSSL(){
- service wildfly stop &>/dev/null
- doAction keystore remove;
- rm -f ${JBOSS_HOME}/domain/configuration/wildfly.keystore
- rm -f ${JBOSS_HOME}/standalone/configuration/wildfly.keystore
- selfcertgen;
- service wildfly start &>/dev/null
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement