Getting to an SSH account over a HTTP proxy

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • =?ISO-8859-1?Q?BJ=F6rn_Lindqvist?=

    #1

    Getting to an SSH account over a HTTP proxy

    I want to use Python to connect to a SSH account over a HTTP proxy to
    automate some operations. I thought paramiko would be able to do that,
    but it can not (it seems).

    Is there some other Python module that can do what I want?

    --
    mvh Björn
  • Diez B. Roggisch

    #2
    Re: Getting to an SSH account over a HTTP proxy

    BJörn Lindqvist wrote:
    I want to use Python to connect to a SSH account over a HTTP proxy to
    automate some operations. I thought paramiko would be able to do that,
    but it can not (it seems).
    >
    Is there some other Python module that can do what I want?
    Is there anything that can do what you want? Last time I checked there is no
    such thing as SSH-over-HTTP. Are you sure that is possible?

    Diez

    Comment

    • Yu-Xi Lim

      #3
      Re: Getting to an SSH account over a HTTP proxy

      Diez B. Roggisch wrote:
      BJörn Lindqvist wrote:
      >
      >I want to use Python to connect to a SSH account over a HTTP proxy to
      >automate some operations. I thought paramiko would be able to do that,
      >but it can not (it seems).
      >>
      >Is there some other Python module that can do what I want?
      >
      Is there anything that can do what you want? Last time I checked there is no
      such thing as SSH-over-HTTP. Are you sure that is possible?
      He's referring to the HTTP CONNECT method, which can tunnel arbitrary
      TCP connections, not just HTTP. The IETF draft for this is titled
      "Tunneling TCP based protocols through Web proxy servers".

      AFAIK, there are no Python modules which support that. The protocol
      itself is fairly simply though, so it shouldn't be too hard to write
      your own wrapper or proxy for the client side. Things get a little more
      complicated if you have to authenticate with the proxy first.

      Comment

      • Jorgen Grahn

        #4
        Re: Getting to an SSH account over a HTTP proxy

        On Mon, 22 Jan 2007 14:40:49 +0100, Diez B. Roggisch <deets@nospam.w eb.dewrote:
        BJörn Lindqvist wrote:
        >
        >I want to use Python to connect to a SSH account over a HTTP proxy to
        >automate some operations. I thought paramiko would be able to do that,
        >but it can not (it seems).
        >>
        >Is there some other Python module that can do what I want?
        >
        Is there anything that can do what you want? Last time I checked there is no
        such thing as SSH-over-HTTP. Are you sure that is possible?
        I am pretty sure there is. Or at least TCP-over-HTTP, or IP-over-HTTP. An
        acquaintance of mine used it to tonnel home through a corporate firewall. I
        think -- I didn't want to know the details.

        If you implement in the same way as ssh tunnels, the application doesn't
        need to know anything about it -- you just talk to a TCP port on localhost.
        Good for everyone involved.

        /Jorgen

        --
        // Jorgen Grahn <grahn@ Ph'nglui mglw'nafh Cthulhu
        \X/ snipabacken.dyn dns.org R'lyeh wgah'nagl fhtagn!

        Comment

        • Nanjundi

          #5
          Re: Getting to an SSH account over a HTTP proxy


          BJörn Lindqvist wrote:
          I want to use Python to connect to a SSH account over a HTTP proxy to
          automate some operations. I thought paramiko would be able to do that,
          but it can not (it seems).
          >
          Is there some other Python module that can do what I want?
          >
          --
          mvh Björn
          Did you take a look at twisted library?
          twistedmatrix.c om



          I haven't tried to connect over port 80, but its worth a try.

          -N

          Comment

          • Willi Richert

            #6
            Re: Getting to an SSH account over a HTTP proxy

            Am Dienstag, 23. Januar 2007 02:16 schrieb Nanjundi:
            BJörn Lindqvist wrote:
            I want to use Python to connect to a SSH account over a HTTP proxy to
            automate some operations. I thought paramiko would be able to do that,
            but it can not (it seems).

            Is there some other Python module that can do what I want?

            --
            mvh Björn
            >
            Did you take a look at twisted library?
            twistedmatrix.c om

            >
            >
            I haven't tried to connect over port 80, but its worth a try.
            >
            -N
            If you need it for automation you might want to use pexpect:
            Download Pexpect - Pure Python Expect-like module for free. Pexpect is a Python module for spawning child applications; controlling them;


            It listens to the tty-stream and simulates a user typing in commands. It is
            very useful, e.g. if you want to start processes on many machines over ssh.
            If there are gateways/firewalls between - no problem just use a
            second "sendline(' ssh user@nextmachin e')"

            The only problem is the regular expression: If e.g. you use a custom $PS1
            variable for your prompt you have to account for that.

            Regards,
            wr

            Comment

            • Anders Arnholm

              #7
              Re: Getting to an SSH account over a HTTP proxy

              Jorgen Grahn <grahn+nntp@sni pabacken.dyndns .orgskriver:
              I am pretty sure there is. Or at least TCP-over-HTTP, or IP-over-HTTP. An
              acquaintance of mine used it to tonnel home through a corporate firewall. I
              think -- I didn't want to know the details.
              Ypu can tunnel ip over anything. (Even email if you like...) Nu tunnel
              out from that company was based on http-proxy. A small program called
              connect (the final version I used was by Shun-ichi Goto and under
              GPL.) Bascilly it makes a http-proxt connect to an other site (my sshd)
              Then using sshd and pppd as program inte other end makes a good way to
              tunnel IP also :-)

              / Anders
              --
              http://anders.arnholm.nu/ Keep on Balping

              Comment

              • amadain

                #8
                Re: Getting to an SSH account over a HTTP proxy

                use pexpect to set the prompt after the login.

                class Login(General):
                """Class spawning an ssh expect instance"""
                def __init__(self, user, host, pwd, cfg_name=None, log=None):
                if cfg_name:
                self.testcell = test_config(cfg _name)
                self.spawn = pexpect.spawn(" ssh %s@%s" % (user, host), [], 100)
                if log:
                self.spawn.logf ile = log
                sshreply = self.spawn.expe ct(["Last login", "assword", "connecting "])

                if sshreply == 1:
                self.spawn.send line(pwd)
                self.spawn.expe ct("Last login")
                elif sshreply == 2:
                time.sleep(0.1)
                self.spawn.send line("yes")
                print self.spawn.afte r
                Login(user, host, cfg_name, log)
                time.sleep(1)
                self.prompt=pro mpt_chg(self.sp awn, "PROMPT:")
                self.spawn.send line("uname -a")
                self.spawn.expe ct(self.prompt)


                On Jan 23, 10:28 am, Willi Richert <w.rich...@gmx. netwrote:
                Am Dienstag, 23. Januar 2007 02:16 schrieb Nanjundi:
                >
                >
                >
                BJörn Lindqvist wrote:
                I want to use Python to connect to a SSH account over a HTTP proxy to
                automate some operations. I thought paramiko would be able to do that,
                but it can not (it seems).
                >
                Is there some other Python module that can do what I want?
                >
                --
                mvh Björn
                >
                Did you take a look at twisted library?
                twistedmatrix.c om
                http://twistedmatrix.com/projects/co...o/clients.html
                >
                I haven't tried to connect over port 80, but its worth a try.
                >
                -NIf you need it for automation you might want to usepexpect:http://pexpect.sourceforge.net/
                >
                It listens to the tty-stream and simulates a user typing in commands. It is
                very useful, e.g. if you want to start processes on many machines over ssh.
                If there are gateways/firewalls between - no problem just use a
                second "sendline(' ssh user@nextmachin e')"
                >
                The only problem is the regular expression: If e.g. you use a custom $PS1
                variable for your prompt you have to account for that.

                Regards,
                wr

                Comment

                • =?ISO-8859-1?Q?BJ=F6rn_Lindqvist?=

                  #9
                  Re: Getting to an SSH account over a HTTP proxy

                  On 22 Jan 2007 17:16:35 -0800, Nanjundi <nanjundi@gmail .comwrote:
                  BJörn Lindqvist wrote:
                  I want to use Python to connect to a SSH account over a HTTP proxy to
                  automate some operations. I thought paramiko would be able to do that,
                  but it can not (it seems).

                  Is there some other Python module that can do what I want?

                  --
                  mvh Björn
                  >
                  Did you take a look at twisted library?
                  twistedmatrix.c om

                  >
                  >
                  I haven't tried to connect over port 80, but its worth a try.
                  I looked at Twisted, but I did not understand how it could solve my
                  problem. I do not want to create my own SSH client and, AFAICT, there
                  is no SSH client in Twisted. The library also seem to have some
                  problems with handling HTTP proxies in a transparent way:


                  --
                  mvh Björn

                  Comment

                  • =?ISO-8859-1?Q?BJ=F6rn_Lindqvist?=

                    #10
                    Re: Getting to an SSH account over a HTTP proxy

                    On 1/22/07, Yu-Xi Lim <yuxi@ece.gatec h.eduwrote:
                    He's referring to the HTTP CONNECT method, which can tunnel arbitrary
                    TCP connections, not just HTTP. The IETF draft for this is titled
                    "Tunneling TCP based protocols through Web proxy servers".
                    >
                    AFAIK, there are no Python modules which support that. The protocol
                    itself is fairly simply though, so it shouldn't be too hard to write
                    your own wrapper or proxy for the client side. Things get a little more
                    complicated if you have to authenticate with the proxy first.
                    The proxy in question requires authentication. Do you mean that I
                    should be able to write something that handles the communication to
                    the proxy and then run a library like paramiko "over that"? I have no
                    idea how to do that.

                    --
                    mvh Björn

                    Comment

                    • Nanjundi

                      #11
                      Re: Getting to an SSH account over a HTTP proxy


                      problem. I do not want to create my own SSH client and, AFAICT, there
                      is no SSH client in Twisted. The library also seem to have some
                      problems with handling HTTP proxies in a transparent way:http://twistedmatrix.com/trac/ticket/1774
                      >
                      --
                      mvh Björn

                      There is a ssh implementation in twisted.


                      Are you able to authenticate and run commands using a ssh client on
                      port 80?
                      I will try to post an example if possible.
                      -N

                      Comment

                      Working...