iFargle / headscale-webui

A simple Headscale web UI for small-scale deployments.
Other
628 stars 57 forks source link

Cannot connect to headscale #67

Closed iluvatyr closed 1 year ago

iluvatyr commented 1 year ago

I tried to set this webui up, but failed. I did everything according to instructions.

    To generate your API key, run the command headscale apikeys create on your control server. Once you generate your first key, this UI will automatically renew the key near expiration.
    The Headscale server is configured via the HS_SERVER environment variable in Docker. Current server: https://headscale.iluvatyr.com
    You must configure an encryption key via the KEY environment variable in Docker. One can be generated with the command openssl rand -base64 32

My encryption key is setup via the docker-compose.yml and within two double quotes "".

The headscale-webui is pointing to the correct headscale-instance. But when entering the API-Key I created within headscale, it gives errors and cannot connect.

[2023-03-31 17:51:56 +0200] [1] [INFO] Starting gunicorn 20.1.0
[2023-03-31 17:51:56 +0200] [1] [INFO] Listening at: http://0.0.0.0:5000 (1)
[2023-03-31 17:51:56 +0200] [1] [INFO] Using worker: sync
[2023-03-31 17:51:56 +0200] [8] [INFO] Booting worker with pid: 8
[2023-03-31 17:51:57,113] INFO in server: Headscale-WebUI Version:  v0.6.0 / main
[2023-03-31 17:51:57,114] INFO in server: LOG LEVEL SET TO DEBUG
[2023-03-31 17:51:57,114] INFO in server: DEBUG STATE:  True
[2023-03-31 17:51:57,114] INFO in server: Loading basic auth libraries and configuring app...
[2023-03-31 17:52:07,187] ERROR in helper: /data/key.txt EXIST: FAILED - NO ERROR
[2023-03-31 17:52:07,188] INFO in helper: All startup checks passed.
[2023-03-31 17:52:07,189] INFO in helper: Testing API key validity.
[2023-03-31 17:52:07,263] INFO in helper: Got a non-200 response from Headscale.  Test failed (Response:  500)
[2023-03-31 17:52:07,452] ERROR in helper: /data/key.txt EXIST: FAILED - NO ERROR
[2023-03-31 17:52:07,453] INFO in helper: All startup checks passed.
[2023-03-31 17:52:07,454] INFO in helper: Testing API key validity.
[2023-03-31 17:52:07,532] INFO in helper: Got a non-200 response from Headscale.  Test failed (Response:  500)

On my headscale instance, it gives me following log at the same time: 2023-03-31T17:53:53+02:00 ERR go/src/headscale/app.go:445 > failed to validate token error="Failed to parse ApiKey" client_address=172.30.0.3:35622

Maybe I am doing something wrong, but I cannot figure it out.

EDIT: I think the "test" button doesnt work correctly, as I just pressed save now after it tested with "error". and it worked.

iFargle commented 1 year ago

Can you paste your docker compose?

On March 31, 2023 3:59:24 PM UTC, luva @.***> wrote:

I tried to set this webui up, but failed. I did everything according to instructions.

   To generate your API key, run the command headscale apikeys create on your control server. Once you generate your first key, this UI will automatically renew the key near expiration.
   The Headscale server is configured via the HS_SERVER environment variable in Docker. Current server: https://headscale.iluvatyr.com
   You must configure an encryption key via the KEY environment variable in Docker. One can be generated with the command openssl rand -base64 32

My encryption key is setup via the docker-compose.yml and within two double quotes "".

The headscale-webui is pointing to the correct headscale-instance. But when entering the API-Key I created within headscale, it gives errors and cannot connect.

