Tuesday, December 17, 2013

Glassfish version 3: Secure Admin must be enabled to access the DAS remotely.

Overview

Firstly, I only install the new Glassfish 3.1.2 only in my laptop and access the administration module locally by using “localhost:4048″. When I install it on the development server and try to access it remotely, by using “http:/my_host:port”. It shows me an error as cannot login with the message as
Secure Admin must be enabled to access the DAS remotely.

The Investigation

I’ve found the nice solution form stack overflow here.

The solution

It’s simple by activate the secure admin by using the following command line: -
1
asadmin --host [host] --port [port] enable-secure-admin
The host is the host name or IP address for the Glassfish Server which we need to enable the secure admin.
The port is the target Glassfish Server port which wee need to enable the secure admin.

Caution

Please take a big note as the following: -
  1. The target Glassfish Server which is the port owner is started before executing the above command.
  2. After executing, the target Glassfish Server need to be restarted for taking effect.

Rollback

If we would like to disable the secure admin, it can be done easily as the following: -
1
asadmin --host [host] --port [port] disable-secure-admin

 
 
-------------------------------------------------

To Change the Administration Password

Use the change-admin-password subcommand in remote mode to change the administration password. The default administration password is admin. You are prompted for the old and new admin passwords, with confirmation.

Note – If you accepted the default admin user with no password during zip installation, you can add a password to this user. If there is a single user called admin that does not have a password, you are not prompted for login information. Any other situation requires login.

Encrypting the admin password is strongly encouraged.
Before You Begin
If you want to change the admin password before creating an alias for the password (encrypting), you can use the set subcommand with syntax similar to the following:

asadmin set --user admin server.jms-service.jms-host.default_JMS_host.admin-password=
new_pwd
  1. Ensure that the server is running.
    Remote subcommands require a running server.
  2. Change the admin password by using the change-admin-password(1) subcommand.
  3. Enter the old and new admin passwords when prompted.
  4. Restart GlassFish Server.
    See To Restart a Domain.

Example 11–2 Changing the Admin Password

This example changes the admin password for user anonymous from adminadmin to newadmin:

asadmin> change-admin-password --user anonymous
You are prompted to enter the old and the new admin passwords:

Enter admin password>adminadmin
Enter new admin password>newadmin
Enter new admin password again>newadmin
Information similar to the following is displayed:

Command change-admin-password executed successfully.


To Restart a Domain

Use the restart-domain subcommand in remote mode to restart the Domain Administration Server (DAS) of the specified host. When restarting a domain, the DAS stops accepting new connections and then waits for all outstanding connections to complete. This shutdown process takes a few seconds. Until the domain has restarted, the Administration Console and most of the asadmin subcommands cannot be used.
This subcommand is particularly useful for environments where the server machine is secured and difficult to get to. With the right credentials, you can restart the server from a remote location as well as from the same machine.
If the server will not restart, use the stop-domain(1) subcommand followed by the start-domain(1) subcommand.
  1. Ensure that the server is running.
    Remote subcommands require a running server.
  2. Restart the domain by using the restart-domain(1) subcommand.

Example 3–8 Restarting a Domain (or Server)

This example restarts mydoimain4 in the default directory.

asadmin> restart-domain mydomain4
Waiting for the domain to restart ...........
Command restart-domain executed successfully.


Example 3–9 Restarting a Domain in a Browser

This example invokes the restart-domain subcommand in a browser.

http://yourhost:4848/__asadmin/restart-domain

 
Last but not least: the configure information of a domain is located in the file
${GF INSTALL DIR}/domains/domain1/config/domain.xml
 

No comments:

Post a Comment