zephyr_mirror: Fix insecure temporary file for log.
This is probably a lot more annoying to use, in that e.g. there are separate log files for the two directions of the mirror, but we haven't used these logs for much, so whatever. (imported from commit d3bc407d90099214d242526c01cd3d3cd9d9d9bd)
This commit is contained in:
parent
e609692e33
commit
a22f94633b
|
@ -35,6 +35,7 @@ import signal
|
||||||
import logging
|
import logging
|
||||||
import hashlib
|
import hashlib
|
||||||
import unicodedata
|
import unicodedata
|
||||||
|
import tempfile
|
||||||
|
|
||||||
DEFAULT_SITE = "https://humbughq.com"
|
DEFAULT_SITE = "https://humbughq.com"
|
||||||
|
|
||||||
|
@ -711,7 +712,12 @@ def configure_logger(direction_name):
|
||||||
else:
|
else:
|
||||||
log_file = "/home/humbug/mirror-log"
|
log_file = "/home/humbug/mirror-log"
|
||||||
else:
|
else:
|
||||||
log_file = "/tmp/humbug-log." + options.user
|
f = tempfile.NamedTemporaryFile(prefix="humbug-log.%s." % (options.user,),
|
||||||
|
delete=False)
|
||||||
|
log_file = f.name
|
||||||
|
# Close the file descriptor, since the logging system will
|
||||||
|
# reopen it anyway.
|
||||||
|
f.close()
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
log_format = "%(asctime)s " + direction_name + ": %(message)s"
|
log_format = "%(asctime)s " + direction_name + ": %(message)s"
|
||||||
formatter = logging.Formatter(log_format)
|
formatter = logging.Formatter(log_format)
|
||||||
|
|
Loading…
Reference in a new issue