Cargo

can't deploy on Glassfish when empty password set

Details

  • Type: Bug Bug
  • Status: Closed Closed
  • Priority: Critical Critical
  • Resolution: Fixed
  • Affects Version/s: 1.0.2
  • Fix Version/s: 1.0.3
  • Component/s: Glassfish
  • Labels:
    None
  • Complexity:
    Intermediate
  • Number of attachments :
    0

Description

I develop on Glassfish with a blank admin password.

org.codehaus.cargo.util.CargoException: password needs to be 8 characters or longer
        at org.codehaus.cargo.container.glassfish.GlassFishStandaloneLocalConfiguration.getPasswordFile(GlassFishStandaloneLocalConfiguration.java:93)
        at org.codehaus.cargo.container.glassfish.GlassFishInstalledLocalDeployer.addConnectOptions(GlassFishInstalledLocalDeployer.java:198)
        at org.codehaus.cargo.container.glassfish.GlassFishInstalledLocalDeployer.doDeploy(GlassFishInstalledLocalDeployer.java:118)
        at org.codehaus.cargo.container.glassfish.GlassFishInstalledLocalDeployer.redeploy(GlassFishInstalledLocalDeployer.java:95)
        at org.codehaus.cargo.maven2.DeployerRedeployMojo.performDeployerActionOnSingleDeployable(DeployerRedeployMojo.java:40)
        at org.codehaus.cargo.maven2.AbstractDeployerMojo.performDeployerActionOnAllDeployables(AbstractDeployerMojo.java:112)
        at org.codehaus.cargo.maven2.AbstractDeployerMojo.doExecute(AbstractDeployerMojo.java:55)
        at org.codehaus.cargo.maven2.AbstractCargoMojo.execute(AbstractCargoMojo.java:255)
        at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:490)

