diff --git a/HISTORY.rst b/HISTORY.rst index e36228f633..790bd4c2f4 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -31,6 +31,7 @@ Next (2018-XX-XX) - Add notification count inside a badge on the notification link. - Add the MERC specifying javascript library usage. - Documents without at least a version are not scanned for duplicates. +- Use a SHA256 hex digest of the secret key at the name of the lockfile. This makes the generation of the name repeatable while unique between installations. 2.8 (2018-02-27) ================ diff --git a/mayan/apps/lock_manager/backends/file_lock.py b/mayan/apps/lock_manager/backends/file_lock.py index 75acbcdc76..cc06c55f69 100644 --- a/mayan/apps/lock_manager/backends/file_lock.py +++ b/mayan/apps/lock_manager/backends/file_lock.py @@ -1,5 +1,6 @@ from __future__ import unicode_literals +import hashlib import logging import json import os @@ -7,6 +8,7 @@ import threading import time import uuid +from django.conf import settings from django.core.files import locks from django.utils.encoding import force_text @@ -21,7 +23,7 @@ lock = threading.Lock() logger = logging.getLogger(__name__) lock_file = os.path.join( - setting_temporary_directory.value, 'mayan_locks.tmp' + setting_temporary_directory.value, hashlib.sha256(settings.SECRET_KEY).hexdigest() ) open(lock_file, 'a').close() logger.debug('lock_file: %s', lock_file)