mirror of
https://github.com/frappe/gunicorn.git
synced 2026-01-14 11:09:11 +08:00
Reseed the random number generator after fork().
Web applications use random numbers for things like sessions, if we don't reseed then each worker will generate the same sequence of random numbers which can lead to security concerns. Thanks to Jonas Borgström for the patch.
This commit is contained in:
parent
5a4e16cf5b
commit
abb4f2a765
2
THANKS
2
THANKS
@ -13,3 +13,5 @@ Chris Dent <chris.dent@gmail.com>
|
||||
Matt Good <matt@matt-good.net>
|
||||
Randall Leeds <randall.leeds@gmail.com>
|
||||
thomasst <http://github.com/thomasst>
|
||||
Jonas Borgström <http://github.com/jborg>
|
||||
|
||||
|
||||
@ -6,6 +6,7 @@
|
||||
|
||||
import logging
|
||||
import os
|
||||
import random
|
||||
import signal
|
||||
import sys
|
||||
import tempfile
|
||||
@ -82,6 +83,9 @@ class Worker(object):
|
||||
"""
|
||||
util.set_owner_process(self.cfg.uid, self.cfg.gid)
|
||||
|
||||
# Reseed the random number generator
|
||||
random.seed()
|
||||
|
||||
# For waking ourselves up
|
||||
self.PIPE = os.pipe()
|
||||
map(util.set_non_blocking, self.PIPE)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user