Skip to content

AAP tab gives "missing parameter hostname" error if proxy public_addr is not set #4652

Open

Description

Description

What happened:

Given the following configuration file (leaving only relevant sections):

proxy_service:
  enabled: "yes"
  listen_addr: 0.0.0.0:3023
  web_listen_addr: 0.0.0.0:3080
  tunnel_listen_addr: 0.0.0.0:3024

app_service:
  enabled: "yes"
  apps:
  - name: "grafana"
    uri: http://localhost:3000
    public_addr: 127.0.0.1

Teleport starts just fine, but navigating to the Applications tab in web UI the following error is shown:

Screen Shot 2020-10-28 at 10 17 32 AM

Tracing this down in the code, it seems like the error comes from here:

https://github.com/gravitational/teleport/blob/rjones/application-access/lib/web/apps.go#L59

I.e. when attempting to parse the proxy service public addr which is not set in the above config.

What you expected to happen:

Teleport should hint at the misconfiguration and return an error upon startup with invalid config.

How to reproduce it (as minimally and precisely as possible):

  • Start Teleport with the above config.
  • Create a user and login.
  • Navigate to Applications tab.

Environment

  • Teleport version (use teleport version): 5.0.0-dev
  • Tsh version (use tsh version): 5.0.0-dev
  • OS (e.g. from /etc/os-release): macOS

Relevant Debug Logs If Applicable

goroutine 1155 [running]:
runtime/debug.Stack(0x0, 0x0, 0x0)
	/usr/local/Cellar/go/1.14.7/libexec/src/runtime/debug/stack.go:24 +0x9d
runtime/debug.PrintStack()
	/usr/local/Cellar/go/1.14.7/libexec/src/runtime/debug/stack.go:16 +0x22
github.com/gravitational/teleport/lib/utils.Host(0x0, 0x0, 0xc000f91200, 0x63d3c80, 0x7, 0x0)
	/Users/r0mant/code/go/src/github.com/gravitational/teleport/lib/utils/utils.go:282 +0x26
github.com/gravitational/teleport/lib/web.(*Handler).siteAppsGet(0xc000042400, 0x69680e0, 0xc0009e3260, 0xc00013db00, 0xc000671300, 0x1, 0x4, 0xc0000c5490, 0x699ec60, 0xc0003340e0, ...)
	/Users/r0mant/code/go/src/github.com/gravitational/teleport/lib/web/apps.go:59 +0x182
github.com/gravitational/teleport/lib/web.(*Handler).WithClusterAuth.func1(0x69680e0, 0xc0009e3260, 0xc00013db00, 0xc000671300, 0x1, 0x4, 0x9, 0x1, 0x4, 0xc000cc6e51)
	/Users/r0mant/code/go/src/github.com/gravitational/teleport/lib/web/apiserver.go:2138 +0x393
github.com/gravitational/teleport/lib/httplib.MakeHandler.func1(0x69680e0, 0xc0009e3260, 0xc00013db00, 0xc000671300, 0x1, 0x4)
	/Users/r0mant/code/go/src/github.com/gravitational/teleport/lib/httplib/httplib.go:50 +0x9a
github.com/julienschmidt/httprouter.(*Router).ServeHTTP(0xc000042408, 0x69680e0, 0xc0009e3260, 0xc00013db00)
	/Users/r0mant/code/go/src/github.com/gravitational/teleport/vendor/github.com/julienschmidt/httprouter/router.go:334 +0xb45
net/http.StripPrefix.func1(0x69680e0, 0xc0009e3260, 0xc000371900)
	/usr/local/Cellar/go/1.14.7/libexec/src/net/http/server.go:2080 +0x18a
net/http.HandlerFunc.ServeHTTP(0xc000f79f50, 0x69680e0, 0xc0009e3260, 0xc000371900)
	/usr/local/Cellar/go/1.14.7/libexec/src/net/http/server.go:2041 +0x44
github.com/gravitational/teleport/lib/web.NewHandler.func1(0x69680e0, 0xc0009e3260, 0xc000371900)
	/Users/r0mant/code/go/src/github.com/gravitational/teleport/lib/web/apiserver.go:316 +0x6e1
net/http.HandlerFunc.ServeHTTP(0xc000f92ae0, 0x69680e0, 0xc0009e3260, 0xc000371900)
	/usr/local/Cellar/go/1.14.7/libexec/src/net/http/server.go:2041 +0x44
github.com/julienschmidt/httprouter.(*Router).ServeHTTP(0xc000042408, 0x69680e0, 0xc0009e3260, 0xc000371900)
	/Users/r0mant/code/go/src/github.com/gravitational/teleport/vendor/github.com/julienschmidt/httprouter/router.go:395 +0x1aa
github.com/gravitational/teleport/lib/httplib.RewritePaths.func1(0x69680e0, 0xc0009e3260, 0xc000371900)
	/Users/r0mant/code/go/src/github.com/gravitational/teleport/lib/httplib/httplib.go:156 +0x10c
net/http.HandlerFunc.ServeHTTP(0xc000f92e10, 0x69680e0, 0xc0009e3260, 0xc000371900)
	/usr/local/Cellar/go/1.14.7/libexec/src/net/http/server.go:2041 +0x44
github.com/gravitational/teleport/lib/web.(*RewritingHandler).ServeHTTP(0xc000f92e40, 0x69680e0, 0xc0009e3260, 0xc000371900)
	/Users/r0mant/code/go/src/github.com/gravitational/teleport/lib/web/apiserver.go:158 +0xfd
github.com/gravitational/oxy/ratelimit.(*TokenLimiter).ServeHTTP(0xc000842300, 0x69680e0, 0xc0009e3260, 0xc000371900)
	/Users/r0mant/code/go/src/github.com/gravitational/teleport/vendor/github.com/gravitational/oxy/ratelimit/tokenlimiter.go:118 +0x26c
github.com/gravitational/oxy/connlimit.(*ConnLimiter).ServeHTTP(0xc000542e40, 0x69680e0, 0xc0009e3260, 0xc000371900)
	/Users/r0mant/code/go/src/github.com/gravitational/teleport/vendor/github.com/gravitational/oxy/connlimit/connlimit.go:75 +0x3fc
net/http.serverHandler.ServeHTTP(0xc0001f6380, 0x69680e0, 0xc0009e3260, 0xc000371900)
	/usr/local/Cellar/go/1.14.7/libexec/src/net/http/server.go:2836 +0xa3
net/http.(*conn).serve(0xc000d605a0, 0x6976960, 0xc000ac4780)
	/usr/local/Cellar/go/1.14.7/libexec/src/net/http/server.go:1924 +0x86c
created by net/http.(*Server).Serve
	/usr/local/Cellar/go/1.14.7/libexec/src/net/http/server.go:2962 +0x35c
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions