ytti / oxidized

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

Hook to gogs authentication issue #3193

Open Arrace opened 5 months ago

Arrace commented 5 months ago

I'm running both gogs and oxidized in a swarm container and I'm running into authentication issues and I'm not finding the issue. If I manually push from the container with the same credentials everything is working

`I, [2024-06-14T16:59:25.681212 #32] INFO -- : GithubRepo: Pushing local repository(/home/oxidized/.config/oxidized/NetworkBackups.git/)...

I, [2024-06-14T16:59:25.681529 #32] INFO -- : GithubRepo: to remote: http://10.100.10.205:10880/oxidized/NetworkBackups.git

D, [2024-06-14T16:59:25.783306 #32] DEBUG -- : GithubRepo: {:total_objects=>0, :indexed_objects=>0, :received_objects=>0, :local_objects=>0, :total_deltas=>0, :indexed_deltas=>0, :received_bytes=>0}

D, [2024-06-14T16:59:25.784802 #32] DEBUG -- : lib/oxidized/model/model.rb Executing show vtp status

D, [2024-06-14T16:59:25.787510 #32] DEBUG -- : lib/oxidized/input/ssh.rb show vtp status @ R02_1841.oxidized.test with expect: /^([\w.@()-]+[#>]\s?)$/

D, [2024-06-14T16:59:25.788156 #32] DEBUG -- : lib/oxidized/input/ssh.rb: expecting [/^([\w.@()-]+[#>]\s?)$/] at R02_1841.oxidized.test

D, [2024-06-14T16:59:25.787315 #32] DEBUG -- : GithubRepo: nothing received after fetch

E, [2024-06-14T16:59:25.858014 #32] ERROR -- : Hook push_to_remote (#) failed (#) for event :post_store`

Here's the manual push

`# cd /home/oxidized/.config/oxidized/NetworkBackups.git

git push -u origin master

Enumerating objects: 5, done. Counting objects: 100% (5/5), done. Delta compression using up to 4 threads Compressing objects: 100% (3/3), done. Writing objects: 100% (3/3), 2.75 KiB | 235.00 KiB/s, done. Total 3 (delta 2), reused 0 (delta 0), pack-reused 0 Username for 'http://10.100.10.205:10880': oxidized Password for 'http://oxidized@10.100.10.205:10880': To http://10.100.10.205:10880/oxidized/NetworkBackups.git 7e8d3da..6d97673 master -> master Branch 'master' set up to track remote branch 'master' from 'origin'.`

Here's the output and hooks section from my config

output: default: git git: user: "oxidized" email: "test@oxidized.test" repo: "/home/oxidized/.config/oxidized/NetworkBackups.git"

hooks: push_to_remote: type: githubrepo events: [post_store] remote_repo: "http://10.100.10.205:10880/oxidized/NetworkBackups.git" username: oxidized password: oxidized

schiz0phr3ne commented 5 months ago

Hi,

I ran into the same issue, except that I'm on docker compose and not swarm.

oxidized             | I, [2024-06-22T16:43:41.181078 #47]  INFO -- : Configuration updated for mikrotik/45.92.203.91
oxidized             | I, [2024-06-22T16:43:41.181289 #47]  INFO -- : GithubRepo: Pushing local repository(/home/oxidized/.config/oxidized/configs.git/)...
oxidized             | I, [2024-06-22T16:43:41.181304 #47]  INFO -- : GithubRepo: to remote: http://gogs:3000/oxidized/configs.git
oxidized             | E, [2024-06-22T16:43:41.229953 #47] ERROR -- : Hook push_to_remote (#<GithubRepo:0x00005b5c564fb218>) failed (#<Rugged::HTTPError: unexpected authentication failure>) for event :post_store

Did you solve this issue ?

Arrace commented 5 months ago

Not yet, I haven't had a chance to mess with it since I posted above. My next step was to run a packet capture to check that oxidized is using the correct credentials

schiz0phr3ne commented 5 months ago

I did a packet capture, and I can see some packets relative to the git repo configured in oxidized conf :

GET /oxidized/configs.git/info/refs?service=git-upload-pack HTTP/1.1
[...]
GET /oxidized/configs.git/info/refs?service=git-receive-pack HTTP/1.1

I can also see some packets noted as Git Smart Protocol, which show the progress of an data transfer.

I'm not confortable with that, to diagnose (if capture can help more than that, what I doubt).

Arrace commented 5 months ago

I was able to look at this again, I'm not seeing the same errors. I don't think I've changed any configuration since the last time, it might have redeployed without me knowing though.

I, [2024-06-26T19:20:00.540371 #34] INFO -- : GithubRepo: Pushing local repository(/home/oxidized/.config/oxidized/NetworkBackups.git/)... I, [2024-06-26T19:20:00.540636 #34] INFO -- : GithubRepo: to remote: http://10.100.10.205:10880/oxidized/NetworkBackups.git D, [2024-06-26T19:20:02.220202 #34] DEBUG -- : GithubRepo: {:total_objects=>0, :indexed_objects=>0, :received_objects=>0, :local_objects=>0, :total_deltas=>0, :indexed_deltas=>0, :received_bytes=>0} D, [2024-06-26T19:20:02.221862 #34] DEBUG -- : GithubRepo: nothing received after fetch

I added a new device to pull the config from and I'm not seeing it, but at least it appears like it's able to access the page over http now

I should be able to look into it deeper this week

github-actions[bot] commented 2 months ago

This issue is stale because it has been open 90 days with no activity.