Skip to content

Commit

Permalink
change special suffix to teleport-github-org for routing
Browse files Browse the repository at this point in the history
  • Loading branch information
greedy52 committed Jan 9, 2025
1 parent 6ac577d commit bbd0f4c
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion api/types/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -1496,5 +1496,5 @@ const (
const (
// GitHubOrgServerDomain is the sub domain used in the hostname of a
// types.Server to indicate the GitHub organization of a Git server.
GitHubOrgServerDomain = "github-org"
GitHubOrgServerDomain = "teleport-github-org"
)
6 changes: 3 additions & 3 deletions api/types/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -616,9 +616,6 @@ func (s *ServerV2) gitServerCheckAndSetDefaults() error {
}

func (s *ServerV2) githubCheckAndSetDefaults() error {
// Set SSH host port for GitHub.
s.Spec.Addr = "github.com:22"

if s.Spec.GitHub == nil {
return trace.BadParameter("github must be set for Subkind %q", s.SubKind)
}
Expand All @@ -629,6 +626,9 @@ func (s *ServerV2) githubCheckAndSetDefaults() error {
return trace.Wrap(err, "invalid GitHub organization name")
}

// Set SSH host port for connection and "fake" hostname for routing. These
// values are hard-coded and cannot be customized.
s.Spec.Addr = "github.com:22"
s.Spec.Hostname = MakeGitHubOrgServerDomain(s.Spec.GitHub.Organization)
if s.Metadata.Labels == nil {
s.Metadata.Labels = make(map[string]string)
Expand Down
2 changes: 2 additions & 0 deletions lib/srv/authhandlers.go
Original file line number Diff line number Diff line change
Expand Up @@ -468,6 +468,8 @@ func (h *AuthHandlers) UserKeyAuth(conn ssh.ConnMetadata, key ssh.PublicKey) (*s
log.WarnContext(ctx, "Received unexpected cert type", "cert_type", cert.CertType)
}

// Skip RBAC check for proxy or git servers. RBAC check on git servers are
// performed outside this handler.
if h.isProxy() || h.c.Component == teleport.ComponentForwardingGit {
return permissions, nil
}
Expand Down

0 comments on commit bbd0f4c

Please sign in to comment.