Added the ability to explicitly specify the port on which the telnet, ssh is running for each host - #3860
Added the ability to explicitly specify the port on which the telnet, ssh is running for each host#3860rajven wants to merge 1 commit into
Conversation
…or ssh service is running for each host, i.e.
in config:
source:
default: csv
csv:
file: "/home/oxidized/.config/oxidized/router.db"
delimiter: !ruby/regexp /\:/
map:
name: 0
ip: 1
username: 2
password: 3
model: 4
added: input_port: 5
input: 6
group: 7
vars_map:
enable: 8
comware_cmdline: 9
in router.db:
router:192.168.1.1:admin:password:routeros:60022:ssh:Gateways::
|
You can of course already do this for SSH, Telnet per node. And collapsing it as input port for node suggests we guarantee ssh and telnet and other inputs all listen on same port, as same node way traverse multiple inputs, this is not a safe assumption. |
That's the whole point — so that for a specific equipment, you can explicitly specify the port on which SSH or Telnet is running. |
|
I dont follow. When would you need this? Why wont specifying telnet or ssh port as needed work? |
|
Well, look - I have a group of devices, for example mikrotik, for which ssh runs on a non-standard port, for example 5122. And all the other mikrotik are on standard port 22. What should I do in this situation? |
|
You set ssh_port for the 5122 device, using vars_map. |
|
Is it possible to do this selectively on the device? |
|
Technically depends on source, in CVS you point to an index which has to exist, in SQL you point to a row which has to exist, but even then it can return falsy value. If it returns falsy value, default 22 will be used. You can further customise what is returned between source and actual node by adding hook. Let's say you want 2222 for all, except 2223 for few, but you don't want to write 2222 to all. Then you could write a hook that'll return 2222 on falsy value, otherwise configured. value. |
|
Why such difficulties? And then how can you not forget what you did that hook for? |
|
It was just an example, you don't need to do hook. You can just not configure truthy value in source for node which should use 22, and only configure truthy value for node which should use it. In your case: Which is in no way different to what you propose, as the field has to exist in your case too. |
|
I'll try it tomorrow, thanks. |
Added the ability to explicitly specify the port on which the telnet or ssh service is running for each host, i.e.
in config:
source:
default: csv
csv:
file: "/home/oxidized/.config/oxidized/router.db"
delimiter: !ruby/regexp /:/
map:
name: 0
ip: 1
username: 2
password: 3
model: 4
added: input_port: 5
input: 6
group: 7
vars_map:
enable: 8
comware_cmdline: 9
in router.db:
router:192.168.1.1:admin:password:routeros:60022:ssh:Gateways::
Pre-Request Checklist
rubocop --auto-correct)rake test)Description