ovh/cds

not authenticated on hello world docker-compose example

hmmftg opened this issue · 5 comments

hmmftg commented

Hi, I started using cds using docker-compose with this example:
docker-compose docs

on my server port 8080 is bond to some app so I changed docker-compose.yml line 152 to "8084:8080"

every step goes well and I successfully launch cds, when I try to login this error is displayed: not authenticated

on docker logs of cds-api:

2023-09-17 15:01:37 [INFO] not authenticated action=api.(*API).configAPIHandler caller=github.com/ovh/cds/engine/service.WriteError deprecated=false handler=api.(*API).configAPIHandler ip_address=192.168.176.11:50742 method=GET request_id=f52df3cb-6fc0-4dc0-a526-91451081b1ff request_uri=/config/api route=/config/api source_file=/tmp/790ad7b9a1a85167593986ed564384b7/run/engine/service/http.go source_line=155 stack_trace=not authenticated
github.com/ovh/cds/sdk.WithStack
        /tmp/790ad7b9a1a85167593986ed564384b7/run/sdk/error.go:630
github.com/ovh/cds/engine/api.(*API).authMiddleware
        /tmp/790ad7b9a1a85167593986ed564384b7/run/engine/api/router_middleware_auth.go:86
github.com/ovh/cds/engine/api.(*Router).handle.func1
        /tmp/790ad7b9a1a85167593986ed564384b7/run/engine/api/router.go:431
net/http.HandlerFunc.ServeHTTP
        /usr/local/go/src/net/http/server.go:2122
github.com/ovh/cds/engine/api.(*Router).recoverWrap.func1
        /tmp/790ad7b9a1a85167593986ed564384b7/run/engine/api/router.go:173
github.com/ovh/cds/engine/api.(*Router).setRequestID.func1
        /tmp/790ad7b9a1a85167593986ed564384b7/run/engine/api/router.go:121
net/http.HandlerFunc.ServeHTTP
        /usr/local/go/src/net/http/server.go:2122
github.com/gorilla/handlers.CompressHandlerLevel.func1
        /go/pkg/mod/github.com/gorilla/handlers@v1.5.1/compress.go:141
net/http.HandlerFunc.ServeHTTP
        /usr/local/go/src/net/http/server.go:2122
github.com/ovh/cds/engine/api.(*Router).compress.func1
        /tmp/790ad7b9a1a85167593986ed564384b7/run/engine/api/router.go:98
github.com/ovh/cds/engine/api.(*Router).pprofLabel.func1
        /tmp/790ad7b9a1a85167593986ed564384b7/run/engine/api/router.go:90
net/http.HandlerFunc.ServeHTTP
        /usr/local/go/src/net/http/server.go:2122
github.com/gorilla/mux.(*Router).ServeHTTP
        /go/pkg/mod/github.com/gorilla/mux@v1.8.0/mux.go:210
net/http.serverHandler.ServeHTTP
        /usr/local/go/src/net/http/server.go:2936
net/http.(*conn).serve
        /usr/local/go/src/net/http/server.go:1995
runtime.goexit
        /usr/local/go/src/runtime/asm_amd64.s:1598
2023-09-17 15:01:37 [INFO] GET | END   | /config/api [api.(*API).configAPIHandler] | [401] action=api.(*API).configAPIHandler caller=github.com/ovh/cds/engine/api.(*Router).handle.func1.1 deprecated=false handler=api.(*API).configAPIHandler ip_address=192.168.176.11:50742 latency=4.074036ms latency_num=4074036 method=GET request_id=f52df3cb-6fc0-4dc0-a526-91451081b1ff request_uri=/config/api route=/config/api source_file=/tmp/790ad7b9a1a85167593986ed564384b7/run/engine/api/router.go source_line=404 status=401 status_num=401 sudo=false

how can I login? can you help?

Same error on build from master, go 1.20.7, postgres 14

hmmftg commented

I was running cds on remote server and trying to login from my host to remote cds, when I get connected to remote server(using vns) and open the main page the login worked and I could work with workflows and ❤️ it

how can I configure cds authentication to work correctly on remote host?

Hi, I'm not sure to understand the issue, we test the docker-compose tutorial on each release (with localhost exposition). If you are not using localhost, you have to use and https connection. Without https, you can't login on the ui.

Without https, you can't login on the ui.

This is the source of the problem. Chrome browser does not write that it rejected jwt_token from non localhost http response.

You can check this tutorial with some examples about ssl configuration: https://ovh.github.io/cds/hosting/ready-to-run/docker-compose/full-example/#configure-ssl