Jump box ideas

Discussion in 'Ruby' started by Josh Hurtado, May 27, 2011.

  1. Josh Hurtado

    Josh Hurtado Guest

    Hi Everyone,
    I posted a differnt but related thread about this so though I would hit
    from a differnt direction.

    I have a secure SSH box which has access to my differnt Cisco routers. I
    want to write a program that

    a) ssh's from my machine to the jump box
    b) run through a list of routers and telnet into each one and grab the
    running config
    c) close the session

    Trying to fiugre out a good way to approach this. I can get the NET::SSH
    session open to the box, but can't figure out how to go form there to
    step 2.

    --
    Posted via http://www.ruby-forum.com/.
     
    Josh Hurtado, May 27, 2011
    #1
    1. Advertisements

  2. [Note: parts of this message were removed to make it a legal post.]

    Afternoon Josh,

    On Thu, May 26, 2011 at 4:20 PM, Josh Hurtado <> wrote:

    > Hi Everyone,
    > I posted a differnt but related thread about this so though I would hit
    > from a differnt direction.
    >
    > I have a secure SSH box which has access to my differnt Cisco routers. I
    > want to write a program that
    >
    > a) ssh's from my machine to the jump box
    > b) run through a list of routers and telnet into each one and grab the
    > running config
    > c) close the session
    >
    > Trying to fiugre out a good way to approach this. I can get the NET::SSH
    > session open to the box, but can't figure out how to go form there to
    > step 2.
    >


    You want to use SSH Fowarding to forward your telnet sessions over the wire
    to the remote side.

    http://net-ssh.rubyforge.org/ssh/v2/api/ <- the ssh api documentation has
    forwarding as the third to last line of the large example at the top of the
    page.

    Basically you do the following - you tell the ssh session to forward a LOCAL
    port over the wire to a remote address (in this case one of your cisco
    servers).

    So as an example

    If you had a server at 10.0.0.1 port 21 then you could write

    ssh.forward.local(12345, "10.0.0.1", 21)

    Then use the telnet object to connect to port 12345 - this will
    automatically be forwarded over the wire to 10.0.0.1 port 21 via the ssh
    connection.

    So for step 2 you would create an array of your router addresses and then
    something like this

    addrs = ['10.0.0.1', '10.0.0.2', '10.0.0.3']
    addrs.each { |addr|
    ssh.forward.local(12345, addr, 21)
    connect to port 12345 on your localhost with telnet and pull down the
    config
    }

    John
    John
     
    John W Higgins, May 27, 2011
    #2
    1. Advertisements

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. mit
    Replies:
    1
    Views:
    1,012
    Ramu Pulipati
    Jan 25, 2006
  2. =?Utf-8?B?QW5nZWw=?=

    COMBO BOX INSTEAD OF DROP DOWN BOX

    =?Utf-8?B?QW5nZWw=?=, Jun 29, 2004, in forum: ASP .Net
    Replies:
    3
    Views:
    869
    Ken Cox [Microsoft MVP]
    Jun 29, 2004
  3. SirPoonga
    Replies:
    2
    Views:
    1,039
    Ben Strackany
    Jan 7, 2005
  4. Replies:
    1
    Views:
    1,366
    David Wier
    Aug 5, 2005
  5. ashutosh
    Replies:
    3
    Views:
    9,245
    Andrew Thompson
    Jun 16, 2005
  6. Gnarlodious
    Replies:
    4
    Views:
    18,003
    elizas
    May 5, 2010
  7. Kenton

    Double Jump Box Redirection

    Kenton, Feb 27, 2004, in forum: Perl Misc
    Replies:
    9
    Views:
    338
    Sandman
    Mar 4, 2004
  8. Eadwine Rose
    Replies:
    2
    Views:
    380
    Eadwine Rose
    Oct 15, 2006
Loading...