[Twisted-Python] Twisted-Python Digest, Vol 72, Issue 35

sara bai sara.byh at gmail.com
Wed Mar 24 21:53:17 EDT 2010


hi all, i run into this problem   “


”The debugged program raised the exception unhandled Error
"[('PEM routines', 'PEM_read_bio', 'no start line'), ('SSL routines',
'SSL_CTX_use_PrivateKey_file', 'PEM lib')]"
File:
/usr/lib/python2.5/site-packages/Twisted-10.0.0-py2.5-linux-i686.egg/twisted/internet/ssl.py,
Line: 99"


 (
usr/lib/python25/site-packages/Twisted-10.0.0-py2.5-linux-i686.egg/twisted/internet/ssl.py
line 99 )

    def cacheContext(self):
        if self._context is None:
            ctx = self._contextFactory(self.sslmethod)
            # Disallow SSLv2!  It's insecure!  SSLv3 has been around since
            # 1996.  It's time to move on.
            ctx.set_options(SSL.OP_NO_SSLv2)
            ctx.use_certificate_file(self.certificateFileName)
            ctx.use_privatekey_file(self.privateKeyFileName)    # Line: 99
            self._context = ctx

here is the way i create privkey file :
   $ openssl genrsa > privkey.pem

then
   $ openssl req -new -x509 -key privkey.pem -out cacert.pem -days 1000

i have checked the cacert.pem file it do has 'strt line ' --BEGIN
CERTIFICATE----


 part of my code  :


