Why RSA key fingerprint always pops up when using wagon-maven-plugin to upload files?

303 Views Asked by At

I'm using wagon-maven-plugin in my pom.xml to upload JAR file to one of my remote servers.

Here is the introduction and usage of this plugin: https://www.mojohaus.org/wagon-maven-plugin/

I followed the configuration from this post, as well as its official documentation:

Now everything works fine for me - I can successfully upload the JAR and execute some shell commands, except that every time I execute the maven goals, it keeps poping up with a RSA key fingerprint of the remote server and asks me whether I want to continue.

The output info shows like this:

[INFO] --- wagon-maven-plugin:2.0.2:upload-single (upload-jar-to-app01) @ my-app ---
The authenticity of host 'localhost' can't be established.
RSA key fingerprint is ef:04:e4:2d:fa:0f:ee:78:ff:94:b1:dc:07:32:00:f3.
Are you sure you want to continue connecting? (yes/no): yes

Is there any way to avoid this? So that I don't have to type "yes" every time.

1

There are 1 best solutions below

0
Benjamin Leon On

I think I found the solution to this issue.

Actually this have nothing to do with wagon-maven-plugin, the RSA key fingerprint pop-up is coming from a SSH client, which is implemented by Maven Wagon - yes, I also had this component as an extension in my pom.xml:

<project>
    <build>
      ...
        <extensions>
            <extension>
                <groupId>org.apache.maven.wagon</groupId>
                <artifactId>wagon-ssh</artifactId>
                <version>3.0.0</version>
            </extension>
        </extensions>
        ...
    </build>
</project>

To solve this, I just need to upgrade this extension to the latest version 3.4.3, which it has feature to allow us to add parameters when connencting server via SSH. Pleases refer to this closed Github issue

The parameters should be added to server configuration in settings.xml, which looks like this:

<settings>
    ...
    <servers>
        <server>
          <id>my-servers</id>
          <username>name</username>
          <password>password</password>
          <configuration>
            <strictHostKeyChecking>no</strictHostKeyChecking>
            <preferredAuthentications>publickey,password</preferredAuthentications>
            <interactive>false</interactive>
          </configuration>
        </server>
    </servers>
    ...
</settings>