Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions lib/defaults/defaults.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,13 @@ const (
// RDPListenPort is the standard port for RDP servers.
RDPListenPort = 3389

// CloudProxyListenPort is the Proxy Service port when running in Teleport Cloud.
CloudProxyListenPort = 443

// CloudDomainSuffix can be used to identify when an address is a Teleport Cloud domain
// and provide helpful Cloud-specific instructions.
CloudDomainSuffix = "teleport.sh"

// BackendDir is a default backend subdirectory
BackendDir = "backend"

Expand Down
19 changes: 19 additions & 0 deletions lib/service/servicecfg/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ package servicecfg

import (
"context"
"fmt"
"io"
"log/slog"
"net"
Expand Down Expand Up @@ -809,6 +810,21 @@ func applyDefaults(cfg *Config) {
}
}

func warnIfUsingCloudOnWrongPort(log *slog.Logger, addr utils.NetAddr, defaultPort int) {
ctx := context.Background()
isCloud := strings.HasSuffix(addr.Host(), "."+defaults.CloudDomainSuffix)

if port := addr.Port(defaultPort); isCloud && port != defaults.CloudProxyListenPort {
//nolint:sloglint // We want to craft user-friendly and actionable messages here.
log.WarnContext(ctx,
fmt.Sprintf("Teleport Cloud Proxy Service runs on port 443, but the process is connecting to port %d. This is likely a misconfiguration and will prevent successfully joining the cluster.", port),
"port", port,
"address", addr.String())
//nolint:sloglint // We want to craft user-friendly and actionable messages here.
log.WarnContext(ctx, fmt.Sprintf("If you are experiencing connectivity issues, try using the following address: \"%s:%d\".", addr.Host(), defaults.CloudProxyListenPort))
}
}

func validateAuthOrProxyServices(cfg *Config) error {
haveAuthServers := len(cfg.authServers) > 0
haveProxyServer := !cfg.ProxyServer.IsEmpty()
Expand Down Expand Up @@ -837,6 +853,7 @@ func validateAuthOrProxyServices(cfg *Config) error {
if port == defaults.AuthListenPort {
cfg.Logger.WarnContext(context.Background(), "config: proxy_server is pointing to port 3025, is this the auth server address?")
}
warnIfUsingCloudOnWrongPort(cfg.Logger, cfg.ProxyServer, defaults.HTTPListenPort)
}

if haveAuthServers {
Expand All @@ -860,6 +877,8 @@ func validateAuthOrProxyServices(cfg *Config) error {
return trace.BadParameter("config: auth_servers is required")
}

warnIfUsingCloudOnWrongPort(cfg.Logger, cfg.authServers[0], defaults.AuthListenPort)

return nil
}

Expand Down
Loading