如何设置 Maven 使用公钥身份验证与 CVS 连接?

发布于 2024-07-24 23:06:22 字数 2748 浏览 6 评论 0原文

我在 POM 中有一个部分看起来像这样:

<scm>
    <connection>scm:cvs:ext:myhostname:/cvsroot/repo:module_name</connection>
</scm>

我通常使用 publickey auth 对此 cvs 服务器进行身份验证,尽管它也应该接受我的密码。

当我尝试运行 mvn scm:updatemvn release:prepare 或任何其他涉及连接到此 scm 的 Maven 目标时,出现以下失败:(

[INFO] Executing: cmd.exe /X /C "cvs -z3 -f -q update -d"
[INFO] Working directory: C:\Documents and Settings\matt\workspace\projectname
org.netbeans.lib.cvsclient.connection.AuthenticationException: Cannot authenticate. Reason: Publickey authentication failed.
    at org.apache.maven.scm.provider.cvslib.cvsjava.util.ExtConnection.open(ExtConnection.java:136)
    at org.apache.maven.scm.provider.cvslib.cvsjava.util.CvsConnection.connect(CvsConnection.java:166)
    at org.apache.maven.scm.provider.cvslib.cvsjava.util.CvsConnection.processCommand(CvsConnection.java:498)
    at org.apache.maven.scm.provider.cvslib.cvsjava.command.update.CvsJavaUpdateCommand.executeCvsCommand(CvsJavaUpdateCommand.java:53)
    at org.apache.maven.scm.provider.cvslib.command.update.AbstractCvsUpdateCommand.executeUpdateCommand(AbstractCvsUpdateCommand.java:78)
    at org.apache.maven.scm.command.update.AbstractUpdateCommand.executeCommand(AbstractUpdateCommand.java:63)
    at org.apache.maven.scm.command.AbstractCommand.execute(AbstractCommand.java:59)
    at org.apache.maven.scm.provider.cvslib.AbstractCvsScmProvider.executeCommand(AbstractCvsScmProvider.java:750)
    at org.apache.maven.scm.provider.cvslib.AbstractCvsScmProvider.update(AbstractCvsScmProvider.java:348)
    at org.apache.maven.scm.provider.AbstractScmProvider.update(AbstractScmProvider.java:821)
    at org.apache.maven.scm.provider.AbstractScmProvider.update(AbstractScmProvider.java:770)
    at org.apache.maven.scm.manager.AbstractScmManager.update(AbstractScmManager.java:526)
    at org.apache.maven.scm.plugin.UpdateMojo.execute(UpdateMojo.java:89)

更多堆栈跟踪的....)

并在堆栈跟踪中进一步向下:

Caused by: java.io.IOException: Decrypted PEM has wrong padding, did you specify the correct password?
    at ch.ethz.ssh2.crypto.PEMDecoder.removePadding(PEMDecoder.java:109)
    at ch.ethz.ssh2.crypto.PEMDecoder.decryptPEM(PEMDecoder.java:286)
    at ch.ethz.ssh2.crypto.PEMDecoder.decode(PEMDecoder.java:319)

后面是:

[ERROR] Provider message:
[ERROR] The cvs command failed.
[ERROR] Command output:

我在 Windows 计算机上运行此程序,PATH 上没有 cvs 可执行文件。 我的公钥确实在 $HOME/.ssh 下可用,但似乎 cvs/maven/scm 并未在此处加载它 - 因为我没有被要求提供它的关键字。

所以我的问题是...我需要对 Maven 或 SCM/CVS 提供程序做些什么特殊的事情才能让它识别我的公钥安装在哪里,或者如何实际使用它? 目前,它似乎没有被使用,因为没有提示我输入它的密码。

I have a section in a POM that looks something like this:

<scm>
    <connection>scm:cvs:ext:myhostname:/cvsroot/repo:module_name</connection>
</scm>

I typically use publickey auth to authentication against this cvs server, although it should accept my password as well.

When I attempt to run mvn scm:update, mvn release:prepare, or any other Maven goal that involves connecting to this scm, I get the following failure:

