Open MenschLink opened 2 years ago
Hi, @MenschLink and thanks for the report! Indeed... it seems the SHA-512-256 hash is only available on higher Python 3 releases. I get the same error when I use Python 3.6, however it works on 3.8:
~ 16:46:35$ python3.6 -c 'import hashlib; o = hashlib.new("sha512_256"); print(o)'
Traceback (most recent call last):
File "/usr/local/lib/python3.6/hashlib.py", line 150, in __hash_new
return _hashlib.new(name, data)
ValueError: unsupported hash type
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/usr/local/lib/python3.6/hashlib.py", line 156, in __hash_new
return __get_builtin_constructor(name)(data)
File "/usr/local/lib/python3.6/hashlib.py", line 113, in __get_builtin_constructor
raise ValueError('unsupported hash type ' + name)
ValueError: unsupported hash type sha512_256
~ 16:46:36$
~ 16:46:36$
~ 16:46:58$ python3.8 -c 'import hashlib; o = hashlib.new("sha512_256"); print(o)'
<sha512_256 HASH object @ 0x7f3899398f90>
I will add some handling for this exception, maybe print out an error & keep the sha_512t256
column empty, so the user at least knows to upgrade to a more modern Python environment, if they need that hash. Thanks!
@liviuchircu thanks, I actually solved it in python 3.7, by replacing sha512_256 with sha512-256. I sort of also figured out how to fix the subscriber SQL error, but it doesn't feel quite right because I also get a 500 error when I try to register with the newly added user... maybe I'm not deploying the sqlite database setup correctly? Is there an example how that should work with the config?
[default]
#database_modules: acc clusterer dialog dialplan dispatcher domain rtpproxy usr>
database_modules: ALL
#database_admin_url: postgres://root@localhost
database_admin_url: sqlite:////opt/opensips.sqlite
database_url: sqlite:////opt/opensips.sqlite
this is what my /etc/opensips-cli.cfg currently looks like
errors creating user with sqlite
after initializing my sqlite-db, I want to start creating users. These two errors occurr when I attempt to execute opensips-cli -x user add
and after supplying passwords: