Skip to content

[v12] Integ tests: Use address of web UI as Proxy.PublicAddrs#20471

Merged
ravicious merged 2 commits intobranch/v12from
bot/backport-20328-branch/v12
Jan 23, 2023
Merged

[v12] Integ tests: Use address of web UI as Proxy.PublicAddrs#20471
ravicious merged 2 commits intobranch/v12from
bot/backport-20328-branch/v12

Conversation

@ravicious
Copy link
Copy Markdown
Member

Backport #20328 to branch/v12

i.Web is also used as tconf.Proxy.WebAddr.Addr a couple of lines below.

When pinging the proxy, TeleportClient takes the response and updates a
couple of values based on that response. If proxySettings.SSH.PublicAddr
is not empty, it tries to parse the address and then set it as
tc.WebProxyAddr. [1]

If it cannot parse the port number, it uses the default (3080).

What is getting returned as `proxySettings.SSH.PublicAddr`? That's determined
by setProxyPublicAddressesSettings in lib/service/proxy_settings.go. [2]
It uses the first element from Proxy.PublicAddrs.

Now, the integration test helpers set up the Teleport instance in such
way that the first Proxy.PublicAddrs is set to i.Hostname which resolves
to just "localhost" in tests. So if any test pings the proxy first and then
tries to make another request with the same TeleportClient, the subsequent
request will try to reach out to localhost:3080. This happened to me when
trying to add a new test. [3]

This PR fixes this by making sure that the first element of Proxy.PublicAddrs
actually points at the address of the web UI.

See also the message from Marek about backwards compatibility of
SSHProxyHostPort. [4] [5]

[1] https://github.com/gravitational/teleport/blob/885d7397ab3746154342712bec86bcdb3ea93eab/lib/client/api.go#L3666-L3673
[2] https://github.com/gravitational/teleport/blob/806a568ada7c640a64eb60f718e7d56be34049ad/lib/service/proxy_settings.go#L112
[3] #20263
[4] https://gravitational.slack.com/archives/C0DF0TPMY/p1673895327794379?thread_ts=1673891288.249809&cid=C0DF0TPMY
[5] https://github.com/gravitational/teleport/blob/db7fdff8097bcc883af8d9dde6a271d07e418550/api/client/webclient/webclient.go#L490
@ravicious ravicious enabled auto-merge (squash) January 20, 2023 14:23
@ravicious ravicious merged commit 15dca60 into branch/v12 Jan 23, 2023
@github-actions github-actions Bot deleted the bot/backport-20328-branch/v12 branch January 23, 2023 15:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants