perara / wg-manager

A easy to use WireGuard dashboard and management tool
MIT License
599 stars 72 forks source link

Cannot login #76

Closed tromlet closed 3 years ago

tromlet commented 3 years ago

When I click the "SIGN IN" button, nothing happens. I'm positive that I'm using the correct username and password, and I've tried directly from the web interface without any kind of a reverse proxy.

EDIT: So I tried running it via uvicorn instead of gunicorn, and I get this in the logs:

INFO:     Started server process [1740]
Started server process [1740]
Started server process [1740]
INFO:     Waiting for application startup.
Waiting for application startup.
Waiting for application startup.
INFO:     Application startup complete.
Application startup complete.
Application startup complete.
INFO:     Uvicorn running on http://0.0.0.0:8000 (Press CTRL+C to quit)
Uvicorn running on http://0.0.0.0:8000 (Press CTRL+C to quit)
Uvicorn running on http://0.0.0.0:8000 (Press CTRL+C to quit)
INFO:     10.26.1.254:51705 - "GET / HTTP/1.1" 200 OK
INFO:     10.26.1.254:51705 - "GET /runtime-es2015.45b4bbe7850d7279dd29.js HTTP/1.1" 304 Not Modified
INFO:     10.26.1.254:51707 - "GET /main-es2015.f98a285fd184b9c231b2.js HTTP/1.1" 304 Not Modified
INFO:     10.26.1.254:51706 - "GET /polyfills-es2015.955abfefaaaee8e8cf75.js HTTP/1.1" 304 Not Modified
INFO:     10.26.1.254:51705 - "GET /5-es2015.cdaff20e03f58be99d20.js HTTP/1.1" 304 Not Modified
No row was found for one()
Traceback (most recent call last):
  File "./schemas.py", line 74, in from_db
    db_item = self.filter_query(sess).one()
  File "/opt/wg-manager/wg_dashboard_backend/venv/lib64/python3.6/site-packages/sqlalchemy/orm/query.py", line 3500, in one
    raise orm_exc.NoResultFound("No row was found for one()")
sqlalchemy.orm.exc.NoResultFound: No row was found for one()
No row was found for one()
Traceback (most recent call last):
  File "./schemas.py", line 74, in from_db
    db_item = self.filter_query(sess).one()
  File "/opt/wg-manager/wg_dashboard_backend/venv/lib64/python3.6/site-packages/sqlalchemy/orm/query.py", line 3500, in one
    raise orm_exc.NoResultFound("No row was found for one()")
sqlalchemy.orm.exc.NoResultFound: No row was found for one()
We did not find any records in the database that corresponds to the model. This means you are trying to fetch a unsaved schema!
We did not find any records in the database that corresponds to the model. This means you are trying to fetch a unsaved schema!
INFO:     10.26.1.254:51708 - "POST /api/v1/login HTTP/1.1" 401 Unauthorized
perara commented 3 years ago

Iirc there are two ENV variables for creating a admin user. Can you verify if there is such user in the database?

Its still on my todo list to create a Interface for managment and initial installation, but I would wish to be sure that current feature set is fairly secured before moving onwards with additional management UI

tromlet commented 3 years ago

To be fair, this is on a bare metal install and that might be the issue - where is the database located on the filesystem?

I AM familiar with the environment variables, I had set them upon initial setup and run, but changed them after the fact. I may try keeping them consistent throughout my setup process.

perara commented 3 years ago

The database file should reside in the same dir as the python files. Delete it and ensure that the envs are set before starting 😊

perara commented 3 years ago

https://github.com/perara/wg-manager/blob/22d7b9a04d9256de1fce1e9db3cd402edee3e320/wg_dashboard_backend/const.py#L5

tromlet commented 3 years ago

I figured! That's actually what I ended up doing - just making sure that I was using my actual username and password (which I accidentally copied and pasted here LIKE A NOOB - which is how I got into this error lol) from the get-go, and it's working great now. Now I'm just trying to figure out correct settings for firewalld so that connected VPN clients can get to services on my internal network. :P

To any hackers out there: I have changed my username and password, you jerks.