You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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
ERROR: cannot execute query: SELECT table_version FROM version WHERE table_name = 'subscriber'
ERROR: (sqlite3.OperationalError) no such table: version [SQL: "SELECT table_version FROM version WHERE table_name = 'subscriber'"]
ERROR: cannot execute query: SELECT count(*) FROM subscriber WHERE username = 'example' AND domain = 'example.tldf'
ERROR: (sqlite3.OperationalError) no such table: subscriber [SQL: "SELECT count(*) FROM subscriber WHERE username = 'examplel' AND domain = 'example.tld'"]
and after supplying passwords:
ValueError: unsupported hash type
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/bin/opensips-cli", line 9, in <module>
run_console()
File "/usr/bin/opensips-cli", line 6, in run_console
main.main()
File "/usr/lib/python3/dist-packages/opensipscli/main.py", line 78, in main
sys.exit(shell.cmdloop())
File "/usr/lib/python3/dist-packages/opensipscli/cli.py", line 242, in cmdloop
ret = self.run_command(module, command, modifiers, params)
File "/usr/lib/python3/dist-packages/opensipscli/cli.py", line 404, in run_command
return mod[0].__invoke__(cmd, params, modifiers)
File "/usr/lib/python3/dist-packages/opensipscli/module.py", line 36, in __invoke__
return f(params, modifiers)
File "/usr/lib/python3/dist-packages/opensipscli/modules/user.py", line 168, in do_add
self.user_get_ha1_sha512t256(username, domain, password)
File "/usr/lib/python3/dist-packages/opensipscli/modules/user.py", line 119, in user_get_ha1_sha512t256
o = hashlib.new("sha512_256")
File "/usr/lib/python3.6/hashlib.py", line 156, in __hash_new
return __get_builtin_constructor(name)(data)
File "/usr/lib/python3.6/hashlib.py", line 113, in __get_builtin_constructor
raise ValueError('unsupported hash type ' + name)
ValueError: unsupported hash type sha512_256
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?
Activity
liviuchircu commentedon Jul 20, 2022
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:
I will add some handling for this exception, maybe print out an error & keep the
sha_512t256column empty, so the user at least knows to upgrade to a more modern Python environment, if they need that hash. Thanks!MenschLink commentedon Jul 20, 2022
@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?
this is what my /etc/opensips-cli.cfg currently looks like