class syslogOptions(usage.Options):
    optParameters = [['cert', 'c', '/home/ssltest/cacert.pem','SSL Server
certificate'],
                            ['ip',   'i', None, 'IP Address to listen on']]
    def postOptions(self):
        if (not self.opts['cert']) or (not
os.path.isfile(self.opts['cert'])):
            raise usage.UsageError, "%s: is not a file" % self.opts['cert']
. . .
syslogSSL = syslogFactory()
    syslogSSL.protocol = outputTCP
    ctx = ssl.DefaultOpenSSLContextFactory(config.opts['cert'],
config.opts['cert'])
 .. .. .
 reactor.listenSSL(708, syslogSSL , ctx, interface=config.opts['ip'])
    reactor.run()

any ideas ? ...







2010/3/25 <twisted-python-request at twistedmatrix.com>

> Send Twisted-Python mailing list submissions to
>        twisted-python at twistedmatrix.com
>
> To subscribe or unsubscribe via the World Wide Web, visit
>        http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python
> or, via email, send a message with subject or body 'help' to
>        twisted-python-request at twistedmatrix.com
>
> You can reach the person managing the list at
>        twisted-python-owner at twistedmatrix.com
>
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of Twisted-Python digest..."
>
>
> Today's Topics:
>
>   1. Re: Nothing Succeeds Like Success (Stories) (David)
>   2. Logout from a perspective broker server (Ramiro Alba Queipo)
>   3. Re: stdio.StandardIO blocks? (Glyph Lefkowitz)
>   4. Re: Logout from a perspective broker server (Glyph Lefkowitz)
>   5. Re: Logout from a perspective broker server (Ramiro Alba Queipo)
>   6. NetstringReceiver (Albert Brandl)
>
>
> ----------------------------------------------------------------------
>
> Message: 1
> Date: Tue, 23 Mar 2010 10:48:41 -0600
> From: David <dvkeeney at gmail.com>
> Subject: Re: [Twisted-Python] Nothing Succeeds Like Success (Stories)
> To: Twisted general discussion <twisted-python at twistedmatrix.com>
> Message-ID:
>        <6e04113a1003230948j41fd0e5bn53ceda6970b36e43 at mail.gmail.com>
> Content-Type: text/plain; charset=ISO-8859-1
>
> On Mon, Mar 22, 2010 at 8:39 PM, Glyph Lefkowitz
> <glyph at twistedmatrix.com> wrote:
>
> > If you're a happy Twisted user who has used Twisted to do something cool,
> *please* send in a blurb for the success stories page! ?This could translate
> into more money and more development for Twisted, thus making it even more
> awesome. ?This goes double if you're a sponsor: please let us know why you
> sponsored and how happy you were that you did :).
>
>
> Rdbhost
>
> Rdbhost uses Twisted for a streaming web-server.  The streaming server
> allows users to stream large SQL 'dump' files to and from the database
> host using a web browser.
>
> http://www.rdbhost.com
>
> --
> dkeeney at rdbhost.com
> Rdbhost -> SQL databases as a webservice [www.rdbhost.com]
>
>
>
> ------------------------------
>
> Message: 2
> Date: Tue, 23 Mar 2010 19:30:36 +0100
> From: Ramiro Alba Queipo <raq at cttc.upc.edu>
> Subject: [Twisted-Python] Logout from a perspective broker server
> To: Twisted general discussion <twisted-python at twistedmatrix.com>
> Message-ID: <1269369036.6222.11.camel at mundo>
> Content-Type: text/plain; charset=ISO-8859-1
>
> Hi all,
>
> I wonder, if I client using pygtk, can logout from the server without
> calling reactor.stop(), as you would kill the GUI. I tried to delete the
> perspective got from the server but it does not work...
>
> Thanks in advance
> Regards
>
> --
> Ramiro Alba
>
> Centre Tecnol?gic de Tranfer?ncia de Calor
> http://www.cttc.upc.edu
>
>
> Escola T?cnica Superior d'Enginyeries
> Industrial i Aeron?utica de Terrassa
> Colom 11, E-08222, Terrassa, Barcelona, Spain
> Tel: (+34) 93 739 86 46
>
>
> --
> Aquest missatge ha estat analitzat per MailScanner
> a la cerca de virus i d'altres continguts perillosos,
> i es considera que est? net.
>
>
>
>
> ------------------------------
>
> Message: 3
> Date: Wed, 24 Mar 2010 05:22:39 -0400
> From: Glyph Lefkowitz <glyph at twistedmatrix.com>
> Subject: Re: [Twisted-Python] stdio.StandardIO blocks?
> To: Twisted general discussion <twisted-python at twistedmatrix.com>
> Message-ID: <6EB44FA1-3F26-433F-A2B3-3FE4AC3A5BD0 at twistedmatrix.com>
> Content-Type: text/plain; charset="us-ascii"
>
>
> On Mar 23, 2010, at 10:00 AM, Willy Lai wrote:
>
> > What I want, is writing stuff in the console, without interrupting the
> > ping mechanism.
> > (The pings and pongs in my case should continue to be sent while typing
> > stuff in the console)
>
> Without a *complete* program example, we can't really tell you what might
> be blocking. It may be a lot of things, from some very simple problems to
> some very complex ones.  Please see <http://sscce.org/> for details on
> what types of examples would be useful.
>
> Based on your simple description, this really should work.  If it didn't,
> 'twistd' wouldn't be able to log to stdout and run a server at the same time
> (and it definitely can, I do that every day, at least ten times).
>
> Thanks,
>
> -glyph
>
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL:
> http://twistedmatrix.com/pipermail/twisted-python/attachments/20100324/65c72bbb/attachment.html
>
> ------------------------------
>
> Message: 4
> Date: Wed, 24 Mar 2010 05:27:13 -0400
> From: Glyph Lefkowitz <glyph at twistedmatrix.com>
> Subject: Re: [Twisted-Python] Logout from a perspective broker server
> To: Twisted general discussion <twisted-python at twistedmatrix.com>
> Message-ID: <44DAEAB5-A177-4367-BBE0-98475F236004 at twistedmatrix.com>
> Content-Type: text/plain; charset="us-ascii"
>
>
> On Mar 23, 2010, at 2:30 PM, Ramiro Alba Queipo wrote:
>
> > I wonder, if I client using pygtk, can logout from the server without
> > calling reactor.stop(), as you would kill the GUI. I tried to delete the
> > perspective got from the server but it does not work...
>
> The simplest thing you can do to achieve this is
> 'broker.transport.loseConnection()'.
>
> Of course, that just unceremoniously drops the connection.  You may want to
> have a 'remote_disconnect' method on the server too, if you have any state
> you would like to cleanly finish up with first.
>
> Your GUI is already handling disconnection due to network problems though,
> right?  :-)  So the modification to make it handle this slightly-cleaner
> disconnect should be minor.  If it doesn't, see the notifyOnDisconnect API
> in PB: <
> http://twistedmatrix.com/documents/10.0.0/api/twisted.spread.pb.Broker.html#notifyOnDisconnect
> >.
>
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL:
> http://twistedmatrix.com/pipermail/twisted-python/attachments/20100324/dac4c598/attachment-0001.htm
>
> ------------------------------
>
> Message: 5
> Date: Wed, 24 Mar 2010 13:28:45 +0100
> From: Ramiro Alba Queipo <raq at cttc.upc.edu>
> Subject: Re: [Twisted-Python] Logout from a perspective broker server
> To: Twisted general discussion <twisted-python at twistedmatrix.com>
> Message-ID: <1269433725.6222.20.camel at mundo>
> Content-Type: text/plain; charset=ISO-8859-1
>
> Glyph,
>
> > > I wonder, if I client using pygtk, can logout from the server
> > > without
> > > calling reactor.stop(), as you would kill the GUI. I tried to delete
> > > the
> > > perspective got from the server but it does not work...
> >
> > The simplest thing you can do to achieve this is
> > 'broker.transport.loseConnection()'.
> >
> >
> > Of course, that just unceremoniously drops the connection.  You may
> > want to have a 'remote_disconnect' method on the server too, if you
> > have any state you would like to cleanly finish up with first.
> >
> After having a look at pb.py code I used
>
> factory = pb.PBClientFactory()
> ....
>
> factory.disconnect()
>
> Then this makes the server call a 'logout' method for the current
> perspective, and makes a clean logout. Any comment?
>
>
> >
> > Your GUI is already handling disconnection due to network problems
> > though, right?  :-)  So the modification to make it handle this
> > slightly-cleaner disconnect should be minor.  If it doesn't, see the
> > notifyOnDisconnect API in PB:
> > <
> http://twistedmatrix.com/documents/10.0.0/api/twisted.spread.pb.Broker.html#notifyOnDisconnect
> >.
>
> Yeah. I was already using it. Very nice. I also wanted to enable a way
> to conecct and disconnect from the client, apart from the client be
> aware of a server restart on simply loosing connection. It works
> cleanly.
>
> Really grateful for your info and comments
>
> Regards
>
> >
> --
> Ramiro Alba
>
> Centre Tecnol?gic de Tranfer?ncia de Calor
> http://www.cttc.upc.edu
>
>
> Escola T?cnica Superior d'Enginyeries
> Industrial i Aeron?utica de Terrassa
> Colom 11, E-08222, Terrassa, Barcelona, Spain
> Tel: (+34) 93 739 86 46
>
>
> --
> Aquest missatge ha estat analitzat per MailScanner
> a la cerca de virus i d'altres continguts perillosos,
> i es considera que est? net.
>
>
>
>
> ------------------------------
>
> Message: 6
> Date: Wed, 24 Mar 2010 13:39:17 +0100
> From: Albert Brandl <albert.brandl at weiermayer.com>
> Subject: [Twisted-Python] NetstringReceiver
> To: twisted-python at twistedmatrix.com
> Message-ID: <20100324123917.GA24344 at weiermayer.com>
> Content-Type: text/plain; charset=iso-8859-1
>
> Hi!
>
> The NetstringReceiver class does not exactly do what I'd expect - see
> issue http://twistedmatrix.com/trac/ticket/4378. Since we plan to use
> netstrings, I am trying to fix it.
>
> I am not quite sure how to handle certain problems, though, and that's
> where I'd appreciate help. If this is the wrong place to ask this kind of
> questions, please redirect me ;-).
>
> 1.) In the current implementation, a NetstringParseError results in a
> call to self.transport.loseConnection(). Furthermore the variable
> brokenPeer is set to 1. But this variable is ignored. Would it be better
> to check it before receiving data? If yes: what is the correct way for a
> protocol to handle a broken transport? There is a ConnectionLost
> exception, but I'm not sure if / when a Protocol is allowed to raise it.
>
> 2.) The current implementation uses the method dataReceived to assemble
> the content of the netstring. When it is complete, the method
> stringReceived (which raises a NotImplementedError by default) is called.
> But netstrings can be long - would it be better to create a Deferred
> instance and call its callback instead? What would be the right place to
> create this Deferred?
>
> 3.) I started testing the NetstringReceiver by creating a class comment
> with doctests. When I later grepped the sources, I found some doctests,
> but there no mention of the doctest module in the test policy document.
> Would it be better to use the unittest framework for testing the code?
>
> Thanks and best regards,
>
> --
> Albert Brandl
> Weiermayer Solutions GmbH
> 4813 Altm?nster | Abteistra?e 12 | Austria
> Fon: +43(0)720 70 30 14 | Fax: +43 (0) 7612 88081
>
>
>
> ------------------------------
>
> _______________________________________________
> Twisted-Python mailing list
> Twisted-Python at twistedmatrix.com
> http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python
>
>
> End of Twisted-Python Digest, Vol 72, Issue 35
> **********************************************
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://twistedmatrix.com/pipermail/twisted-python/attachments/20100325/e22fbf1e/attachment-0001.htm 


More information about the Twisted-Python mailing list