mirror of
https://github.com/gravitational/teleport.git
synced 2026-10-25 10:40:02 +08:00
* feat: support SSH node resource constraints in access requests - Allow KindNode with constraints in ValidateAccessRequest, add SSH constraint matching via buildStringConstraintTransform - Surface per-login granted/requestable metadata in MakeServer and advertise ResourceConstraintsV1 for all SSH servers * test: add tests for SSH node resource constraints - Unit tests for WithConstraints, MatcherFromConstraints, and ValidateAccessRequest with SSH constraint kinds - MakeServer tests for granted-vs-requestable login details * fix: Filter sshLogins via client.CalculateSSHLogins when IncludeRequestable!=true * refactor: apply suggestions from code review * refactor: extract granted/requestable principal calcs to web util file * refactor: use `[]ComponentFeatureID` vs `[]int` for `Server.SupportedFeatureIDs` * fix: Role pruning at request creation for constrained resources * refactor: Add Config struct for MakeServer - Use Config struct vs passing in individual params - Address misc other code review feedback
49 lines
1.7 KiB
Go
49 lines
1.7 KiB
Go
/*
|
|
* Teleport
|
|
* Copyright (C) 2025 Gravitational, Inc.
|
|
*
|
|
* This program is free software: you can redistribute it and/or modify
|
|
* it under the terms of the GNU Affero General Public License as published by
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
* (at your option) any later version.
|
|
*
|
|
* This program is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
* GNU Affero General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU Affero General Public License
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
*/
|
|
|
|
package componentfeatures
|
|
|
|
import (
|
|
componentfeaturesv1 "github.com/gravitational/teleport/api/gen/proto/go/teleport/componentfeatures/v1"
|
|
"github.com/gravitational/teleport/api/types"
|
|
)
|
|
|
|
// ForAuthServer returns features that an Auth server can support/participate in.
|
|
func ForAuthServer() *componentfeaturesv1.ComponentFeatures {
|
|
return New(FeatureResourceConstraintsV1)
|
|
}
|
|
|
|
// ForSSHServer returns features that an SSH server can support/participate in.
|
|
func ForSSHServer() *componentfeaturesv1.ComponentFeatures {
|
|
return New(FeatureResourceConstraintsV1)
|
|
}
|
|
|
|
type appServerInfoGetter interface {
|
|
GetApp() types.Application
|
|
}
|
|
|
|
// ForAppServer returns features that an App server can support/participate in.
|
|
func ForAppServer(g appServerInfoGetter) *componentfeaturesv1.ComponentFeatures {
|
|
// Resource Constraints are only supported for AWS Console apps.
|
|
if app := g.GetApp(); !app.IsAWSConsole() {
|
|
return New()
|
|
}
|
|
|
|
return New(FeatureResourceConstraintsV1)
|
|
}
|