/usr/lib/python3/dist-packages/celery/security/utils.py is in python3-celery 3.1.20-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 | # -*- coding: utf-8 -*-
"""
celery.security.utils
~~~~~~~~~~~~~~~~~~~~~
Utilities used by the message signing serializer.
"""
from __future__ import absolute_import
import sys
from contextlib import contextmanager
from celery.exceptions import SecurityError
from celery.five import reraise
try:
from OpenSSL import crypto
except ImportError: # pragma: no cover
crypto = None # noqa
__all__ = ['reraise_errors']
@contextmanager
def reraise_errors(msg='{0!r}', errors=None):
assert crypto is not None
errors = (crypto.Error, ) if errors is None else errors
try:
yield
except errors as exc:
reraise(SecurityError,
SecurityError(msg.format(exc)),
sys.exc_info()[2])
|