Use secure random to generate transfer key
python random() is not suitable for generating random keys. We better use SystemRandom for these purposes. Change-Id: Icceaf56e67e60e3cd07af6415df5bae2fa76ba17
This commit is contained in:
parent
4c9bd48d54
commit
373863f96b
|
@ -23,6 +23,7 @@ import itertools
|
|||
import string
|
||||
import signal
|
||||
import random
|
||||
from random import SystemRandom
|
||||
import time
|
||||
|
||||
import six
|
||||
|
@ -2425,7 +2426,8 @@ class Service(service.RPCService, service.Service):
|
|||
# Zone Transfers
|
||||
def _transfer_key_generator(self, size=8):
|
||||
chars = string.ascii_uppercase + string.digits
|
||||
return ''.join(random.choice(chars) for _ in range(size))
|
||||
sysrand = SystemRandom()
|
||||
return ''.join(sysrand.choice(chars) for _ in range(size))
|
||||
|
||||
@notification('dns.zone_transfer_request.create')
|
||||
@transaction
|
||||
|
|
Loading…
Reference in New Issue