[INFO] Executing: cmd.exe /X /C "cvs -z3 -f -q update -d"
[INFO] Working directory: C:\Documents and Settings\matt\workspace\projectname
org.netbeans.lib.cvsclient.connection.AuthenticationException: Cannot authenticate. Reason: Publickey authentication failed.
    at org.apache.maven.scm.provider.cvslib.cvsjava.util.ExtConnection.open(ExtConnection.java:136)
    at org.apache.maven.scm.provider.cvslib.cvsjava.util.CvsConnection.connect(CvsConnection.java:166)
    at org.apache.maven.scm.provider.cvslib.cvsjava.util.CvsConnection.processCommand(CvsConnection.java:498)
    at org.apache.maven.scm.provider.cvslib.cvsjava.command.update.CvsJavaUpdateCommand.executeCvsCommand(CvsJavaUpdateCommand.java:53)
    at org.apache.maven.scm.provider.cvslib.command.update.AbstractCvsUpdateCommand.executeUpdateCommand(AbstractCvsUpdateCommand.java:78)
    at org.apache.maven.scm.command.update.AbstractUpdateCommand.executeCommand(AbstractUpdateCommand.java:63)
    at org.apache.maven.scm.command.AbstractCommand.execute(AbstractCommand.java:59)
    at org.apache.maven.scm.provider.cvslib.AbstractCvsScmProvider.executeCommand(AbstractCvsScmProvider.java:750)
    at org.apache.maven.scm.provider.cvslib.AbstractCvsScmProvider.update(AbstractCvsScmProvider.java:348)
    at org.apache.maven.scm.provider.AbstractScmProvider.update(AbstractScmProvider.java:821)
    at org.apache.maven.scm.provider.AbstractScmProvider.update(AbstractScmProvider.java:770)
    at org.apache.maven.scm.manager.AbstractScmManager.update(AbstractScmManager.java:526)
    at org.apache.maven.scm.plugin.UpdateMojo.execute(UpdateMojo.java:89)

(lots more of the stacktrace....)

And further down in the stacktrace:

Caused by: java.io.IOException: Decrypted PEM has wrong padding, did you specify the correct password?
    at ch.ethz.ssh2.crypto.PEMDecoder.removePadding(PEMDecoder.java:109)
    at ch.ethz.ssh2.crypto.PEMDecoder.decryptPEM(PEMDecoder.java:286)
    at ch.ethz.ssh2.crypto.PEMDecoder.decode(PEMDecoder.java:319)

Followed by:

[ERROR] Provider message:
[ERROR] The cvs command failed.
[ERROR] Command output:

I'm running this on a Windows machine, with no cvs executable on the PATH. I do have my public key available under $HOME/.ssh, but it doesn't seem as if cvs/maven/scm is loading it here - as I'm not asked for the keyphrase for it.

So my question is ... is there anything special I need to do with Maven or the SCM/CVS provider to get it to recognize where my public key is installed, or how to actually use it? Currently it doesn't seem as if it is even being used as I am not prompted for it's passphrase.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

何以心动 2024-07-31 23:06:22

因此,在进一步调试并下载 maven-scm-provider-cvs 包的源代码后,我发现该插件使用的 CVS 库使用空字符串 ("")如果找到您的私钥,则显示密码值。 要使用正确的密码,库希望您使用键名 maven.scm.cvs.java.ssh.passphrase 设置系统属性。

因此,如果我像这样运行我的 scm:status 目标:

mvn scm:status -Dmaven.scm.cvs.java.ssh.passphrase=<my passphrase>

我能够连接到 CVS。

哎呀 - 我真的希望这被记录下来!

So after debugging this a bit more, and downloading the source code for the maven-scm-provider-cvs package, I discovered that the CVS library used by this plugin uses the empty string ("") for the passphrase value if it finds your private key. To use the correct passphrase, the library expects you to set a System property with the key name maven.scm.cvs.java.ssh.passphrase.

So, if I run my scm:status goal like so:

mvn scm:status -Dmaven.scm.cvs.java.ssh.passphrase=<my passphrase>

I'm able to connect to CVS.

Gee - I really wish this was documented!

执笔绘流年 2024-07-31 23:06:22

我通过在使用 maven 之前从控制台执行 cvs+ssh 登录命令解决了这个问题。 这将幻数添加到 $home/.ssh 以便自动登录工作。

如果这是由于自签名证书造成的,请查看 InstallCert 代码关于如何将自签名证书添加到客户端。 或者示例介绍如何替换默认的 X509 信任代码。

I solved this by executing the cvs+ssh login command from the console before using maven. This added the magic numbers to $home/.ssh for the automated login to work.

If this is because of a self-signed cert, check out the InstallCert code on how to add the self signed cert to the client. Or this example on how to replace the default X509 Trust code.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文