intelmq icon indicating copy to clipboard operation
intelmq copied to clipboard

Traceback when calling intelmqdump without write access to the log file

Open sebix opened this issue 1 year ago • 0 comments

As any user not intelmq or root (or write access to /var/log/intelmq/intelmqdump.log), call intelmqdump:

$ intelmqdump 
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/intelmq/bin/intelmqdump.py", line 197, in main
    logger = utils.log('intelmqdump',
  File "/usr/lib/python3/dist-packages/intelmq/lib/utils.py", line 392, in log
    handler = RotatingFileHandler(f"{log_path}/{name}.log",
  File "/usr/lib/python3.10/logging/handlers.py", line 155, in __init__
    BaseRotatingHandler.__init__(self, filename, mode, encoding=encoding,
  File "/usr/lib/python3.10/logging/handlers.py", line 58, in __init__
    logging.FileHandler.__init__(self, filename, mode=mode,
  File "/usr/lib/python3.10/logging/__init__.py", line 1169, in __init__
    StreamHandler.__init__(self, self._open())
  File "/usr/lib/python3.10/logging/__init__.py", line 1201, in _open
    return open_func(self.baseFilename, self.mode,
PermissionError: [Errno 13] Permission denied: '/var/log/intelmq/intelmqdump.log'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/bin/intelmqdump", line 33, in <module>
    sys.exit(load_entry_point('intelmq==3.3.1', 'console_scripts', 'intelmqdump')())
  File "/usr/lib/python3/dist-packages/intelmq/bin/intelmqdump.py", line 203, in main
    logger = utils.log('intelmqdump', log_level=log_level, log_path=False)
UnboundLocalError: local variable 'log_level' referenced before assignment
  1. intelmqdump should try to become user intelmq and stop if it fails as does intelmqctl.
  2. There should not be a second exception if write permissions are missing

sebix avatar Sep 16 '24 20:09 sebix