FreeTAKTeam / FreeTakServer

Situational Awareness Server compatible with TAK clients
Eclipse Public License 2.0
649 stars 166 forks source link

WebUI login not possible after updating to Version 1.9.9.2 #330

Closed DanielHeinze closed 2 years ago

DanielHeinze commented 2 years ago

I updated my server from 1.9.9 to 1.9.9.2 and after that iam not able to loggin to the webui. wrong credentials

Titou74 commented 2 years ago

I've got the same problem. Connection with ATAK work correctly.

Error on log: sqlite3.OperationalError: no such column: SystemUser.device_type

Complete log

[2022-05-02 11:05:06,836] ERROR in app: Exception on /AuthenticateUser [GET] Traceback (most recent call last): File "/usr/local/lib/python3.9/dist-packages/sqlalchemy/engine/base.py", line 1276, in _execute_context self.dialect.do_execute( File "/usr/local/lib/python3.9/dist-packages/sqlalchemy/engine/default.py", line 593, in do_execute cursor.execute(statement, parameters) sqlite3.OperationalError: no such column: SystemUser.device_type

The above exception was the direct cause of the following exception:

Traceback (most recent call last): File "/usr/local/lib/python3.9/dist-packages/flask/app.py", line 2447, in wsgi_app response = self.full_dispatch_request() File "/usr/local/lib/python3.9/dist-packages/flask/app.py", line 1952, in full_dispatch_request rv = self.handle_user_exception(e) File "/usr/local/lib/python3.9/dist-packages/flask_cors/extension.py", line 165, in wrapped_function return cors_after_request(app.make_response(f(*args, kwargs))) File "/usr/local/lib/python3.9/dist-packages/flask/app.py", line 1821, in handle_user_exception reraise(exc_type, exc_value, tb) File "/usr/local/lib/python3.9/dist-packages/flask/_compat.py", line 39, in reraise raise value File "/usr/local/lib/python3.9/dist-packages/flask/app.py", line 1950, in full_dispatch_request rv = self.dispatch_request() File "/usr/local/lib/python3.9/dist-packages/flask/app.py", line 1936, in dispatch_request return self.view_functions[rule.endpoint](req.view_args) File "/usr/local/lib/python3.9/dist-packages/flask_httpauth.py", line 149, in decorated user = self.authenticate(auth, password) File "/usr/local/lib/python3.9/dist-packages/flask_httpauth.py", line 348, in authenticate return self.verify_token_callback(token) File "/usr/local/lib/python3.9/dist-packages/FreeTAKServer/controllers/services/RestAPI.py", line 94, in verify_token output = dbController.query_systemUser(query=f'token = "{token}"') File "/usr/local/lib/python3.9/dist-packages/FreeTAKServer/controllers/DatabaseControllers/DatabaseController.py", line 212, in query_systemUser return self._query(controller=self.SystemUserTableController, query=query, columns=column) File "/usr/local/lib/python3.9/dist-packages/FreeTAKServer/controllers/DatabaseControllers/DatabaseController.py", line 130, in _query return controller.query(session=self.session, query=query, columns = columns) File "/usr/local/lib/python3.9/dist-packages/FreeTAKServer/controllers/DatabaseControllers/table_controllers.py", line 32, in query output = session.query( File "/usr/local/lib/python3.9/dist-packages/sqlalchemy/orm/query.py", line 3373, in all return list(self) File "/usr/local/lib/python3.9/dist-packages/sqlalchemy/orm/query.py", line 3535, in iter return self._execute_and_instances(context) File "/usr/local/lib/python3.9/dist-packages/sqlalchemy/orm/query.py", line 3560, in _execute_and_instances result = conn.execute(querycontext.statement, self._params) File "/usr/local/lib/python3.9/dist-packages/sqlalchemy/engine/base.py", line 1011, in execute return meth(self, multiparams, params) File "/usr/local/lib/python3.9/dist-packages/sqlalchemy/sql/elements.py", line 298, in _execute_on_connection return connection._execute_clauseelement(self, multiparams, params) File "/usr/local/lib/python3.9/dist-packages/sqlalchemy/engine/base.py", line 1124, in _execute_clauseelement ret = self._execute_context( File "/usr/local/lib/python3.9/dist-packages/sqlalchemy/engine/base.py", line 1316, in _execute_context self._handle_dbapi_exception( File "/usr/local/lib/python3.9/dist-packages/sqlalchemy/engine/base.py", line 1510, in _handle_dbapiexception util.raise( File "/usr/local/lib/python3.9/dist-packages/sqlalchemy/util/compat.py", line 182, in raise_ raise exception File "/usr/local/lib/python3.9/dist-packages/sqlalchemy/engine/base.py", line 1276, in _execute_context self.dialect.do_execute( File "/usr/local/lib/python3.9/dist-packages/sqlalchemy/engine/default.py", line 593, in do_execute cursor.execute(statement, parameters) sqlalchemy.exc.OperationalError: (sqlite3.OperationalError) no such column: SystemUser.device_type [SQL: SELECT "SystemUser".uid AS "SystemUser_uid", "SystemUser".name AS "SystemUser_name", "SystemUser".token AS "SystemUser_token", "SystemUser".password AS "SystemUser_password", "SystemUser"."group" AS "SystemUser_group", "SystemUser".device_type AS "SystemUser_device_type", "SystemUser".certificate_package_name AS "SystemUser_certificate_package_name" FROM "SystemUser" WHERE token = "token"] (Background on this error at: http://sqlalche.me/e/13/e3q8) {}

brothercorvo commented 2 years ago

clearly you have used the pip update option, however we have changed the DB structure to support the difference between certs. you need to delete and reinstall the system. The new API for User management help to recreate user pool automatically.

naman108 commented 2 years ago

essentially you need to delete the database at /opt/FreeTAKServer.db

DanielHeinze commented 2 years ago

essentially you need to delete the database at /opt/FreeTAKServer.db

clearly you have used the pip update option, however we have changed the DB structure to support the difference between certs. you need to delete and reinstall the system. The new API for User management help to recreate user pool automatically.

so if i delete the FTS Server and delte the DB, all users and certs are deleted too or? So whats the best way? i dont want to create all users again with all certs..

brothercorvo commented 2 years ago

The best way is to delete the DB, so yes, all your users will be deleted. the certs will be not valid anymore because they are related to the users. you can now adopt the rest API to recreate the users from a CSV, a ready to use integration for this purpose should be out this week

On Mon, May 2, 2022 at 9:04 AM DanielHeinze @.***> wrote:

essentially you need to delete the database at /opt/FreeTAKServer.db

clearly you have used the pip update option, however we have changed the DB structure to support the difference between certs. you need to delete and reinstall the system. The new API for User management help to recreate user pool automatically.

so if i delete the FTS Server and delte the DB, all users and certs are deleted too or? So whats the best way? i dont want to create all users again with all certs..

— Reply to this email directly, view it on GitHub https://github.com/FreeTAKTeam/FreeTakServer/issues/330#issuecomment-1114770456, or unsubscribe https://github.com/notifications/unsubscribe-auth/AOPIAPJFYBMOM4KB6G3QU2DVH7AFLANCNFSM5UZP2B2A . You are receiving this because you commented.Message ID: @.***>

-- Thanks Giu Platania Director Door Business Consulting Cell: +1 902 748 0992 LinkedIn https://www.linkedin.com/in/giuseppe-platania-304b8233/

DanielHeinze commented 2 years ago

Stopped FTS and WebUI, deleted the file /opt/FreeTAKServer.db and started FTS and WebUI again. After that iam able to loggin with the default credentials. but if i create a user with cert or without cert, its not visible in the webui? Do i have do uninstall the hole FTS Server with WebUI to get it running again? Or you i have to delete /opt/FTSServer-UI.db also?

Titou74 commented 2 years ago

A clean install was required for me to make 1.9.9.2 working.

Cleaned with: sudo pip uninstall FreeTAKServer sudo pip uninstall FreeTAKServer-UI sudo rm /opt/*

Then I maked a clean install.

NOTE: create a user on TFS-UI without cert don't work (user not listed on user list). Creation with cert work.

brothercorvo commented 2 years ago

@DanielHeinze what @Titou74 did is the best strategy, we will not provide detailed upgrade instructions because we have not tested and it may fail

DanielHeinze commented 2 years ago

@brothercorvo thanks, that is working for me. But user create without cert is not working llike @Titou74 said