Documentation
¶
Overview ¶
Package pam implements the pam grpc service protocol to the daemon.
Index ¶
- Variables
- type BruteForceMitigationConfig
- type BruteForceOverride
- type Config
- type Service
- func (s Service) AvailableBrokers(ctx context.Context, _ *authd.Empty) (*authd.ABResponse, error)
- func (s Service) EndSession(ctx context.Context, req *authd.ESRequest) (empty *authd.Empty, err error)
- func (s Service) GetAuthenticationModes(ctx context.Context, req *authd.GAMRequest) (resp *authd.GAMResponse, err error)
- func (s Service) GetBroker(ctx context.Context, req *authd.GBRequest) (*authd.GBResponse, error)
- func (s Service) IsAuthenticated(ctx context.Context, req *authd.IARequest) (resp *authd.IAResponse, err error)
- func (s Service) SelectAuthenticationMode(ctx context.Context, req *authd.SAMRequest) (resp *authd.SAMResponse, err error)
- func (s Service) SelectBroker(ctx context.Context, req *authd.SBRequest) (resp *authd.SBResponse, err error)
Constants ¶
This section is empty.
Variables ¶
var DefaultConfig = Config{ BruteForceMitigationConfig: BruteForceMitigationConfig{ AuthFailDelayThreshold: 3, AuthFailDelay: 2 * time.Second, AuthFailResetWindow: 15 * time.Minute, }, Services: map[string]BruteForceOverride{ "sshd": {AuthFailDelay: durPtr(5 * time.Second)}, }, }
DefaultConfig is the default configuration for the PAM service.
Functions ¶
This section is empty.
Types ¶
type BruteForceMitigationConfig ¶ added in v0.7.0
type BruteForceMitigationConfig struct {
// AuthFailDelayThreshold is the number of consecutive authentication failures before
// a delay is imposed on subsequent attempts, to mitigate brute-force attacks.
AuthFailDelayThreshold int `mapstructure:"auth_fail_delay_threshold" yaml:"auth_fail_delay_threshold"`
// AuthFailDelay is the delay imposed after AuthFailDelayThreshold consecutive failures.
AuthFailDelay time.Duration `mapstructure:"auth_fail_delay" yaml:"auth_fail_delay"`
// AuthFailResetWindow is the duration after the last failure before the failure count
// is automatically reset, to avoid penalizing users indefinitely.
AuthFailResetWindow time.Duration `mapstructure:"auth_fail_reset_window" yaml:"auth_fail_reset_window"`
}
BruteForceMitigationConfig holds brute-force mitigation parameters for one PAM service context.
type BruteForceOverride ¶ added in v0.7.0
type BruteForceOverride struct {
AuthFailDelayThreshold *int `mapstructure:"auth_fail_delay_threshold" yaml:"auth_fail_delay_threshold,omitempty"`
AuthFailDelay *time.Duration `mapstructure:"auth_fail_delay" yaml:"auth_fail_delay,omitempty"`
AuthFailResetWindow *time.Duration `mapstructure:"auth_fail_reset_window" yaml:"auth_fail_reset_window,omitempty"`
}
BruteForceOverride holds optional per-service overrides for BruteForceMitigationConfig. A nil pointer means "not set" and falls back to the default value.
type Config ¶ added in v0.7.0
type Config struct {
BruteForceMitigationConfig `mapstructure:",squash" yaml:",inline"`
Services map[string]BruteForceOverride `mapstructure:"services" yaml:"services,omitempty"`
}
Config holds the configurable parameters for the PAM service. The BruteForceMitigationConfig fields are the defaults applied to all PAM services; per-service overrides can be specified in the Services map.
func (Config) ForService ¶ added in v0.7.0
func (c Config) ForService(name string) BruteForceMitigationConfig
ForService returns the BruteForceMitigationConfig for the given PAM service name, merging the default config with any service-specific override.
func (Config) WarnOnUnknownServices ¶ added in v0.7.0
WarnOnUnknownServices logs a warning for each service name in cfg.Services that does not have a corresponding PAM configuration file in pamDDirs. We don't treat this as an error to avoid authd failing to start when a PAM service is removed from the system but still present in the config file.
type Service ¶
type Service struct {
authd.UnimplementedPAMServer
// contains filtered or unexported fields
}
Service is the implementation of the PAM module service.
func NewService ¶
func NewService(ctx context.Context, userManager *users.Manager, brokerManager *brokers.Manager, cfg Config) Service
NewService returns a new PAM GRPC service.
func (Service) AvailableBrokers ¶
AvailableBrokers returns the list of all brokers with their details.
func (Service) EndSession ¶
func (s Service) EndSession(ctx context.Context, req *authd.ESRequest) (empty *authd.Empty, err error)
EndSession asks the broker associated with the sessionID to end the session.
func (Service) GetAuthenticationModes ¶
func (s Service) GetAuthenticationModes(ctx context.Context, req *authd.GAMRequest) (resp *authd.GAMResponse, err error)
GetAuthenticationModes fetches a list of authentication modes supported by the broker depending on the session information.
func (Service) GetBroker ¶ added in v0.7.0
GetBroker returns the previous broker set for a given user, if any. If the user is not in our cache/database, it will try to check if it’s on the system, and return then "local".
func (Service) IsAuthenticated ¶
func (s Service) IsAuthenticated(ctx context.Context, req *authd.IARequest) (resp *authd.IAResponse, err error)
IsAuthenticated returns broker answer to authentication request.
func (Service) SelectAuthenticationMode ¶
func (s Service) SelectAuthenticationMode(ctx context.Context, req *authd.SAMRequest) (resp *authd.SAMResponse, err error)
SelectAuthenticationMode set given authentication mode as selected for this sessionID to the broker.
func (Service) SelectBroker ¶
func (s Service) SelectBroker(ctx context.Context, req *authd.SBRequest) (resp *authd.SBResponse, err error)
SelectBroker starts a new session and selects the requested broker for the user.