brian7704 / OpenTAKServer

Yet another open source TAK Server for ATAK, iTAK, and WinTAK
GNU General Public License v3.0
81 stars 13 forks source link

'bcrypt' has no attribute '__about__' in docker #15

Open nerdalertdk opened 7 months ago

nerdalertdk commented 7 months ago

When booting/starting ots in docker for the first time I get this error. When booting again it works fine.

I don't have an config.yml first time I boot. ots is creating the default for me

ots-server  | Mumble auth not supported on this platform
ots-server  | (trapped) error reading bcrypt version
ots-server  | Traceback (most recent call last):
ots-server  |   File "/app/.opentakserver_venv/lib/python3.12/site-packages/passlib/handlers/bcrypt.py", line 620, in _load_backend_mixin
ots-server  |     version = _bcrypt.__about__.__version__
ots-server  |               ^^^^^^^^^^^^^^^^^
ots-server  | AttributeError: module 'bcrypt' has no attribute '__about__'
nerdalertdk commented 7 months ago

managed to figure out how to get all the logs :D

ots  | [2024-04-20 10:55:09] - OpenTAKServer[1] - app - INFO - Creating administrator account. The password is 'password'
ots  | (trapped) error reading bcrypt version
ots  | Traceback (most recent call last):
ots  |   File "/app/.opentakserver_venv/lib/python3.12/site-packages/passlib/handlers/bcrypt.py", line 620, in _load_backend_mixin
ots  |     version = _bcrypt.__about__.__version__
ots  |               ^^^^^^^^^^^^^^^^^
ots  | AttributeError: module 'bcrypt' has no attribute '__about__'
nerdalertdk commented 7 months ago

Looks like bcrypt 4.1.1 might have a bug

https://github.com/langflow-ai/langflow/issues/1173

nerdalertdk commented 7 months ago

https://pypi.org/project/bcrypt/4.1.0/

nerdalertdk commented 7 months ago

fixed it by adding

RUN pip3 uninstall -y bcrypt && pip3 install bcrypt==4.0.1

in my Dockerfile

brian7704 commented 7 months ago

Thanks for reporting this, I noticed that message too. It seemed to be just a warning and everything still worked so I didn't do anything about it. I'll do some test after downgrading bcrypt to see if there are any side effects or if everything still works.

nerdalertdk commented 7 months ago

Still see this on login also

opentakserver  | (trapped) error reading bcrypt version
opentakserver  | Traceback (most recent call last):
opentakserver  |   File "/app/.opentakserver_venv/lib/python3.12/site-packages/passlib/handlers/bcrypt.py", line 620, in _load_backend_mixin
opentakserver  |     version = _bcrypt.__about__.__version__
opentakserver  |               ^^^^^^^^^^^^^^^^^
opentakserver  | AttributeError: module 'bcrypt' has no attribute '__about__'
ots@opentakserver:~/ots$ pip list | grep bcrypt
bcrypt                    4.1.2

ots@opentakserver:~/ots$ python --version
Python 3.12.3
nerdalertdk commented 5 months ago

Still seeing this error in 1.2.0

opentakserver  | (trapped) error reading bcrypt version
opentakserver  | Traceback (most recent call last):
opentakserver  |   File "/app/.opentakserver_venv/lib/python3.12/site-packages/passlib/handlers/bcrypt.py", line 620, in _load_backend_mixin
opentakserver  |     version = _bcrypt.__about__.__version__
opentakserver  |               ^^^^^^^^^^^^^^^^^
opentakserver  | AttributeError: module 'bcrypt' has no attribute '__about__'
ots@opentakserver:~/ots$ pip list | grep bcrypt
bcrypt                    4.1.3
ots@opentakserver:~/ots$ python --version
Python 3.12.4
mikop63 commented 3 months ago

Still seeing this error

(venv) ➜  auth python --version
Python 3.10.14

(venv) ➜  auth pip list | grep bcrypt
bcrypt             4.2.0

(venv) ➜  auth python main.py        
(trapped) error reading bcrypt version
Traceback (most recent call last):
  File "./venv/lib/python3.10/site-packages/passlib/handlers/bcrypt.py", line 620, in _load_backend_mixin
    version = _bcrypt.__about__.__version__
AttributeError: module 'bcrypt' has no attribute '__about__'
$2b$12$1Tw0syEdNooWZgiv1585duwnL9SEK3EgZFpDVF4rLFY6YyOiUH1LS
True

My code from https://fastapitutorial.com/blog/password-hashing-fastapi/:

from passlib.context import CryptContext

pwd_context = CryptContext(schemes=["bcrypt"], deprecated="auto")

class Hasher():
    @staticmethod
    def verify_password(plain_password, hashed_password):
        return pwd_context.verify(plain_password, hashed_password)

    @staticmethod
    def get_password_hash(password):
        return pwd_context.hash(password)

h = Hasher.get_password_hash("supersecret1234")
check = Hasher.verify_password("supersecret1234", h)

print(h)
print(check)