sendria icon indicating copy to clipboard operation
sendria copied to clipboard

Unable to use htpasswd inside docker image

Open Fank opened this issue 3 months ago • 0 comments

When i add the --http-auth command i receive following error in the log when accessing the website:

2024-03-20T10:46:27.619175Z [info     ] starting Sendria               db=/home/sendria/mails.sqlite debug=disabled foreground=true pidfile=None
2024-03-20T10:46:28.064579Z [info     ] DB initialized
2024-03-20T10:46:28.069205Z [info     ] smtp server started            auth=disabled host=0.0.0.0 password_file=None port=1025 url=smtp://0.0.0.0:1025
2024-03-20T10:46:28.071628Z [info     ] notifier initialized
2024-03-20T10:46:28.072228Z [info     ] http server started            auth=enabled host=0.0.0.0 password_file=/home/sendria/auth/htpasswd port=1080 url=http://0.0.0.0:1080
2024-03-20T10:46:47.255363Z [info     ] request authentication failed  header=None uri=http://1.2.3.4:1080/api/messages/?page=1
2024-03-20T10:46:50.249405Z [exception] exception                      
Traceback (most recent call last):
  File "/home/sendria/.local/lib/python3.8/site-packages/sendria/http/middlewares.py", line 21, in error_handler
    rsp = await handler(rq)
  File "/home/sendria/.local/lib/python3.8/site-packages/sendria/http/middlewares.py", line 44, in response_from_dict
    rsp = await handler(rq)
  File "/home/sendria/.local/lib/python3.8/site-packages/aiohttp_basicauth/__init__.py", line 56, in wrapper
    if await self.authenticate(request):
  File "/home/sendria/.local/lib/python3.8/site-packages/sendria/http/middlewares.py", line 80, in authenticate
    res = await super().authenticate(rq)
  File "/home/sendria/.local/lib/python3.8/site-packages/aiohttp_basicauth/__init__.py", line 30, in authenticate
    and await self.check_credentials(auth.login, auth.password,
  File "/home/sendria/.local/lib/python3.8/site-packages/sendria/http/middlewares.py", line 91, in check_credentials
    if self._http_auth.check_password(username, password):
  File "/home/sendria/.local/lib/python3.8/site-packages/passlib/apache.py", line 861, in check_password
    ok, new_hash = self.context.verify_and_update(password, hash)
  File "/home/sendria/.local/lib/python3.8/site-packages/passlib/context.py", line 2433, in verify_and_update
    if not record.verify(secret, hash, **clean_kwds):
  File "/home/sendria/.local/lib/python3.8/site-packages/passlib/utils/handlers.py", line 792, in verify
    return consteq(self._calc_checksum(secret), chk)
  File "/home/sendria/.local/lib/python3.8/site-packages/passlib/handlers/bcrypt.py", line 591, in _calc_checksum
    self._stub_requires_backend()
  File "/home/sendria/.local/lib/python3.8/site-packages/passlib/utils/handlers.py", line 2254, in _stub_requires_backend
    cls.set_backend()
  File "/home/sendria/.local/lib/python3.8/site-packages/passlib/utils/handlers.py", line 2156, in set_backend
    return owner.set_backend(name, dryrun=dryrun)
  File "/home/sendria/.local/lib/python3.8/site-packages/passlib/utils/handlers.py", line 2176, in set_backend
    raise default_error
passlib.exc.MissingBackendError: bcrypt: no backends available -- recommend you install one (e.g. 'pip install bcrypt')

Fank avatar Mar 20 '24 10:03 Fank