[2023-03-31 17:51:56 +0200] [1] [INFO] Starting gunicorn 20.1.0
[2023-03-31 17:51:56 +0200] [1] [INFO] Listening at: http://0.0.0.0:5000 (1)
[2023-03-31 17:51:56 +0200] [1] [INFO] Using worker: sync
[2023-03-31 17:51:56 +0200] [8] [INFO] Booting worker with pid: 8
[2023-03-31 17:51:57,113] INFO in server: Headscale-WebUI Version:  v0.6.0 / main
[2023-03-31 17:51:57,114] INFO in server: LOG LEVEL SET TO DEBUG
[2023-03-31 17:51:57,114] INFO in server: DEBUG STATE:  True
[2023-03-31 17:51:57,114] INFO in server: Loading basic auth libraries and configuring app...
[2023-03-31 17:52:07,187] ERROR in helper: /data/key.txt EXIST: FAILED - NO ERROR
[2023-03-31 17:52:07,188] INFO in helper: All startup checks passed.
[2023-03-31 17:52:07,189] INFO in helper: Testing API key validity.
[2023-03-31 17:52:07,263] INFO in helper: Got a non-200 response from Headscale.  Test failed (Response:  500)
[2023-03-31 17:52:07,452] ERROR in helper: /data/key.txt EXIST: FAILED - NO ERROR
[2023-03-31 17:52:07,453] INFO in helper: All startup checks passed.
[2023-03-31 17:52:07,454] INFO in helper: Testing API key validity.
[2023-03-31 17:52:07,532] INFO in helper: Got a non-200 response from Headscale.  Test failed (Response:  500)

On my headscale instance, it gives me following log at the same time: 2023-03-31T17:53:53+02:00 ERR go/src/headscale/app.go:445 > failed to validate token error="Failed to parse ApiKey" client_address=172.30.0.3:35622

Maybe I am doing something wrong, but I cannot figure it out.

-- Reply to this email directly or view it on GitHub: https://github.com/iFargle/headscale-webui/issues/67 You are receiving this because you are subscribed to this thread.

Message ID: @.> -- Albert J. Copeland @. PGP Fingerprint:  64F6C4EB46C4543A

iFargle commented 1 year ago

Ah nvn I see your response.

Yeah I need to work out how to better do that. You need to save first, then test :) since the test reads from the file and not from the input field

On March 31, 2023 3:59:24 PM UTC, luva @.***> wrote:

I tried to set this webui up, but failed. I did everything according to instructions.

   To generate your API key, run the command headscale apikeys create on your control server. Once you generate your first key, this UI will automatically renew the key near expiration.
   The Headscale server is configured via the HS_SERVER environment variable in Docker. Current server: https://headscale.iluvatyr.com
   You must configure an encryption key via the KEY environment variable in Docker. One can be generated with the command openssl rand -base64 32

My encryption key is setup via the docker-compose.yml and within two double quotes "".

The headscale-webui is pointing to the correct headscale-instance. But when entering the API-Key I created within headscale, it gives errors and cannot connect.

[2023-03-31 17:51:56 +0200] [1] [INFO] Starting gunicorn 20.1.0
[2023-03-31 17:51:56 +0200] [1] [INFO] Listening at: http://0.0.0.0:5000 (1)
[2023-03-31 17:51:56 +0200] [1] [INFO] Using worker: sync
[2023-03-31 17:51:56 +0200] [8] [INFO] Booting worker with pid: 8
[2023-03-31 17:51:57,113] INFO in server: Headscale-WebUI Version:  v0.6.0 / main
[2023-03-31 17:51:57,114] INFO in server: LOG LEVEL SET TO DEBUG
[2023-03-31 17:51:57,114] INFO in server: DEBUG STATE:  True
[2023-03-31 17:51:57,114] INFO in server: Loading basic auth libraries and configuring app...
[2023-03-31 17:52:07,187] ERROR in helper: /data/key.txt EXIST: FAILED - NO ERROR
[2023-03-31 17:52:07,188] INFO in helper: All startup checks passed.
[2023-03-31 17:52:07,189] INFO in helper: Testing API key validity.
[2023-03-31 17:52:07,263] INFO in helper: Got a non-200 response from Headscale.  Test failed (Response:  500)
[2023-03-31 17:52:07,452] ERROR in helper: /data/key.txt EXIST: FAILED - NO ERROR
[2023-03-31 17:52:07,453] INFO in helper: All startup checks passed.
[2023-03-31 17:52:07,454] INFO in helper: Testing API key validity.
[2023-03-31 17:52:07,532] INFO in helper: Got a non-200 response from Headscale.  Test failed (Response:  500)

On my headscale instance, it gives me following log at the same time: 2023-03-31T17:53:53+02:00 ERR go/src/headscale/app.go:445 > failed to validate token error="Failed to parse ApiKey" client_address=172.30.0.3:35622

Maybe I am doing something wrong, but I cannot figure it out.

-- Reply to this email directly or view it on GitHub: https://github.com/iFargle/headscale-webui/issues/67 You are receiving this because you are subscribed to this thread.

Message ID: @.> -- Albert J. Copeland @. PGP Fingerprint:  64F6C4EB46C4543A