On http://svn.plexus.codehaus.org/browse/~raw,r=43/cargo-contrib/glassfish/src/main/java/org/codehaus/cargo/container/glassfish/GlassFishStandaloneLocalConfiguration.java I found:

        // ...
        String password = getPropertyValue(RemotePropertySet.PASSWORD);
        if(password.length()<8)
            throw new CargoException("password needs to be 8 characters or longer");

        try {
            File f = new File(getHome(), "password.properties");
            if(!f.exists()) {
                getFileHandler().mkdirs(getHome());
                FileWriter w = new FileWriter(f);
                // somehow glassfish uses both. Brain-dead.
                w.write("AS_ADMIN_PASSWORD="+password+"\n");
                w.write("AS_ADMIN_ADMINPASSWORD="+password+"\n");
                w.close();
            }
            return f;
            // ...

Oh yes, when system property with password is set, then it's validated (ekhm...) against length. When properties come from /tmp/cargo/conf/password.properties - not. This weird validation should be removed.
A workaround for now is to keep the blank password in /tmp/cargo/conf/password.properties...

Activity

Hide
Damian Nowak added a comment -

s/with a blank password admin/with a blank admin password/
s/black password/blank password/

Why can't edit the issue I have created?

Show
Damian Nowak added a comment - s/with a blank password admin/with a blank admin password/ s/black password/blank password/ Why can't edit the issue I have created?
Hide
Anders Hammar added a comment -

Updated description.

Show
Anders Hammar added a comment - Updated description.
Hide
Savas Ali Tokmen added a comment -

Fixed SVN rev. 2403

Show
Savas Ali Tokmen added a comment - Fixed SVN rev. 2403
Hide
Riccardo Pasquini added a comment -

using maven2 extension 1.0.3-SNAPSHOT (timestamp 20100723.191118) and setting <cargo.remote.password></cargo.remote.password> in my pom, the plugin try to use password ocnfigured in the temp folder:

[WARNING] [talledLocalContainer] Authentication failed for user: admin
[WARNING] [talledLocalContainer] with password from password file: /tmp/cargo/conf/password.properties
[WARNING] [talledLocalContainer] (Usually, this means invalid user name and/or password)

i would like to re-open this issue

Show
Riccardo Pasquini added a comment - using maven2 extension 1.0.3-SNAPSHOT (timestamp 20100723.191118) and setting <cargo.remote.password></cargo.remote.password> in my pom, the plugin try to use password ocnfigured in the temp folder: [WARNING] [talledLocalContainer] Authentication failed for user: admin [WARNING] [talledLocalContainer] with password from password file: /tmp/cargo/conf/password.properties [WARNING] [talledLocalContainer] (Usually, this means invalid user name and/or password) i would like to re-open this issue
Hide
Damian Nowak added a comment -

Reopening as requested.

Show
Damian Nowak added a comment - Reopening as requested.
Hide
Riccardo Pasquini added a comment -

this file /tmp/cargo/conf/password.properties is in my filesystem before i fix the configuration for empty passwords, maybe that file has priority on configuration properties...

Show
Riccardo Pasquini added a comment - this file /tmp/cargo/conf/password.properties is in my filesystem before i fix the configuration for empty passwords, maybe that file has priority on configuration properties...
Hide
Savas Ali Tokmen added a comment -

Th,s might be because the CARGO GF container doesn't rewrite and existing passwords file.

Should that also be changed?

Show
Savas Ali Tokmen added a comment - Th,s might be because the CARGO GF container doesn't rewrite and existing passwords file. Should that also be changed?
Hide
Damian Nowak added a comment -

If it's true what Riccardo says, cargo.remote.password property should have bigger priority than password.properties. But I will check it myself and let you know in a few days.

Show
Damian Nowak added a comment - If it's true what Riccardo says, cargo.remote.password property should have bigger priority than password.properties. But I will check it myself and let you know in a few days.
Hide
Damian Nowak added a comment -

Where is the 1.0.3-SNAPSHOT version of cargo-maven2-plugin available to download? I came to http://bamboo.ci.codehaus.org/browse/CARGO-TRUNKM2JDK15-614/artifact but I see there only Maven 1 plugin. I thought it's a typo, so I did mvn install:install-file, but, yes, this was a Maven 1 plugin because it doesn't work (The plugin descriptor for the plugin Plugin [org.codehaus.cargo:cargo-maven2-plugin] was not found. Please verify that the plugin JAR [...] is intact.)

Show
Damian Nowak added a comment - Where is the 1.0.3-SNAPSHOT version of cargo-maven2-plugin available to download? I came to http://bamboo.ci.codehaus.org/browse/CARGO-TRUNKM2JDK15-614/artifact but I see there only Maven 1 plugin. I thought it's a typo, so I did mvn install:install-file, but, yes, this was a Maven 1 plugin because it doesn't work (The plugin descriptor for the plugin Plugin [org.codehaus.cargo:cargo-maven2-plugin] was not found. Please verify that the plugin JAR [...] is intact.)
Hide
Savas Ali Tokmen added a comment -

The latest snapshot is on the http://snapshots.repository.codehaus.org/ repository.

Show
Savas Ali Tokmen added a comment - The latest snapshot is on the http://snapshots.repository.codehaus.org/ repository.
Hide
Damian Nowak added a comment - - edited

I still get the same exception (org.codehaus.cargo.util.CargoException: password needs to be 8 characters or longer). I suppose I haven't configured the dependencies correctly - could you please check if it's correct?

<pluginRepositories>
	<pluginRepository>
		<id>codehaus snapshots</id>
		<url>http://snapshots.repository.codehaus.org/</url>
	</pluginRepository>
</pluginRepositories>

<plugin>
	<groupId>org.codehaus.cargo</groupId>
	<artifactId>cargo-maven2-plugin</artifactId>
	<version>1.0.3-SNAPSHOT</version>
	...
</plugin>
Show
Damian Nowak added a comment - - edited I still get the same exception (org.codehaus.cargo.util.CargoException: password needs to be 8 characters or longer). I suppose I haven't configured the dependencies correctly - could you please check if it's correct?
<pluginRepositories>
	<pluginRepository>
		<id>codehaus snapshots</id>
		<url>http://snapshots.repository.codehaus.org/</url>
	</pluginRepository>
</pluginRepositories>

<plugin>
	<groupId>org.codehaus.cargo</groupId>
	<artifactId>cargo-maven2-plugin</artifactId>
	<version>1.0.3-SNAPSHOT</version>
	...
</plugin>
Hide
Savas Ali Tokmen added a comment -

Hmmm.... The trouble is that snapshots need to be deployed manually, perhaps I did not deploy them after the change.

Can you check out the CARGO source code and compile, please?

If not I can also redeploy.

Show
Savas Ali Tokmen added a comment - Hmmm.... The trouble is that snapshots need to be deployed manually, perhaps I did not deploy them after the change. Can you check out the CARGO source code and compile, please? If not I can also redeploy.
Hide
Damian Nowak added a comment -

I checked out the sources and I am building it at the moment.

Show
Damian Nowak added a comment - I checked out the sources and I am building it at the moment.
Hide
Damian Nowak added a comment -

You have fixed the bug with 8-chars password but introduced a very little one as Riccardo said. Everything is good if /tmp/cargo/conf/password.properties doesn't exist. cargo.remote.password property is used, put into the file and deployed. But the file remains - and when password is changed, plugin won't notice that. Just imagine someone who doesn't remember the admin password - he will be given only one chance to guess a password, other tries will use the first password in spite of the fact he provided a new one. password.properties file should be deleted just after the redeploy - there is no need to keep it I guess (tell me if I am wrong).

Show
Damian Nowak added a comment - You have fixed the bug with 8-chars password but introduced a very little one as Riccardo said. Everything is good if /tmp/cargo/conf/password.properties doesn't exist. cargo.remote.password property is used, put into the file and deployed. But the file remains - and when password is changed, plugin won't notice that. Just imagine someone who doesn't remember the admin password - he will be given only one chance to guess a password, other tries will use the first password in spite of the fact he provided a new one. password.properties file should be deleted just after the redeploy - there is no need to keep it I guess (tell me if I am wrong).
Hide
Savas Ali Tokmen added a comment -

Patch proposals?

Cheers

Show
Savas Ali Tokmen added a comment - Patch proposals? Cheers
Hide
Damian Nowak added a comment -

I will take a look into the code in a few days and let you know.

Show
Damian Nowak added a comment - I will take a look into the code in a few days and let you know.
Hide
Savas Ali Tokmen added a comment -

The code does not rwrite the file anymore:

            File f = new File(this.getHome(), "password.properties");
            if (!f.exists())
            {
                this.getFileHandler().mkdirs(this.getHome());
                FileWriter w = new FileWriter(f);
                // somehow glassfish uses both. Brain-dead.
                w.write("AS_ADMIN_PASSWORD=" + password + "\n");
                w.write("AS_ADMIN_ADMINPASSWORD=" + password + "\n");
                w.close();
            }
            return f;
Show
Savas Ali Tokmen added a comment - The code does not rwrite the file anymore:
            File f = new File(this.getHome(), "password.properties");
            if (!f.exists())
            {
                this.getFileHandler().mkdirs(this.getHome());
                FileWriter w = new FileWriter(f);
                // somehow glassfish uses both. Brain-dead.
                w.write("AS_ADMIN_PASSWORD=" + password + "\n");
                w.write("AS_ADMIN_ADMINPASSWORD=" + password + "\n");
                w.close();
            }
            return f;

People

Vote (1)
Watch (1)

Dates

  • Created:
    Updated:
    Resolved: