Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Glassfish 3.1.1 - How to enable secure admin for different domains?

Tags:

glassfish

I have a glassfish server runing. it has 3 different domains - d1,d2, and d3. now when I try to run asadmin enable-secure-admin command, how to i specify which domain i want to enable?

like image 203
neo Avatar asked Dec 23 '11 17:12

neo


People also ask

How do I enable secure admin in GlassFish?

Use the change-admin-password command or the admin console to create non-empty passwords for admin accounts. Command enable-secure-admin failed. > You must restart all running servers for the change in secure admin to take effect. >

How do I add a domain to GlassFish server?

Create a domain by using the create-domain(1) subcommand. Information about the options for this subcommand is included in this help page. Type an admin user name and password for the domain. To avoid setting up an admin login, you can accept the default admin, with no password.

How do I disable GlassFish secure admin?

The following example shows how to disable secure admin for a domain. asadmin> disable-secure-admin server-config default-config Command disable-secure-admin executed successfully.

How do I find my GlassFish admin password?

In the domain1/config folder of GlassFish there's a file "admin-keyfile", make a backup copy of it. Change the admin line to read "admin; ;asadmin". Restart the server and you should be able to log in with just the user account "admin" and no password. Save this answer.


3 Answers

You must specify the port the DAS (Domain Administration Server) is running on. For example:

asadmin --host localhost --port 4848 enable-secure-admin

asadmin --host localhost --port 5858 enable-secure-admin

asadmin --host localhost --port 6868 enable-secure-admin

Of course, this assumes the ports are for d1, d2, and d3 respectively.

Hope this helps.

like image 187
John Clingan Avatar answered Oct 16 '22 20:10

John Clingan


Before being able to enable Security, You might be prompted with a message saying your admin password is empty and cannot enable security.

To solve the problem:

Change the password of admin this way: asadmin --host localhost --port 4848 change-admin-password

It will prompt you with user, type "admin", admin password, retype admin password

Once this is done, enable the security with the following command:

asadmin --host localhost --port 4848 enable-secure-admin

This should fix the problem.

like image 39
Pat B Avatar answered Oct 16 '22 21:10

Pat B


asadmin --host www.yourdomain.com --port 4848 enable-secure-admin

Then stop/start glassfish immediately after enabling secure admin.

In case your private Glassfish runs on shared server you will need to use your custom port (assume 15123 for the example) in asadmin command. Check Java Control Panel for your Glassfish console port. Use the port with your asadmin commands. The below was tested with Glassfish 3.1.2 and 4.0.

[~]# asadmin --port 4848 enable-secure-admin

remote failure: At least one admin user has an empty password, which secure admin does not permit. Use the change-admin-password command or the admin console to create non-empty passwords for admin accounts. Command enable-secure-admin failed.

Set the password as prompted

[~]# asadmin --port 4848 change-admin-password Enter admin user name

[default: admin]> Enter admin password> Enter new admin password>

secret Enter new admin password again> secret Command

change-admin-password executed successfully.

Now retry enable-secure-admin

asadmin --port 4848 enable-secure-admin

Enter admin user name> admin

Enter admin password for user "admin"> secret

You must restart all

running servers for the change in secure admin to take effect. Command

enable-secure-admin executed successfully.

More information Glassfish: Secure Admin Must Be Enabled To Access The DAS Remotely

like image 3
Lucian Avatar answered Oct 16 '22 21:10

Lucian