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

AgentProxyException when referencing a git repo in deps.edn #65

Open
AlexAti opened this issue Apr 2, 2019 · 5 comments
Open

AgentProxyException when referencing a git repo in deps.edn #65

AlexAti opened this issue Apr 2, 2019 · 5 comments

Comments

@AlexAti
Copy link
Contributor

AlexAti commented Apr 2, 2019

I'm trying to deploy a project that references another gitlab repo as a dependency through clojure deps.

In order to have the required ssh keys, I use the following custom buildpack on top of the clojure one: https://github.com/simon0191/custom-ssh-key-buildpack

But when trying to pull this private gitlab repo through clojure deps, I get the following message:

       com.jcraft.jsch.agentproxy.AgentProxyException: connector is not available: 
        at com.jcraft.jsch.agentproxy.ConnectorFactory.createConnector (ConnectorFactory.java:120)
           clojure.tools.gitlibs.impl$fn__1007.invokeStatic (impl.clj:30)
           clojure.tools.gitlibs.impl/fn (impl.clj:28)
           (...)

There seems to be some configuration that needs to be amended, but I can't find where.

@jkutner
Copy link
Contributor

jkutner commented Apr 4, 2019

Judging from the jsch-agent-proxy-connector-factory source code, it looks like it's trying to use ssh-agent to get the key. But I suspect that's not running. Is there a way to configure it to read the key created by the buildpack directly?

@AlexAti
Copy link
Contributor Author

AlexAti commented Apr 6, 2019

I don't see how I can configure jsch to do so, but I looked into the buildpack source and it is not registering the key in ssh-agent. I modified the buildpack to add the key to ssh-agent here, but when testing with this version, I still get the same error.

@AlexAti
Copy link
Contributor Author

AlexAti commented Apr 6, 2019

I had another stab at it. You were correct that the problem is that clojure cli tools expect the ssh-agent to be running, yet clojure's buildpack doesn't launch it. I think it should, so I've added its start in #66.

However I'm now getting a different error:

UnknownHostKey: gitlab.com. RSA key fingerprint is b6:03:0e:39:97:9e:d0:e7:24:ce:a3:77:3e:01:42:09
Although the custom-ssh-key-buildpack is turning host key verification off, it seems to be the culprit: https://stackoverflow.com/questions/13396534/unknownhostkey-exception-in-accessing-github-securely . The strange thing is that in my testing fork of that repo I am both deactivating Strict Host Checking AND adding gitlab's public key to ~/.ssh/known_hosts :

  IFS=',' ;for element in `cat $ENV_DIR/CUSTOM_SSH_KEY_HOSTS`;
  do
    echo -e "Host $element\n"\
            "  IdentityFile ~/.ssh/custom_key\n"\
            "  IdentitiesOnly yes\n"\
            "  UserKnownHostsFile=/dev/null\n"\
            "  StrictHostKeyChecking no"\
            >> ~/.ssh/config
ssh-keyscan -H -t rsa $element >> ~/.ssh/known_hosts

It seems as if clojure's buildpack doesn't see the changes done by the ssh buildpack in ~/.ssh/config ? I'll keep on investigating but I thought it could be useful to document all this here.

@jkutner
Copy link
Contributor

jkutner commented Apr 7, 2019

do you know if jsch-agent-proxy honors .ssh config and .ssh/known_hosts? maybe you have to configure it directly.

@eelkevanfoeken
Copy link

Did you find a solution for this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants