[Twisted-Python] Aplication process uid/gid

Miguel Filho miguel.filho at gmail.com
Mon Apr 28 09:09:01 MDT 2008


On Mon, Apr 28, 2008 at 10:52 AM, Jean-Paul Calderone
<exarkun at divmod.com> wrote:
>
>  Only services which are children of the application get startService called
>  on them.  So to do it this way, you'll need a service in that situation.
>  Factories get startFactory called on them when they're bound to their first
>  port (and stopFactory when they're unbound from their last).  If you're
>  binding a privileged port, though, then this will happen while the process
>  is still running as root, so it's not as reliable as using startService.
>

There we go:

class ACLPolicyDaemonService(service.Service):
    def __init__(self):
        self.factory = ACLPolicyDaemonFactory()

    def startService(self):
        self.factory.configure()
        service.Service.startService(self)

I borrowed the code and ideas from the tutorial[1] and it is working
fine, I call my configure() method inside the service, and the file is
created as nobody as needed. Thank you very much for the help.

Regards,

Miguel

[1] http://twistedmatrix.com/projects/core/documentation/howto/tutorial/protocol.html#auto2




More information about the Twisted-Python mailing list