users@glassfish.java.net

Re: does not accept secure connections. Retry with --secure=fals

From: <forums_at_java.net>
Date: Mon, 9 Jan 2012 15:57:07 -0600 (CST)

Here the working script:   #!/bin/bash
AS_JAVA="/opt/jdk1.6.0_30"
GLASSFISH_HOME="/opt/glassfishv3"
GLASSFISH_USER="glassfish"
GLASSFISH_RC="/etc/init.d/glassfish"
GLASSFISH_ZIPFILE="glassfish-3.1.1.zip"
GLASSFISH_UNZIPPED_FOLDER="glassfish3"
MASTERPWD="password"
DN="CN=acolsolutions,O=acolsolutions,L=Zurich,S=Zurich,C=Switzerland"
if [ -d $GLASSFISH_HOME ]; then
        echo "Deleting $GLASSFISH_HOME"
        rm -rf $GLASSFISH_HOME;
fi
unzip source/$GLASSFISH_ZIPFILE;
mv $GLASSFISH_UNZIPPED_FOLDER $GLASSFISH_HOME;
sudo chown -R $GLASSFISH_USER:$GLASSFISH_USER $GLASSFISH_HOME;
  cat > $GLASSFISH_RC << EOF
#!/bin/bash
export AS_JAVA=$AS_JAVA
GLASSFISHPATH=$GLASSFISH_HOME/bin
case "\$1" in
        start)
                echo "starting glassfish from \$GLASSFISHPATH"
                sudo -u $GLASSFISH_USER
\$GLASSFISHPATH/asadmin start-domain domain1
        ;;
        restart)
                \$0 stop
                \$0 start
        ;;
        stop)
                echo "stopping glassfish from \$GLASSFISHPATH"
                sudo -u $GLASSFISH_USER
\$GLASSFISHPATH/asadmin stop-domain domain1
        ;;
        *)
                echo $"usage: \$0 {start|stop|restart}"
                exit 3
        ;;
esac
EOF
sudo chmod a+x $GLASSFISH_RC;
echo "Change Master Password (default pass: changeit, new pass: $MASTERPWD)"
sudo -u $GLASSFISH_USER $GLASSFISH_HOME/bin/asadmin change-master-password
--savemasterpassword=true
sudo -u $GLASSFISH_USER $GLASSFISH_HOME/bin/asadmin start-domain domain1;
echo "Change Admin Password (user: admin, pass: empty, new pass: $MASTERPWD)"
sudo -u $GLASSFISH_USER $GLASSFISH_HOME/bin/asadmin change-admin-password
sudo -u $GLASSFISH_USER $GLASSFISH_HOME/bin/asadmin stop-domain domain1
 
echo "Creating Certificates"
cd $GLASSFISH_HOME/glassfish/domains/domain1/config/
sudo -u $GLASSFISH_USER keytool -list -keystore keystore.jks -storepass
$MASTERPWD
sudo -u $GLASSFISH_USER keytool -delete -alias s1as -keystore keystore.jks
-storepass $MASTERPWD
sudo -u $GLASSFISH_USER keytool -delete -alias glassfish-instance -keystore
keystore.jks -storepass $MASTERPWD
sudo -u $GLASSFISH_USER keytool -keysize 2048 -genkey -alias myAlias -keyalg
RSA -dname $DN -validity 3650 -keypass $MASTERPWD -storepass $MASTERPWD
-keystore keystore.jks
sudo -u $GLASSFISH_USER keytool -keysize 2048 -genkey -alias s1as -keyalg RSA
-dname $DN -validity 3650 -keypass $MASTERPWD -storepass $MASTERPWD -keystore
keystore.jks
sudo -u $GLASSFISH_USER keytool -keysize 2048 -genkey -alias
glassfish-instance -keyalg RSA -dname $DN -validity 3650 -keypass $MASTERPWD
-storepass $MASTERPWD -keystore keystore.jks
sudo -u $GLASSFISH_USER keytool -list -keystore keystore.jks -storepass
$MASTERPWD
sudo -u $GLASSFISH_USER keytool -export -alias glassfish-instance -file
glassfish-instance.cert -keystore keystore.jks -storepass $MASTERPWD
sudo -u $GLASSFISH_USER keytool -export -alias s1as -file s1as.cert -keystore
keystore.jks -storepass $MASTERPWD
sudo -u $GLASSFISH_USER keytool -delete -alias glassfish-instance -keystore
cacerts.jks -storepass $MASTERPWD
sudo -u $GLASSFISH_USER keytool -delete -alias s1as -keystore cacerts.jks
-storepass $MASTERPWD
sudo -u $GLASSFISH_USER keytool -import -alias s1as -file s1as.cert -keystore
cacerts.jks -storepass $MASTERPWD
sudo -u $GLASSFISH_USER keytool -import -alias glassfish-instance -file
glassfish-instance.cert -keystore cacerts.jks -storepass $MASTERPWD
echo "Changing Settings"
sudo -u $GLASSFISH_USER $GLASSFISH_HOME/bin/asadmin start-domain domain1
sudo -u $GLASSFISH_USER $GLASSFISH_HOME/bin/asadmin set
server-config.network-config.protocols.protocol.admin-listener.security-enabled=true
sudo -u $GLASSFISH_USER $GLASSFISH_HOME/bin/asadmin enable-secure-admin
sudo -u $GLASSFISH_USER $GLASSFISH_HOME/bin/asadmin delete-jvm-options --
-client
sudo -u $GLASSFISH_USER $GLASSFISH_HOME/bin/asadmin create-jvm-options --
-server
sudo -u $GLASSFISH_USER $GLASSFISH_HOME/bin/asadmin create-jvm-options
-Dproduct.name=""
sudo -u $GLASSFISH_USER $GLASSFISH_HOME/bin/asadmin stop-domain domain1
sudo -u $GLASSFISH_USER $GLASSFISH_HOME/bin/asadmin start-domain domain1
sudo -u $GLASSFISH_USER $GLASSFISH_HOME/bin/asadmin set
server.network-config.protocols.protocol.http-listener-1.http.xpowered-by=false
sudo -u $GLASSFISH_USER $GLASSFISH_HOME/bin/asadmin set
server.network-config.protocols.protocol.http-listener-2.http.xpowered-by=false
sudo -u $GLASSFISH_USER $GLASSFISH_HOME/bin/asadmin set
server.network-config.protocols.protocol.admin-listener.http.xpowered-by=false
sudo -u $GLASSFISH_USER $GLASSFISH_HOME/bin/asadmin list-jvm-options
sudo -u $GLASSFISH_USER $GLASSFISH_HOME/bin/asadmin stop-domain domain1
 


--
[Message sent by forum member 'charms']
View Post: http://forums.java.net/node/880046