Replies: 7 comments 18 replies
-
|
Thank you, definitely an interesting topic ;) The https://netlab.tools/example/external/#connecting-to-lab-devices section was concerned more with having direct access to the lab devices, what you seem to be proposing here is the lab server acting as a sort of a bastion host, right? Anyway, we could do the same thing as a netlab report, but then of course you'd have to save it (or append it) to ssh_config file yourself. |
Beta Was this translation helpful? Give feedback.
-
|
@a-v-popov The proof-of-concept code is in ssh-config branch (you'll have to run netlab from local Git repo). I decided to use RemoteCommand for all devices to get around the password/identity file morass. Works well for terminal access, but OTOH you cannot execute a command on a device or do scp. Would appreciate your feedback; I'll add port forwarding once we get the initial concept to a usable state. |
Beta Was this translation helpful? Give feedback.
-
|
I updated the ssh-config branch (and opened #2593). The "ssh_config" report now generates two hostnames for devices with SSH access, and port forwarding rules if the nodes have clab.ports or libvirt.ports forwarding specs. |
Beta Was this translation helpful? Give feedback.
-
|
Instead of adding multiple options into netlab, why not just support passing ssh_config that enables whatever ssh allows? |
Beta Was this translation helpful? Give feedback.
-
|
He wants ssh_config generated? I see. |
Beta Was this translation helpful? Give feedback.
-
|
@a-v-popov I changed the report to use netlab_ssh_forward node parameter for forwarded SSH ports. It's not ideal, but it was the minimally intrusive solution. Switch to the ssh-config branch to try it out. I have no idea how many other people use port forwarding; if it turns out that port forwarding is popular then we can start thinking about the "perfect world" solution. |
Beta Was this translation helpful? Give feedback.
-
|
Implemented in #2593 |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
It is not an idea for a feature, but for documentation probably. Not sure in which category it should go.
Looking at https://netlab.tools/example/external/#connecting-to-lab-devices somehow I do not see option to use a built-in SSH functionality to access lab devices. For example one can use the following ansible playbook and jinja template to generate ssh config file:
# cat ssh_config.j2 # --- start of netlab config --- Host netlab Hostname {{ ipify_public_ip }} {% for host in groups['fortios'] %} {% set hv = hostvars[host] %} {% if hv.get('provider') != 'clab' %} LocalForward {{ 8000 + hv.id }} {{ hv.ansible_host }}:443 {% endif %} {% endfor %} {% for host in groups['all'] %} {% set hv = hostvars[host] %} Host {{ host }} {% if hv.get('provider') == 'clab' %} Hostname netlab RequestTTY yes RemoteCommand docker exec -it {{ hv.ansible_host }} sh -il {% else %} Hostname {{ hv.ansible_host }} User {{ hv.ansible_user }} ProxyJump netlab {% endif %} {% endfor %} # --- end of netlab config ---Beta Was this translation helpful? Give feedback.
All reactions