Arvedui / radicale-dovecot-auth

Radicale plugin for dovecot authentication
GNU General Public License v3.0
18 stars 10 forks source link

Error out the socket path #16

Open Torxed opened 1 year ago

Torxed commented 1 year ago

Previous message was a bit ambiguous:

[1793065/Thread-3 (process_request_thread)] [ERROR] An exception occurred during PROPFIND request on '/': [Errno 13] Permission denied

Even with level = debug it wouldn't show the path specifically which might come in handy (mainly to see that it's actually using the configured path) This will output more details explaining why and where:

[1793065/Thread-3 (process_request_thread)] [ERROR] Could not connect to /var/spool/postfix/private/radicaleauth: [Errno 13] Permission denied
Traceback (most recent call last):
  File "/usr/lib/python3.10/site-packages/radicale_dovecot_auth/dovecot_auth.py", line 72, in __init__
    self.socket.connect(self.socket_path)
PermissionError: [Errno 13] Permission denied

As well as improve the creation of sockets:

[1793065/Thread-3 (process_request_thread)] [ERROR] Not enough permissions to create unix socket: [Errno 97] Address family not supported by protocol
Traceback (most recent call last):
  File "/usr/lib/python3.10/site-packages/radicale_dovecot_auth/dovecot_auth.py", line 71, in __init__
    self.socket = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
  File "/usr/lib/python3.10/socket.py", line 232, in __init__
    _socket.socket.__init__(self, family, type, proto, fileno)
OSError: [Errno 97] Address family not supported by protocol

The second error usually happens due to the hardening guide of radicale itself, where the .service file prohibits creation of UNIX sockets by default:

RestrictAddressFamilies=~AF_PACKET AF_NETLINK AF_UNIX

And if you forget to do the necessary change this error was a bit vague, this will give a friendly nudge of where to look and add:

RestrictAddressFamilies=
RestrictAddressFamilies=~AF_PACKET AF_NETLINK