gregtwallace / certwarden

Cert Warden is a centralized ACME Client. It provides an API for certificate consumers to fetch their individual keys and certs with API keys.
https://www.certwarden.com/
Other
209 stars 7 forks source link

[0.21.4][Docker] Error 404 while logging in #55

Closed DunklerPhoenix closed 3 months ago

DunklerPhoenix commented 3 months ago

Heho I tried to set up certwarden, but can't login with the standard login data. It seems like the frontend has problems to find the api path.

image

Image: ghcr.io/gregtwallace/certwarden:latest Version: v0.21.4

URL I enter into the browser: http://192.168.100.53:4050/ URL I get redirected to: http://192.168.100.53:4050/certwarden/app/

Console Log from Brave-Browser:

Failed to load resource: the server responded with a status of 404 (Not Found)
http://192.168.100.53:4050/certwarden/app/__API_URL__/v1/app/auth/login

index-Cpv77TVQ.js:189 POST : /v1/app/auth/login reply: Objectcode: "ERR_BAD_REQUEST"config: {transitional: {…}, adapter: Array(2), transformRequest: Array(1), transformResponse: Array(1), timeout: 0, …}message: "Request failed with status code 404"name: "AxiosError"stack: "AxiosError: Request failed with status code 404\n    at qF (http://192.168.100.53:4050/certwarden/app/assets/index-Cpv77TVQ.js:186:1034)\n    at XMLHttpRequest.y (http://192.168.100.53:4050/certwarden/app/assets/index-Cpv77TVQ.js:186:4226)"status: 404[[Prototype]]: Object
toolbar

Container Log:

[+] Running 1/0
 ✔ Container compose_certwarden-certwarden-1  Created                                                                                                                    0.0s 
Attaching to certwarden-1
certwarden-1  | 2024-06-21T17:17:00.836+0200    info    app/logger.go:138       init logging started (log level: debug)
certwarden-1  | 2024-06-21T17:17:00.836+0200    info    app/app_create.go:39    starting Cert Warden v0.21.4
certwarden-1  | 2024-06-21T17:17:00.836+0200    debug   app/configure.go:184    config schema version is current (3)
certwarden-1  | 2024-06-21T17:17:00.838+0200    info    app/logger.go:140       main logging started (log level: info)
certwarden-1  | 2024-06-21T17:17:00.839+0200    info    backup/automatic_backup.go:102  starting automatic data backup service
certwarden-1  | 2024-06-21T17:17:00.839+0200    info    backup/automatic_backup.go:153  starting data backup time based deletion service
certwarden-1  | 2024-06-21T17:17:00.841+0200    info    acme/directory.go:104   starting acme directory refresh service (https://acme-staging-v02.api.letsencrypt.org/directory)
certwarden-1  | 2024-06-21T17:17:00.841+0200    info    acme/directory.go:104   starting acme directory refresh service (https://acme-v02.api.letsencrypt.org/directory)
certwarden-1  | 2024-06-21T17:17:00.841+0200    info    acme/directory.go:78    updating directory from https://acme-staging-v02.api.letsencrypt.org/directory
certwarden-1  | 2024-06-21T17:17:00.842+0200    info    http01internal/server.go:43     attempting to start http-01 challenge server on :4060.
certwarden-1  | 2024-06-21T17:17:00.842+0200    warn    http01internal/server.go:45     http-01 challenge server is not configured on port 80; internet facing port 80 must be proxied to port 4060 to function.
certwarden-1  | 2024-06-21T17:17:00.841+0200    info    acme/directory.go:78    updating directory from https://acme-v02.api.letsencrypt.org/directory
certwarden-1  | 2024-06-21T17:17:00.920+0200    error   app/app_create.go:178   failed to configure https cert: no such record found in storage
certwarden-1  | 2024-06-21T17:17:00.920+0200    info    updater/checker.go:107  starting updater service
certwarden-1  | 2024-06-21T17:17:00.920+0200    info    auth/session_manager.go:117     starting auth session cleaner service
certwarden-1  | 2024-06-21T17:17:00.920+0200    info    orders/auto_ordering.go:26      orders: starting automatic certificate ordering service; 40 day expiration threshold; orders will be placed every day at 03:12
certwarden-1  | 2024-06-21T17:17:00.920+0200    info    app/router_make.go:161  frontend hosting enabled and available at: /certwarden/app
certwarden-1  | 2024-06-21T17:17:00.920+0200    warn    app/run.go:185  failed to configure https; will run over insecure http
certwarden-1  | 2024-06-21T17:17:00.920+0200    info    app/run.go:186  starting insecure http server bound to :4050
certwarden-1  | 2024-06-21T17:17:01.481+0200    info    acme/directory.go:93    directory https://acme-v02.api.letsencrypt.org/directory updated succesfully
certwarden-1  | 2024-06-21T17:17:01.724+0200    info    acme/directory.go:93    directory https://acme-staging-v02.api.letsencrypt.org/directory updated succesfully

Autogenerated Config File: "config_version": 3

gregtwallace commented 3 months ago

Did you modify anything? When the app starts it replaces the file /app/certwarden/frontend_build/env.js and sets the API path. The placeholder value is __API_URL__ which is showing up in your error message.

I pulled the latest image and started it without any changes and was able to login without error.

DunklerPhoenix commented 3 months ago

hmmm not that I know. I start certwarden with this docker compose file.

For testing purposes I removed the container, the image and the path /home/docker/files/certwarden and still I get this error.

docker-compose.yml

services:
  certwarden:
    image: ghcr.io/gregtwallace/certwarden:latest
    ports:
      - 4050:4050 # server interface (http)
      - 4055:4055 # server interface (https)
      - 4060:4060 # http-01 challenge server (http)
      - 4065:4065 # pprof debug server (http)
      - 4070:4070 # pprof debug server (https)
    volumes:
      - type: bind
        source: /home/docker/files/certwarden
        target: /app/data        
    labels:
      traefik.enable: "true"
      traefik.docker.network: "bouncer"
      traefik.http.routers.certwarden.entrypoints: "https"
      traefik.http.routers.certwarden.middlewares: "authelia@file"
      traefik.http.routers.certwarden.rule: "Host(`certs.manager.domain.tld`)"
      traefik.http.routers.certwarden.tls: "true"
      traefik.http.services.certwarden.loadbalancer.server.port: "4050"
    hostname: 'certwarden'
    user: "1000:1000"
    environment:
      TZ: "Europe/Paris"
      PUID: "1000"
      PGID: "1000"
    restart: always

networks:
  default:
    external: true
    name: bouncer

image

Could it be that the path ist wrong? You wrote /app/certwarden/frontend_build/env.js but the path in the filesystem is /app/frontend_build/env.js. /app/certwarden is a file

EDIT: The replacement seems to work, but it doesn't change anything on the 404 error

certwarden:/app/frontend_build# cat env.js 

        window.env = {
                API_URL: '/certwarden/api',
                SHOW_DEBUG_INFO: false
        };

EDIT2: Nevermind. It's a problem of my browser ʕ⁠ಠ⁠_⁠ಠ⁠ʔ I think one of the extensions generates this problem, because it works on my phone and on another browser.

EDIT3: I don't understand what is happening here. After the successful login on another device, its now also working on my normal browser. Confusion¹⁰⁰

Anyway. Thank you for your help and sorry for the waste of time ^^'

gregtwallace commented 3 months ago

That is... very weird to say the least. Ah, technology sometimes :)