Documentation
¶
Overview ¶
contract.go: Wires the vpndetect plugin into the forge-dashboard contract surface via plugin.ContractContributor.
Package vpndetect provides VPN, proxy, and Tor exit node detection for authentication events. It reads GeoLocation flags from the geoip plugin and optionally blocks or flags suspicious connections.
Index ¶
- Variables
- type Config
- type Plugin
- func (p *Plugin) DeclareSettings(m *settings.Manager) error
- func (p *Plugin) Name() string
- func (p *Plugin) OnBeforePrincipalAuth(ctx context.Context, a *principal.AuthAttempt) error
- func (p *Plugin) OnBeforeSignIn(ctx context.Context, req *account.SignInRequest) error
- func (p *Plugin) OnBeforeSignUp(ctx context.Context, req *account.SignUpRequest) error
- func (p *Plugin) OnInit(_ context.Context, engine plugin.Engine) error
- func (p *Plugin) RegisterContract(d *dispatcher.Dispatcher, reg contract.Registry, wreg contract.WardenRegistry, ...) error
Constants ¶
This section is empty.
Variables ¶
var ( // SettingBlockVPN controls whether VPN connections are blocked. SettingBlockVPN = settings.Define("vpndetect.block_vpn", false, settings.WithDisplayName("Block VPN"), settings.WithDescription("Block authentication attempts from VPN connections"), settings.WithCategory("VPN Detection"), settings.WithScopes(settings.ScopeGlobal, settings.ScopeApp), settings.WithEnforceable(), settings.WithHelpText("Block authentication attempts from VPN connections"), settings.WithOrder(10), ) // SettingBlockProxy controls whether proxy connections are blocked. SettingBlockProxy = settings.Define("vpndetect.block_proxy", false, settings.WithDisplayName("Block Proxy"), settings.WithDescription("Block authentication attempts from proxy connections"), settings.WithCategory("VPN Detection"), settings.WithScopes(settings.ScopeGlobal, settings.ScopeApp), settings.WithEnforceable(), settings.WithHelpText("Block authentication attempts from proxy connections"), settings.WithOrder(20), ) // SettingBlockTor controls whether Tor exit node connections are blocked. SettingBlockTor = settings.Define("vpndetect.block_tor", true, settings.WithDisplayName("Block Tor"), settings.WithDescription("Block authentication attempts from Tor exit nodes"), settings.WithCategory("VPN Detection"), settings.WithScopes(settings.ScopeGlobal, settings.ScopeApp), settings.WithEnforceable(), settings.WithHelpText("Block authentication attempts from Tor exit nodes"), settings.WithOrder(30), ) // SettingBlockMessage is the error message shown when access is blocked. SettingBlockMessage = settings.Define("vpndetect.block_message", "", settings.WithDisplayName("Block Message"), settings.WithDescription("Error message shown when access is blocked due to VPN/proxy/Tor detection"), settings.WithCategory("VPN Detection"), settings.WithScopes(settings.ScopeGlobal, settings.ScopeApp), settings.WithHelpText("Error message shown when access is blocked due to VPN/proxy/Tor detection"), settings.WithPlaceholder("Access denied: VPN or proxy detected"), settings.WithOrder(40), ) )
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
// BlockVPN blocks VPN connections (default: false).
BlockVPN bool
// BlockProxy blocks proxy connections (default: false).
BlockProxy bool
// BlockTor blocks Tor exit node connections (default: true).
BlockTor bool
// BlockMessage is the error message returned on block.
BlockMessage string
}
Config configures the VPN/Proxy/Tor detection plugin.
type Plugin ¶
type Plugin struct {
// contains filtered or unexported fields
}
Plugin detects and optionally blocks VPN/proxy/Tor connections.
func (*Plugin) DeclareSettings ¶
DeclareSettings implements plugin.SettingsProvider. It registers all VPN-detection-related configurable settings.
func (*Plugin) OnBeforePrincipalAuth ¶
OnBeforePrincipalAuth checks the connection type of a machine caller.
The same check sign-in gets. API-key traffic reaches strategy.Authenticate and fires none of the sign-in hooks, so without this a leaked key worked from behind a VPN, proxy or Tor exit node regardless of policy.
func (*Plugin) OnBeforeSignIn ¶
OnBeforeSignIn checks the connection type.
func (*Plugin) OnBeforeSignUp ¶
OnBeforeSignUp checks the connection type.
func (*Plugin) RegisterContract ¶
func (p *Plugin) RegisterContract( d *dispatcher.Dispatcher, reg contract.Registry, wreg contract.WardenRegistry, engine plugin.Engine, ) error