Documentation
¶
Index ¶
- Constants
- func CalculateCaPems(caPems *bytes.Buffer) *bytes.Buffer
- func GetSpiffeIdFromCert(cert *x509.Certificate) (*url.URL, error)
- func GetSpiffeIdFromCertChain(certs []*x509.Certificate) (*url.URL, error)
- func GetSpiffeIdFromIdentity(id identity.Identity) (*url.URL, error)
- func GetSpiffeIdFromTlsCertChain(tlsCerts []*tls.Certificate) (*url.URL, error)
- func NormalizeHostname(host string) string
- func ValidateSpiffeId(id *identity.TokenId, spiffeId *url.URL) error
- type Api
- type CertValidatingIdentity
- type Config
- type CtrlOptions
- type EdgeConfig
- type Enrollment
- type EnrollmentOption
- type ExternalJwtSigners
- type HttpTimeouts
- type IdentityStatusConfig
- type IdentityStatusSource
- type JwksFetch
- type NetworkConfig
- type Oidc
- type RaftConfig
- type Totp
Constants ¶
const ( DefaultProfileMemoryInterval = 15 * time.Second DefaultHealthChecksBoltCheckInterval = 30 * time.Second DefaultHealthChecksBoltCheckTimeout = 20 * time.Second DefaultHealthChecksBoltCheckInitialDelay = 30 * time.Second DefaultRaftCommandHandlerMaxQueueSize = 250 // DefaultTlsHandshakeRateLimiterEnabled is whether the tls handshake rate limiter is enabled by default DefaultTlsHandshakeRateLimiterEnabled = false // TlsHandshakeRateLimiterMinSizeValue is the minimum size that can be configured for the tls handshake rate limiter // window range TlsHandshakeRateLimiterMinSizeValue = 5 // TlsHandshakeRateLimiterMaxSizeValue is the maximum size that can be configured for the tls handshake rate limiter // window range TlsHandshakeRateLimiterMaxSizeValue = 10000 // TlsHandshakeRateLimiterMetricOutstandingCount is the name of the metric tracking how many tasks are in process TlsHandshakeRateLimiterMetricOutstandingCount = "tls_handshake_limiter.in_process" // TlsHandshakeRateLimiterMetricCurrentWindowSize is the name of the metric tracking the current window size TlsHandshakeRateLimiterMetricCurrentWindowSize = "tls_handshake_limiter.window_size" // TlsHandshakeRateLimiterMetricWorkTimer is the name of the metric tracking how long successful tasks are taking to complete TlsHandshakeRateLimiterMetricWorkTimer = "tls_handshake_limiter.work_timer" // DefaultTlsHandshakeRateLimiterMaxWindow is the default max size for the tls handshake rate limiter DefaultTlsHandshakeRateLimiterMaxWindow = 1000 DefaultRouterDataModelEnabled = true DefaultRouterDataModelLogSize = 10_000 DefaultRouterDataModelListenerBufferSize = 1000 DefaultRaftSnapshotInterval = 2 * time.Minute DefaultRaftSnapshotThreshold = 500 DefaultRaftTrailingLogs = 500 RaftRateLimiterQueueSizeMetricName = "raft.rate_limiter.queue_size" RaftRateLimiterWorkTimerMetricName = "raft.rate_limiter.work_timer" RaftRateLimiterWindowSizeMetricName = "raft.rate_limiter.window_size" )
const ( DefaultEdgeApiActivityUpdateBatchSize = 250 DefaultEdgeAPIActivityUpdateInterval = 90 * time.Second MaxEdgeAPIActivityUpdateBatchSize = 10000 MinEdgeAPIActivityUpdateBatchSize = 1 MaxEdgeAPIActivityUpdateInterval = 10 * time.Minute MinEdgeAPIActivityUpdateInterval = time.Millisecond DefaultEdgeSessionTimeout = 30 * time.Minute MinEdgeSessionTimeout = 1 * time.Minute MinEdgeEnrollmentDuration = 5 * time.Minute DefaultEdgeEnrollmentDuration = 180 * time.Minute DefaultHttpIdleTimeout = 5000 * time.Millisecond DefaultHttpReadTimeout = 5000 * time.Millisecond DefaultHttpReadHeaderTimeout = 5000 * time.Millisecond DefaultHttpWriteTimeout = 100000 * time.Millisecond DefaultTotpDomain = "openziti.io" DefaultAuthRateLimiterEnabled = true DefaultAuthRateLimiterMaxSize = 250 DefaultAuthRateLimiterMinSize = 5 AuthRateLimiterMinSizeValue = 5 AuthRateLimiterMaxSizeValue = 1000 DefaultIdentityOnlineStatusScanInterval = time.Minute MinIdentityOnlineStatusScanInterval = time.Second DefaultIdentityOnlineStatusUnknownTimeout = 5 * time.Minute DefaultIdentityOnlineStatusSource = IdentityStatusSourceHybrid // DefaultJwksFetchBlockPrivateAddresses leaves private and loopback addresses reachable by // default so that deployments using an internal IdP keep working. Metadata and link-local // addresses are blocked regardless of this setting. DefaultJwksFetchBlockPrivateAddresses = false // DefaultJwksFetchTimeout bounds the total time spent fetching a JWKS endpoint. DefaultJwksFetchTimeout = 5 * time.Second // DefaultJwksFetchMaxRedirects bounds how many redirects a JWKS fetch will follow. DefaultJwksFetchMaxRedirects = 5 )
const ( DefaultOptionsCreateCircuitRetries = 2 DefaultOptionsCycleSeconds = 60 DefaultOptionsEnableLegacyLinkMgmt = false DefaultOptionsInitialLinkLatency = 65 * time.Second DefaultOptionsPendingLinkTimeout = 10 * time.Second DefaultOptionsMetricsReportInterval = time.Minute DefaultOptionsMinRouterCost = 10 DefaultOptionsRouterConnectChurnLimit = time.Minute DefaultOptionsRouterMessagingMaxWorkers = 100 DefaultOptionsRouterMessagingQueueSize = 100 DefaultOptionsRouteTimeout = 10 * time.Second DefaultOptionsSmartRerouteCap = 4 DefaultOptionsSmartRerouteFraction = 0.02 DefaultOptionsSmartRerouteMinCostDelta = 15 OptionsRouterCommMaxQueueSize = 1_000_000 OptionsRouterCommMaxWorkers = 10_000 )
Variables ¶
This section is empty.
Functions ¶
func CalculateCaPems ¶
CalculateCaPems takes the supplied caPems buffer as a set of PEM Certificates separated by new lines. Duplicate certificates are removed, and the result is returned as a bytes.Buffer of PEM Certificates separated by new lines.
func GetSpiffeIdFromCert ¶ added in v1.1.6
func GetSpiffeIdFromCert(cert *x509.Certificate) (*url.URL, error)
GetSpiffeIdFromCert will search a x509 certificate for a trust domain encoded as a spiffe:// URI SAN. Each certificate must contain 0 or 1 spiffe:// URI SAN. The first SPIFFE id looking up the chain is returned. If no SPIFFE id is encountered, nil is returned. Errors are returned for parsing and processing errors only.
func GetSpiffeIdFromCertChain ¶ added in v1.1.6
func GetSpiffeIdFromCertChain(certs []*x509.Certificate) (*url.URL, error)
GetSpiffeIdFromCertChain cycles through a slice of certificates that goes from leaf up CAs. Each certificate must contain 0 or 1 spiffe:// URI SAN. The first encountered SPIFFE id looking up the chain back to the root CA is returned. If no SPIFFE id is encountered, nil is returned. Errors are returned for parsing and processing errors only.
func GetSpiffeIdFromIdentity ¶ added in v1.1.6
GetSpiffeIdFromIdentity will search an Identity for a trust domain encoded as a spiffe:// URI SAN starting from the server cert and up its signing chain. Each certificate must contain 0 or 1 spiffe:// URI SAN. The first SPIFFE id looking up the chain back to the root CA is returned. If no SPIFFE id is encountered, nil is returned. Errors are returned for parsing and processing errors only.
func GetSpiffeIdFromTlsCertChain ¶ added in v1.1.6
func GetSpiffeIdFromTlsCertChain(tlsCerts []*tls.Certificate) (*url.URL, error)
GetSpiffeIdFromTlsCertChain will search a tls certificate chain for a trust domain encoded as a spiffe:// URI SAN. Each certificate must contain 0 or 1 spiffe:// URI SAN. The first SPIFFE id looking up the chain is returned. If no SPIFFE id is encountered, nil is returned. Errors are returned for parsing and processing errors only.
func NormalizeHostname ¶ added in v1.6.20
NormalizeHostname returns a host in the form used for comparison: lower-cased, without a trailing dot, and converted to punycode when it contains non-ASCII labels. Config entries and request hosts are both normalized this way so that they compare consistently.
Types ¶
type CertValidatingIdentity ¶ added in v1.1.6
func (*CertValidatingIdentity) ClientTLSConfig ¶ added in v1.1.6
func (self *CertValidatingIdentity) ClientTLSConfig() *tls.Config
func (*CertValidatingIdentity) ServerTLSConfig ¶ added in v1.1.6
func (self *CertValidatingIdentity) ServerTLSConfig() *tls.Config
func (*CertValidatingIdentity) VerifyConnection ¶ added in v1.1.6
func (self *CertValidatingIdentity) VerifyConnection(state tls.ConnectionState) error
type Config ¶
type Config struct {
Id *identity.TokenId
SpiffeIdTrustDomain *url.URL
AdditionalTrustDomains []*url.URL
Raft *RaftConfig
Network *NetworkConfig
Edge *EdgeConfig
Db boltz.Db
Trace struct {
Handler *channel.TraceHandler
}
Profile struct {
Memory struct {
Path string
Interval time.Duration
}
CPU struct {
Path string
}
}
Ctrl struct {
Listener transport.Address
Options *CtrlOptions
}
HealthChecks struct {
BoltCheck struct {
Interval time.Duration
Timeout time.Duration
InitialDelay time.Duration
}
}
RouterDataModel common.RouterDataModelConfig
Command struct {
RateLimiter command.RateLimiterConfig
}
TlsHandshakeRateLimiter command.AdaptiveRateLimitTrackerConfig
Src map[interface{}]interface{}
}
func LoadConfig ¶ added in v1.1.6
func (*Config) IsRaftEnabled ¶ added in v1.4.0
type CtrlOptions ¶ added in v1.1.6
type CtrlOptions struct {
*channel.Options
NewListener *transport.Address
AdvertiseAddress *transport.Address
RouterHeartbeatOptions *channel.HeartbeatOptions
PeerHeartbeatOptions *channel.HeartbeatOptions
}
CtrlOptions extends channel.Options to include support for additional, non-channel specific options (e.g. NewListener)
type EdgeConfig ¶ added in v1.1.6
type EdgeConfig struct {
Enabled bool
Api Api
Oidc Oidc
Enrollment Enrollment
IdentityStatusConfig IdentityStatusConfig
Totp Totp
AuthRateLimiter command.AdaptiveRateLimiterConfig
DisablePostureChecks bool
ExternalJwtSigners ExternalJwtSigners
// contains filtered or unexported fields
}
func LoadEdgeConfigFromMap ¶ added in v1.1.6
func LoadEdgeConfigFromMap(configMap map[interface{}]interface{}) (*EdgeConfig, error)
func NewEdgeConfig ¶ added in v1.1.6
func NewEdgeConfig() *EdgeConfig
func (*EdgeConfig) AddCaPems ¶ added in v1.1.6
func (c *EdgeConfig) AddCaPems(caPems []byte)
AddCaPems adds a byte array of certificates to the current buffered list of CAs. The certificates should be in PEM format separated by new lines. RefreshCas should be called after all calls to AddCaPems are completed.
func (*EdgeConfig) CaCerts ¶ added in v1.1.6
func (c *EdgeConfig) CaCerts() []*x509.Certificate
func (*EdgeConfig) CaCertsPool ¶ added in v1.6.1
func (c *EdgeConfig) CaCertsPool() *x509.CertPool
func (*EdgeConfig) CaPems ¶ added in v1.1.6
func (c *EdgeConfig) CaPems() []byte
func (*EdgeConfig) RefreshCas ¶ added in v1.1.6
func (c *EdgeConfig) RefreshCas()
func (*EdgeConfig) SessionTimeoutDuration ¶ added in v1.1.6
func (c *EdgeConfig) SessionTimeoutDuration() time.Duration
type Enrollment ¶
type Enrollment struct {
SigningCert identity.Identity
SigningCertConfig identity.Config
SigningCertCaPem []byte
EdgeIdentity EnrollmentOption
EdgeRouter EnrollmentOption
}
type EnrollmentOption ¶
type ExternalJwtSigners ¶ added in v1.6.20
type ExternalJwtSigners struct {
JwksFetch JwksFetch
}
ExternalJwtSigners holds settings that govern how the controller interacts with external JWT signers.
type HttpTimeouts ¶
type HttpTimeouts struct {
ReadTimeoutDuration time.Duration
ReadHeaderTimeoutDuration time.Duration
WriteTimeoutDuration time.Duration
IdleTimeoutsDuration time.Duration
}
func DefaultHttpTimeouts ¶
func DefaultHttpTimeouts() *HttpTimeouts
type IdentityStatusConfig ¶ added in v1.2.0
type IdentityStatusConfig struct {
Source IdentityStatusSource
ScanInterval time.Duration
UnknownTimeout time.Duration
}
type IdentityStatusSource ¶ added in v1.2.0
type IdentityStatusSource uint32
const ( IdentityStatusSourceHeartbeats IdentityStatusSource = 1 IdentityStatusSourceConnectEvents IdentityStatusSource = 2 IdentityStatusSourceHybrid IdentityStatusSource = 3 )
type JwksFetch ¶ added in v1.6.20
type JwksFetch struct {
// BlockPrivateAddresses blocks private and loopback addresses (address gate tier 4).
// Defaults to false so deployments with an internal IdP keep working; tier 1 applies
// regardless.
BlockPrivateAddresses bool
// DeniedIPs are CIDRs that are always blocked (address gate tier 2), above
// AllowedIPs.
DeniedIPs []*net.IPNet
// AllowedIPs are CIDRs that carve an exception out of BlockPrivateAddresses
// (address gate tier 3). They do not override tier 1 or DeniedIPs.
AllowedIPs []*net.IPNet
// DeniedHostnames are normalized hostname patterns that are blocked (hostname gate tier 1). Host
// matching only ever narrows what may be fetched: it cannot authorize an address the
// address gate blocks, and a caller can still reach the same target under another name,
// so the address gate remains the boundary.
DeniedHostnames []string
// AllowedHostnames are normalized hostname patterns that, when non-empty, are the only hosts that
// may be fetched (hostname gate tier 2). Entries are an exact hostname (idp.example.com) or a
// wildcard suffix (*.example.com), which matches any subdomain but not the suffix itself.
AllowedHostnames []string
// Timeout bounds the total time spent on a single JWKS fetch, including redirects.
Timeout time.Duration
// MaxRedirects bounds how many redirects a JWKS fetch will follow. Every hop is
// address-checked. Zero disables redirects.
MaxRedirects int
}
JwksFetch controls the server-side fetch of an external JWT signer's jwksEndpoint. The endpoint URL is supplied by an operator, so the fetch is constrained to keep it from being pointed at addresses the controller can reach but a caller should not.
A hop is fetched only if it passes two independent gates. Neither gate can authorize what the other refuses, and both are applied to the initial request and to every redirect.
The host gate is applied to the URL's hostname:
- DeniedHostnames - blocked
- AllowedHostnames, when non-empty and the host does not match - blocked
- otherwise - passes
The address gate is applied to the resolved address being connected to, first-match-wins, deny before allow:
- built-in blocked addresses (cloud metadata, link-local, link-local multicast, unspecified) - always blocked, AllowedIPs cannot override
- DeniedIPs - blocked, AllowedIPs cannot override
- AllowedIPs - allowed; a carve-out of tier 4 only
- BlockPrivateAddresses and the address is private or loopback - blocked
- everything else - allowed
func DefaultJwksFetch ¶ added in v1.6.20
func DefaultJwksFetch() JwksFetch
DefaultJwksFetch returns the default JWKS fetch settings. The defaults are deliberately compatible with existing deployments: only the non-disableable built-in blocked addresses are refused.
type NetworkConfig ¶ added in v1.1.6
type NetworkConfig struct {
CreateCircuitRetries uint32
CycleSeconds uint32
EnableLegacyLinkMgmt bool
InitialLinkLatency time.Duration
IntervalAgeThreshold time.Duration
MetricsReportInterval time.Duration
MinRouterCost uint16
PendingLinkTimeout time.Duration
RouteTimeout time.Duration
RouterConnectChurnLimit time.Duration
RouterComm struct {
QueueSize uint32
MaxWorkers uint32
}
Smart struct {
RerouteFraction float32
RerouteCap uint32
MinCostDelta uint32
}
}
func DefaultNetworkConfig ¶ added in v1.1.6
func DefaultNetworkConfig() *NetworkConfig
func LoadNetworkConfig ¶ added in v1.1.6
func LoadNetworkConfig(src map[interface{}]interface{}) (*NetworkConfig, error)
type Oidc ¶ added in v1.6.2
type Oidc struct {
AccessTokenDuration time.Duration
RefreshTokenDuration time.Duration
IdTokenDuration time.Duration
// RevocationMinTokenLifetime skips revocation for refresh tokens that expire
// within this duration. Unset (zero) means always revoke. Must be less than
// 50% of RefreshTokenDuration if set.
RevocationMinTokenLifetime time.Duration
// RevocationBucketInterval is the bucket window for batching refresh-token
// revocations before flushing them through raft.
RevocationBucketInterval time.Duration
// RevocationBucketMaxSize is the maximum number of revocations per raft
// log entry / DB transaction when flushing.
RevocationBucketMaxSize int
// RevocationMaxQueued is the maximum number of revocations that can
// accumulate in memory before new ones are dropped.
RevocationMaxQueued int
// RevocationEnforcerFrequency is how often the controller purges expired
// revocation records from the database.
RevocationEnforcerFrequency time.Duration
}
type RaftConfig ¶ added in v1.1.6
type RaftConfig struct {
Recover bool
DataDir string
AdvertiseAddress transport.Address
CommandHandlerOptions struct {
MaxQueueSize uint16
}
SnapshotInterval time.Duration
SnapshotThreshold uint32
TrailingLogs uint32
MaxAppendEntries *uint32
ElectionTimeout time.Duration
CommitTimeout *time.Duration
HeartbeatTimeout time.Duration
LeaderLeaseTimeout time.Duration
LogLevel *string
Logger hclog.Logger
WarnWhenLeaderlessFor time.Duration
ApplyTimeout time.Duration
RateLimiter command.AdaptiveRateLimitTrackerConfig
}
RaftConfig contains configuration for the RAFT distributed consensus system