ytti / oxidized

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

ssh proxy connection problem #3098

Closed AndriyChernov closed 1 month ago

AndriyChernov commented 6 months ago

I have Ubuntu 22.04 with ruby 3.0.2p107 and oxidized 0.29.1

config:
source:
  default: csv
  csv:
    file: "/home/oxidized/.config/oxidized/router.db"
    delimiter: !ruby/regexp /:/
    map:
      name: 0
      model: 1
      ip: 2
      username: 4
      password: 5
      group: 7
    vars_map:
      ssh_proxy: 8
    vars:
      auth_methods: [ "publickey", "password" ]
      ssh_keys: "/home/oxidized/.ssh/id_rsa"

source:

sw.fiber:routeros:10.70.0.10:22:host-user:host-password:switch:Group1:proxy-user@proxy-ip

My device and ssh proxy is Mikrotik ROS 6.49.8. ssh forwarding is enabled.

When I try to connect via proxy I have next message in log:

/var/lib/gems/3.0.0/gems/oxidized-0.29.1/lib/oxidized/input/ssh.rb:27:in connect : Passing nil, or [nil] to Net::SSH.start is deprecated for keys: proxy

Without ssh-proxy I have a successful connection to all devices.

robertcheramy commented 6 months ago

(I've edited the issue so it is more readable)

romainsi commented 5 months ago

Hello,

Your mapping doesn't seem to be correct, I don't think it works if you leave a mapping empty. You need to add the ssh_port mapping on index 3, add mapping for index 6 (switch), also in your source there seems to be one element too many 'Group1'.

Also, I'm not sure you can pass the desired proxy user as an argument (proxy-user@proxy-ip), I haven't tested it ... It seems to me that it uses the Oxidized user with Docker (and the user that launches the service in a direct installation).

Here's the example I used, which seems to work (unless the equipment behind the proxy is also a Mikrotik cf : #3114 ) :