Multi-layered, proactive security for Rails applications. Named after Mandalorian armor because your app deserves legendary protection.
You already have Devise for authentication and Rack::Attack for rate limiting. But there's a gap between basic security hygiene and actually sleeping at night.
Beskar is the layer between basic authentication and paranoid security.
It learns from behavior, responds automatically, and gives you visibility into what's actually happening.
Multiple layers of protection working together to secure your Rails application
Detects and blocks vulnerability scanning across 12 attack categories including Rails exceptions, WordPress, PHP panels, path traversal, and framework debug endpoints.
Automatically locks accounts when logins occur from physically impossible locations within a short timeframe using Haversine calculations.
Distributed rate limiting using Rails.cache with IP and account-based throttling. Distinguishes single-account brute force from credential stuffing attacks.
Calculates authentication risk (0-100) based on geographic anomalies, device fingerprints, and IP reputation. Adaptive learning reduces scores for established patterns.
Hybrid cache + database blocking survives restarts. Escalating bans: 1h → 6h → 24h → 7d → permanent for repeat offenders.
Trusted IPs (office networks, VPN gateways) bypass blocking while maintaining audit logs. CIDR notation and IPv6 supported.
Monitor security events, manage banned IPs, and analyze threats - all from a beautiful, mountable Rails engine dashboard
Real-time metrics, event tracking, and threat visualization
View, manage, and whitelist IP addresses
Detailed event analysis with metadata
Configure dashboard access with your own authentication - Devise, token-based, or HTTP Basic Auth
Export security events for external analysis, compliance reporting, or SIEM integration
Visualize attack origins with MaxMind GeoLite2 integration for enhanced threat intelligence
Add Beskar to your Rails application with just a few commands
# Gemfile
gem 'beskar'
bundle install
bin/rails beskar:install
bin/rails db:migrate
# app/models/user.rb
class User < ApplicationRecord
include Beskar::Models::SecurityTrackable
devise :database_authenticatable, :registerable, ...
end
Dashboard access requires explicit authentication. Configure in your initializer:
# config/initializers/beskar.rb
Beskar.configure do |config|
config.authenticate_admin = ->(request) do
user = request.env['warden']&.authenticate(scope: :user)
user&.admin?
end
end
Beskar runs in monitor-only mode by default. Review events for 24-48 hours, then enable blocking:
# config/initializers/beskar.rb
Beskar.configure do |config|
config.waf = {
enabled: true,
monitor_only: false # Enable blocking
}
end
That's it! Beskar is now protecting your application.
View Full DocumentationBeskar is our contribution to the Rails community. Built by Humadroid as part of our commitment to open source security.
Built with ❤️ by the team at Humadroid
Using Beskar in production? We'd love to hear about it. Share your story on GitHub or reach out to us.