ytti / oxidized

Oxidized is a network device configuration backup tool. It's a RANCID replacement!
Apache License 2.0
2.78k stars 918 forks source link

ERROR -- : Hook push_to_remote SshError: remote rejected authentication: Failed getting response #3148

Open Skull0ne opened 5 months ago

Skull0ne commented 5 months ago

Hi

I tried to reconfigure the git hook from user/password to ssh key but I can't find the solution.

The config :

hooks:
  push_to_remote:
    type: githubrepo
    events: [post_store]
    remote_repo: "ssh://git@GIT_URL/infrastructure/oxidized.git"
    privatekey: "/home/oxidized/.ssh/id_rsa"
    publickey: "/home/oxidized/.ssh/id_rsa.pub"

For the remote_repo I also tried "git@GIT_URL:infrastructure/oxidized.git".

The id_rsa key starts with "-----BEGIN RSA PRIVATE KEY-----" and there is no line return at the end.

.ssh folder and key files are owned by the user.

Known_hosts contains the info for my git repo.

I'm able to git clone the repo manually and commit into it :

oxidized@898fd87005f4:~$ git clone ssh://git@GIT_URL/infrastructure/oxidized.git
Cloning into 'oxidized'...
remote: Enumerating objects: 6885, done.
remote: Counting objects: 100% (6885/6885), done.
remote: Compressing objects: 100% (2483/2483), done.
remote: Total 6885 (delta 4401), reused 6878 (delta 4399), pack-reused 0
Receiving objects: 100% (6885/6885), 7.49 MiB | 40.16 MiB/s, done.
Resolving deltas: 100% (4401/4401), done.

[...]

oxidized@898fd87005f4:~/oxidized$ git push
Enumerating objects: 5, done.
Counting objects: 100% (5/5), done.
Delta compression using up to 8 threads
Compressing objects: 100% (3/3), done.
Writing objects: 100% (3/3), 316 bytes | 316.00 KiB/s, done.
Total 3 (delta 2), reused 0 (delta 0), pack-reused 0
To ssh://GIT_URL/infrastructure/oxidized.git
   61e0ee5..7a7ecd4  main -> main

I've added "IdentitiesOnly yes" to my .ssh/config for my gitlab host, without that I couldn't clone the repo.

LIBSSH2 version :

ii  libssh2-1:amd64              1.10.0-3                                amd64        SSH2 client-side library

I tried to enable the debug mode with it didn't give much.

Error :

I, [2024-04-30T21:07:04.171384 #32]  INFO -- : GithubRepo: Pushing local repository(/home/oxidized/.config/oxidized/oxidized.git/)...
I, [2024-04-30T21:07:04.171438 #32]  INFO -- : GithubRepo: to remote: ssh://git@GIT_URL/infrastructure/oxidized.git
E, [2024-04-30T21:07:04.338160 #32] ERROR -- : Hook push_to_remote (#<GithubRepo:0x000055d2585ec358>) failed (#<Rugged::SshError: remote rejected authentication: Failed getting response>) for event :post_store

Thanks

YellowJacket51 commented 4 months ago

I am having this issue too. Were you able to fix your issue?

Oxidized version: 0.30.1 Gitlab version: 17.0.1

Skull0ne commented 3 months ago

@YellowJacket51 no still ongoing

robertcheramy commented 3 months ago

Have you tested https://github.com/ytti/oxidized/blob/master/docs/Troubleshooting.md#oxidized-does-not-push-to-a-remote-git-repository-hook-githubrepo ?

Skull0ne commented 3 months ago

@robertcheramy Yes, I've done it for both root & oxidized user within the pod

robertcheramy commented 2 months ago

Please have a look at #1517 . If it solves your Problem, please report it here, I would try to document how to solve the issue in docs/Troubleshooting.md .