Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

publish ignores ssh key; wants to use password #7293

Open
bwbecker opened this issue Jun 10, 2023 · 0 comments
Open

publish ignores ssh key; wants to use password #7293

bwbecker opened this issue Jun 10, 2023 · 0 comments
Labels

Comments

@bwbecker
Copy link

I'm trying to publish a subproject as a library to my own repository using an SSH key. SBT asks for a password (which I don't have) instead of using the key.

I'm using SBT 1.9.0. Also tested wth 1.6.2 and get the same results. This is on a Mac (M1 processor) running Ventura 13.4. SBT was installed using Homebrew.

steps

The build for the subproject:

lazy val solver = (project in file("_solver"))
  .settings(commonSettings)
  .settings(
    name := "solver",
    libraryDependencies ++= Seq(
      "ca.uwaterloo" %% "pprint"    % "0.1.5-SNAPSHOT",
      "com.lihaoyi"  %% "fastparse" % "3.0.1",
      "com.lihaoyi"  %% "fansi"     % "0.4.0",
      "com.lihaoyi"  %% "scalatags" % "0.12.0"
    ),
    publishTo := Some(
      Resolver
        .ssh("Degree Audit", "ubuntu2204-102.cs.uwaterloo.ca", "/u1/cs-oat/public_html/maven")
        .as("cs-oat", file(sys.env("HOME") + "/.ssh/oat_rsa"))
        .withPublishPermissions("0644")
    )
  )

commonSettings has name, version, etc. Nothing related to publishing.

The results of attempting to publish (I manually "pretty printed" the results of show publishTo to make reading easier):

bwbecker@beta-2 oat-degreeAudit3 % sbt
[info] welcome to sbt 1.9.0 (Homebrew Java 11.0.19)
... 
sbt:cli> project solver
[info] set current project to solver (in build file:/Users/bwbecker/oat/src/oat-degreeAudit3/)
sbt:solver> show publishTo
[info] Some(SshRepository(
    Degree Audit, 
    Patterns(ivyPatterns=Vector(), 
                   artifactPatterns=Vector(/u1/cs-oat/public_html/maven/[organisation]/[module](_[scalaVersion])(_[sbtVersion])/[revision]/[artifact]-[revision](-[classifier]).[ext]), 
    isMavenCompatible=true, 
    descriptorOptional=false, 
    skipConsistencyCheck=false), 
    SshConnection(Some(KeyFileAuthentication(cs-oat, /Users/bwbecker/.ssh/oat_rsa, None)),
                               Some(ubuntu2204-102.cs.uwaterloo.ca), 
                               None), 
    Some(0644)))
[success] Total time: 0 s, completed Jun. 10, 2023, 8:29:55 a.m.
sbt:solver> publish
[info] Wrote /Users/bwbecker/oat/src/oat-degreeAudit3/_solver/target/scala-2.13/solver_2.13-0.3.0-SNAPSHOT.pom
[error] stack trace is suppressed; run last publish for the full output
[error] (publish) java.io.IOException: SSH_MSG_DISCONNECT: 2 Too many authentication failures 
[error] Total time: 28 s, completed Jun. 10, 2023, 8:30:29 a.m.
sbt:solver> 

The above showed this dialog box:

screenshot_452

Clicking "OK" with a blank password resulted in the java.io.IOException. The first bit of last publish produces:

sbt:solver> last publish
[debug] :: SSH :: connecting to ubuntu2204-102.cs.uwaterloo.ca...
[error] java.io.IOException: SSH_MSG_DISCONNECT: 2 Too many authentication failures 
[error] 	at org.apache.ivy.plugins.repository.ssh.SshCache.getSession(SshCache.java:338)
[error] 	at org.apache.ivy.plugins.repository.ssh.AbstractSshBasedRepository.getSession(AbstractSshBasedRepository.java:108)
[error] 	at org.apache.ivy.plugins.repository.ssh.SshRepository.put(SshRepository.java:238)
[error] 	at org.apache.ivy.plugins.repository.AbstractRepository.put(AbstractRepository.java:130)
[error] 	at org.apache.ivy.plugins.resolver.RepositoryResolver.put(RepositoryResolver.java:234)
[error] 	at org.apache.ivy.plugins.resolver.RepositoryResolver.publish(RepositoryResolver.java:216)
[error] 	at sbt.internal.librarymanagement.IvyActions$.$anonfun$publish$5(IvyActions.scala:504)
[error] 	at scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:23)
[error] 	at scala.util.Try$.apply(Try.scala:213)
[error] 	at sbt.internal.librarymanagement.IvyUtil$.retryWithBackoff(IvyUtil.scala:22)
[error] 	at sbt.internal.librarymanagement.IvyActions$.$anonfun$publish$4(IvyActions.scala:503)
[error] 	at sbt.internal.librarymanagement.IvyActions$.$anonfun$publish$4$adapted(IvyActions.scala:501)
[error] 	at scala.collection.Iterator.foreach(Iterator.scala:943)

expectation

I expect SBT to publish the artifact using my SSH key rather than asking for a password.

notes

  • SSHing manually works:
bwbecker@beta-2 oat-degreeAudit3 % ssh cs-oat@ubuntu2204-102.cs.uwaterloo.ca -i ~/.ssh/oat_rsa
Last login: Sat Jun 10 07:25:59 2023 from 10.40.103.82
cs-oat@ubuntu2204-102:~$ 
  • Another library that is set up similarly was successfully published on May 2, 2022. It now shows the same issue. I don't know what changed.
  • If I remove the keyfile from the .ssh directory, I get the same results. So SBT must not even be trying the SSH key since it surely doesn't know where I put it.
  • I have multiple SSH keys in ~/.ssh. But I don't think that's a factor because if I rename the .ssh directory, SBT's behaviour is exactly the same.
  • The ssh key does not use a passphrase.
@bwbecker bwbecker added the Bug label Jun 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant