Snakelets via SSL

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Roland Heiber

    #1

    Snakelets via SSL

    Hi,

    after Irmen de Jong did another fine release with Snakelets-1.38 i just
    did a dirty hack for using snakelets with SSL-support. SSL-support is
    added through the use of tlslite from Trevor Perrin. You'll have to
    download and install it from http://trevp.net/tlslite/. Furthermore you
    need a key-pair in your serverdir, easily generetad with openssl.

    Just snip the patch below and use it against snakeserver/server.py (with
    standard *nix patch).

    HtH, Roland

    ---- SNIP BELOW, SAVE AS ssl.patch ----
    961d
    927a

    def handshake(self, tlsConnection):
    try:
    tlsConnection.h andshakeServer( certChain=certC hain,
    privateKey=priv ateKey,
    sessionCache=se ssionCache)
    tlsConnection.i gnoreAbruptClos e = True
    return True
    except (SyntaxError, TLSError), error:
    print "Handshake failure:", str(error)
    return False


    ..
    908c
    if IS_SSL:
    tlsConnection = TLSConnection(r equest)
    if self.handshake( tlsConnection) == True:
    self.RequestHan dlerClass(tlsCo nnection,
    client_address, self)
    tlsConnection.c lose()
    else:
    self.RequestHan dlerClass(reque st, client_address, self)
    ..
    889c
    if IS_SSL:
    tlsConnection = TLSConnection(r equest)
    if self.handshake( tlsConnection) == True:
    self.RequestHan dlerClass(tlsCo nnection,
    client_address, self)
    tlsConnection.c lose()
    else:
    self.RequestHan dlerClass(reque st, client_address, self)
    ..
    21a
    IS_SSL=True
    try:
    from tlslite.api import *
    except ImportError:
    IS_SSL=False

    if IS_SSL:
    s = open("./localhost.crt") .read()
    x509 = X509()
    x509.parse(s)
    certChain = X509CertChain([x509])

    s = open("./localhost.priva te.key").read()
    privateKey = parsePEMKey(s, private=True)

    sessionCache = SessionCache()

    ..
  • Irmen de Jong

    #2
    Re: Snakelets via SSL

    Roland Heiber wrote:[color=blue]
    > Hi,
    >
    > after Irmen de Jong did another fine release with Snakelets-1.38 i just
    > did a dirty hack for using snakelets with SSL-support. SSL-support is
    > added through the use of tlslite from Trevor Perrin. You'll have to
    > download and install it from http://trevp.net/tlslite/. Furthermore you
    > need a key-pair in your serverdir, easily generetad with openssl.
    >
    > Just snip the patch below and use it against snakeserver/server.py (with
    > standard *nix patch).
    >[/color]

    [...]

    Hey, thanks a lot! I must confess that I'm not knowledgeable in
    this field (HTTPS/SSL) so I really appreciate it that you did
    some work on this.

    However, may I ask you to re-submit the patch but this time
    in the patch tracker on SF; http://sourceforge.net/tracker/?group_id=41175
    because news/mail clients often mangle source code.

    --Irmen

    Comment

    • Irmen de Jong

      #3
      Re: Snakelets via SSL

      Roland Heiber wrote:[color=blue]
      > Hi,
      >
      > after Irmen de Jong did another fine release with Snakelets-1.38 i just
      > did a dirty hack for using snakelets with SSL-support. SSL-support is
      > added through the use of tlslite from Trevor Perrin. You'll have to
      > download and install it from http://trevp.net/tlslite/. Furthermore you
      > need a key-pair in your serverdir, easily generetad with openssl.
      >
      > Just snip the patch below and use it against snakeserver/server.py (with
      > standard *nix patch).
      >[/color]

      [...]

      Hey, thanks a lot! I must confess that I'm not knowledgeable in
      this field (HTTPS/SSL) so I really appreciate it that you did
      some work on this.

      However, may I ask you to re-submit the patch but this time
      in the patch tracker on SF; http://sourceforge.net/tracker/?group_id=41175
      because news/mail clients often mangle source code.

      --Irmen

      Comment

      • Roland Heiber

        #4
        Re: Snakelets via SSL

        Irmen de Jong wrote:[color=blue]
        > However, may I ask you to re-submit the patch but this time
        > in the patch tracker on SF; http://sourceforge.net/tracker/?group_id=41175
        > because news/mail clients often mangle source code.[/color]

        Hi,

        I re-submited it as requested. It's just a quick hack, but maybe it's
        worth trying.

        HtH, Roland

        Comment

        Working...