Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DefaultExpiration ¶ added in v0.1.8
func DefaultExpiration() string
DefaultExpiration returns the default certificate expiration duration
func DefaultExtensions ¶ added in v0.1.8
DefaultExtensions returns the default SSH certificate extensions
func NewHandler ¶
NewHandler creates an HTTP handler for the policy server. The handler supports:
GET / — returns discovery data (auth config for the OIDC bootstrap) POST / — evaluates a cert request (token + connection)
Every request must carry a valid CA-minted request token (pkg/serviceauth); CAPublicKey is therefore required.
Types ¶
type Config ¶
type Config struct {
// CAPublicKey is the CA's SSH public key, used to verify the request-bound
// JWT (pkg/serviceauth) on every request. Required.
CAPublicKey sshcert.RawPublicKey
// Validator validates tokens and extracts identity (authentication).
Validator *oidc.Validator
// Evaluator makes authorization decisions based on identity.
Evaluator PolicyEvaluator
// Discovery is the configuration returned on GET / requests.
// The CA fetches this to serve discovery data to clients.
Discovery *wire.Discovery
}
Config configures the policy server HTTP handler.
type OIDCConfig ¶ added in v0.1.8
type OIDCConfig struct {
Issuer string `yaml:"issuer" json:"issuer"`
ClientID string `yaml:"client_id" json:"client_id"`
ClientSecret string `yaml:"client_secret,omitempty" json:"client_secret,omitempty"` // Optional, for confidential clients
}
OIDCConfig represents OIDC configuration for token validation
type PolicyEvaluator ¶
type PolicyEvaluator interface {
// Evaluate makes an authorization decision for the given identity and connection.
// The identity has already been extracted from a validated token.
// tokenExpiry is the auth token's expiry, used to clamp the issued
// certificate's validity so it can never outlive the auth session that
// requested it.
// Returns:
// - *wire.PolicyResponse: Certificate parameters and policy if authorized
// - error: If authorization denied
//
// Error handling:
// - Return policyserver.Forbidden (403) if access denied by policy
// - Return other errors (500) for internal errors
Evaluate(ctx context.Context, identity string, tokenExpiry time.Time, conn policy.Connection) (*wire.PolicyResponse, error)
}
PolicyEvaluator makes authorization decisions based on identity and connection details. The token has already been validated and identity extracted by the handler. Implementations must: - Make authorization decision (allow/deny) based on identity - Return certificate parameters (principals, expiration, extensions) for the matching host pattern - Return appropriate errors for different failure modes
type ServerConfig ¶ added in v0.8.0
type ServerConfig struct {
CAPublicKey string `yaml:"ca_pubkey" json:"ca_pubkey"`
OIDC OIDCConfig `yaml:"oidc" json:"oidc"`
}
ServerConfig contains static server configuration loaded at startup. These settings cannot be changed without restarting the server. The policy rules themselves live in a writ policy file plus inventory (see pkg/policyserver/writpolicy), not here.
func (*ServerConfig) BootstrapAuth ¶ added in v0.8.0
func (c *ServerConfig) BootstrapAuth() wire.AuthConfig
BootstrapAuth returns the auth configuration for the bootstrap endpoint.
func (*ServerConfig) Validate ¶ added in v0.8.0
func (c *ServerConfig) Validate() error
Validate checks that the ServerConfig is valid.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package inventory resolves the entities a writ policy matches against: users (SCIM-shaped, RFC 7643) and hosts (name + labels + optional account list).
|
Package inventory resolves the entities a writ policy matches against: users (SCIM-shaped, RFC 7643) and hosts (name + labels + optional account list). |
|
Package writpolicy implements the policy server's PolicyEvaluator over a compiled writ policy, an inventory, and registries of requirement handlers, flag sources, and notify targets.
|
Package writpolicy implements the policy server's PolicyEvaluator over a compiled writ policy, an inventory, and registries of requirement handlers, flag sources, and notify targets. |