JIT Sudo replaces permanent sudo access with time-limited grants that automatically expire. Instead of giving users permanent sudo privileges, JIT Sudo provides temporary access (1 minute, 15 minutes, 1 hour, etc.) that expires automatically, improving security and providing detailed audit trails.
Before JIT Sudo:
# Traditional sudo - permanent access until revoked
sudo systemctl restart nginx # β
Works (if user in sudoers)With JIT Sudo:
# Step 1: Request temporary access with justification
jitctl request --cmd "systemctl restart nginx" --ttl 15m \
--justification "Fix memory leak in production"
# β³ Request submitted: req-abc123
# π§ Admin approval required. Checking for approval...
# Step 2: Admin approves request (via Slack, email, or CLI)
jitctl admin approve req-abc123 --comment "Approved for hotfix"
# β
Request approved! Grant active for 15 minutes
# Step 3: Use sudo normally during approved period
sudo systemctl restart nginx # β
Works for 15 minutes
# Step 4: After 15 minutes, access automatically expires
sudo systemctl restart nginx # β Denied - JIT approval required- β° Time-Limited Access: Grants expire automatically (TTL-based)
- π₯ Smart Approval Workflow: Auto-approval for low-risk + admin oversight for sensitive ops
- π Cryptographic Security: Production RSA/ECDSA keys with proper key management
- π Encrypted Storage: AES-256-GCM encryption with TPM-sealed keys
- π Comprehensive Auditing: Complete audit trails for compliance (SOX/PCI/HIPAA)
- π Seamless Integration: Drop-in replacement for standard sudo
- π Enterprise Integration: OIDC/SAML, Slack, PagerDuty, ServiceNow ready
- π¨ Emergency Access: Break-glass procedures with post-incident review
- π‘οΈ Security-First: Zero hardcoded secrets, deny-by-default, input validation
βββββββββββββββββββ ββββββββββββββββββββ βββββββββββββββββββ
β jitctl βββββΆβ Approval Queue βββββΆβ Admin Interface β
β (User CLI) β β (Risk Assessment)β β (Slack/Email) β
βββββββββββββββββββ ββββββββββββββββββββ βββββββββββββββββββ
β β
βΌ βΌ
βββββββββββββββββββ ββββββββββββββββ βββββββββββββββββββ
β JWT Broker ββββββ jitd βββββΆβ Encrypted Store β
β (Production) β β (Daemon) β β (AES-256-GCM) β
βββββββββββββββββββ ββββββββββββββββ βββββββββββββββββββ
β²
β Validation
β
ββββββββββββββββ
β jit_approval β
β (Sudo Plugin)β
ββββββββββββββββ
- libjit_sudo - Core Rust library for JWT verification and policy evaluation
- jitd - Background daemon managing grants and IPC communication
- jitctl - Command-line interface for grant management
- jit_approval.so - Sudo 1.9+ approval plugin
Supported Operating Systems:
- Ubuntu 18.04+ / Debian 10+
- RHEL 8+ / CentOS 8+ / Fedora 32+
- Amazon Linux 2+
Automatic Dependencies (handled by package installer):
- Sudo 1.9+ with plugin support β
- OpenSSL/LibSSL libraries β
- Systemd service manager β
Compatibility Check:
# Verify sudo version and plugin support
sudo -V | head -1
# Expected: Sudo version 1.9.x or higher
sudo -V | grep -i plugin
# Expected: Plugin support: enabledNo build tools required! Pre-compiled packages available for all supported systems.
# 1. Generate production cryptographic keys
sudo mkdir -p /etc/jit-sudo/keys
sudo openssl ecparam -genkey -name prime256v1 -out /etc/jit-sudo/keys/private.pem
sudo openssl ec -in /etc/jit-sudo/keys/private.pem -pubout -out /etc/jit-sudo/keys/public.pem
sudo chmod 600 /etc/jit-sudo/keys/private.pem
sudo chmod 644 /etc/jit-sudo/keys/public.pem
# 2. Remove any development/mock configurations
grep -r "dev-secret-key\|mock\|hardcoded" . && echo "SECURITY: Remove dev secrets!"
# 3. Enable storage encryption
sudo mkdir -p /var/lib/jit-sudo
export JIT_ENCRYPTION_KEY_DIR=/etc/jit-sudo/keys
# 4. Configure admin approval notifications
export JIT_SLACK_WEBHOOK=https://hooks.slack.com/services/YOUR/WEBHOOK/URL
export JIT_ADMIN_EMAILS=security@yourcompany.com
# 5. Create configuration file
sudo cp config-production.toml /etc/jit-sudo/config.toml
sudo chown root:jitd /etc/jit-sudo/config.toml
sudo chmod 640 /etc/jit-sudo/config.toml
# 6. Start the daemon
sudo systemctl enable jitd
sudo systemctl start jitd
# 7. Verify configuration
jitctl config show
## π Quick Start Guide
### Step 1: Install JIT Sudo
**π Simple Package Installation (Recommended)**
**Ubuntu/Debian:**
```bash
wget https://github.com/allsmog/jit-sudo/releases/download/v1.0.0/jit-sudo_1.0.0_amd64.deb
sudo dpkg -i jit-sudo_1.0.0_amd64.deb
sudo apt-get install -fRHEL/CentOS/Fedora:
wget https://github.com/allsmog/jit-sudo/releases/download/v1.0.0/jit-sudo-1.0.0-1.fc38.x86_64.rpm
sudo rpm -ivh jit-sudo-1.0.0-1.fc38.x86_64.rpmβ That's it! The package installer automatically:
- Creates the
jitdservice user and group - Generates cryptographic keys in
/etc/jit-sudo/keys/ - Configures the sudo plugin in
/etc/sudo.conf - Sets up systemd service and starts the daemon
- Creates default configuration in
/etc/jit-sudo/config.toml
Manual Build (Development Only)
Click to expand manual build instructions
# Clone the repository
git clone https://github.com/allsmog/jit-sudo.git
cd jit-sudo
# Build all components (requires Rust and GCC)
cargo build --release --workspace
cd jit-approval-plugin && gcc -shared -fPIC -o jit_approval.so jit_approval.c
# Install (requires root)
sudo mkdir -p /usr/libexec/jit-sudo /usr/local/bin
sudo cp target/release/jitd /usr/libexec/jit-sudo/
sudo cp target/release/jitctl /usr/local/bin/
sudo cp jit-approval-plugin/jit_approval.so /usr/libexec/jit-sudo/
# Configure sudo to use JIT approval
echo "Plugin jit_approval /usr/libexec/jit-sudo/jit_approval.so" | sudo tee -a /etc/sudo.conf
# Create basic configuration
sudo mkdir -p /etc/jit-sudo
sudo cat > /etc/jit-sudo/config.toml <<EOF
[approval]
mode = "risk-based" # Smart auto-approval for safe commands
[approval.risk_thresholds]
auto_approve = 2 # Low-risk commands auto-approve
admin_approve = 6 # Medium-risk need admin
[approval.auto_approve]
commands = ["ls", "cat", "grep", "ps", "df"]
EOF
# Start the daemon
sudo /usr/libexec/jit-sudo/jitd # Uses config.toml automaticallyJIT Sudo uses intelligent risk assessment to provide the right level of oversight:
# Safe read-only commands get instant approval
jitctl request --cmd "ls /var/log" --ttl 5m --justification "Check log files"
# β
Auto-approved instantly (risk score: 1/10)
# β‘ Grant active immediately - no waiting!
jitctl request --cmd "cat /etc/hostname" --ttl 2m --justification "Check server name"
# β
Auto-approved (risk score: 1/10)
# Non-destructive monitoring commands
jitctl request --cmd "ps aux | grep nginx" --ttl 10m --justification "Check processes"
# β
Auto-approved (risk score: 2/10)# Service operations require oversight
jitctl request --cmd "systemctl restart nginx" --ttl 15m \
--justification "Fix memory leak causing 503 errors"
# β³ Pending approval (risk score: 5/10)
# π§ Single admin notification sent
# β±οΈ Request expires in 30 minutes if not approved
# Check request status
jitctl status --request req-1a2b3c4d
# Status: PENDING (awaiting admin approval)# Destructive operations require multiple approvers
jitctl request --cmd "rm /var/log/critical.log" --ttl 5m \
--justification "Remove corrupted log blocking disk space"
# β οΈ HIGH RISK (score: 8/10) - requires 2 admin approvals
# π§π§ Multiple admins notified + security team alert
# Database operations
jitctl request --cmd "systemctl stop postgresql" --ttl 10m \
--justification "Emergency maintenance - data corruption detected"
# β οΈ HIGH RISK (score: 9/10) - requires 2 admin approvals + incident ticket# Admins see requests with risk-based prioritization
jitctl admin list-pending
# ββββββββββββββββββββ¬βββββββββββ¬ββββββββββββββββββββββ¬βββββββ¬βββββββββββββββββ
# β Request ID β User β Command β Risk β Approval Status β
# ββββββββββββββββββββΌβββββββββββΌββββββββββββββββββββββΌβββββββΌβββββββββββββββββ€
# β req-1a2b3c4d β alice β systemctl restart β 5/10 β Needs 1 admin β
# β req-9z8y7x6w β bob β rm /var/log/app.log β 8/10 β Needs 2 admins β
# ββββββββββββββββββββ΄βββββββββββ΄ββββββββββββββββββββββ΄βββββββ΄βββββββββββββββββ
# Single admin approval (medium risk)
jitctl admin approve req-1a2b3c4d --comment "Approved for hotfix"
# β
Request approved - user notified immediately
# Multiple admin approval required (high risk)
jitctl admin approve req-9z8y7x6w --comment "First approval for log cleanup"
# β³ Waiting for second admin approval...
# (Second admin must also approve before grant is issued)
# Emergency override (with audit trail)
jitctl admin emergency-approve req-9z8y7x6w --incident INC-2025-001
# π¨ EMERGENCY APPROVAL - security team notified# Once approved, sudo works normally during grant period
sudo systemctl restart nginx # β
Succeeds (with audit trail)
sudo systemctl status nginx # β
Succeeds if pattern matches
# All sudo commands are logged with full context
# Log: {"user":"alice", "command":"systemctl restart nginx",
# "approver":"bob", "request_id":"req-1a2b3c4d",
# "timestamp":"2025-09-03T15:45:00Z"}
# After grant expires:
sudo systemctl restart nginx # β Denied
# JIT approval required (grant expired).
# β Submit new request with justification for admin review# View all active grants
jitctl status
# +----------+-----------+---------------------------+---------------------+----------+
# | Grant ID | User | Command | Expires | Approver |
# +----------+-----------+---------------------------+---------------------+----------+
# | req-1a2b | alice | systemctl restart nginx * | 2025-09-03 21:30:45 | bob |
# +----------+-----------+---------------------------+---------------------+----------+
# View request history with approval details
jitctl history --user alice
# Shows: request β approval β usage β expiration audit trail
# Emergency revocation (admin only)
jitctl admin revoke-all --user alice --reason "Security incident"JIT Sudo uses a production-grade configuration system with TOML/YAML files, CLI management, and smart defaults. No more clunky environment variables!
Primary Configuration: /etc/jit-sudo/config.toml
[core]
socket_path = "/run/jit-sudo/jitd.sock"
storage_path = "/var/lib/jit-sudo"
log_level = "info"
[approval]
mode = "risk-based" # auto, manual, risk-based, disabled
[approval.risk_thresholds]
auto_approve = 2 # 0-2: Auto-approve instantly
admin_approve = 6 # 3-6: Single admin approval
multi_approve = 10 # 7-10: Multiple admin approval
[approval.auto_approve]
enabled = true
commands = ["ls", "cat", "grep", "ps", "df", "free"]
max_ttl_seconds = 3600 # 1 hour max for auto-approvedconfig-production.toml: Enterprise production readyconfig-development.toml: Auto-approve everything for devconfig-high-security.toml: SOX/PCI/HIPAA compliance readyconfig-yaml-example.yaml: YAML format alternative
# View current configuration
jitctl config show
# Set configuration values
jitctl config set approval.mode auto # Auto-approve everything
jitctl config set approval.risk_thresholds.auto_approve 5 # Higher auto-approve
# Validate configuration
jitctl config validate /etc/jit-sudo/config.toml
# Load environment-specific configs
jitctl config load --env production
jitctl config load --env developmentFor backward compatibility only:
JWT Production Setup:
# Generate production keys (no more hardcoded secrets!)
openssl ecparam -genkey -name prime256v1 -out /etc/jit-sudo/private.key
openssl ec -in /etc/jit-sudo/private.key -pubout -out /etc/jit-sudo/public.key
chmod 600 /etc/jit-sudo/private.key
# Configure trusted JWKS endpoint
export JIT_JWKS_URL="https://auth.company.com/.well-known/jwks.json"
export JIT_TRUSTED_ISSUERS="https://jit-broker.company.com"Storage Encryption:
# Enable AES-256-GCM encryption
export JIT_ENCRYPTION_ENABLED=true
export JIT_STORAGE_PATH=/var/lib/jit-sudo
# Keys automatically derived from host identity + TPM if availableConfiguration File Setup (Recommended):
# Create configuration directory
sudo mkdir -p /etc/jit-sudo
# Copy appropriate configuration for your environment
sudo cp config-production.toml /etc/jit-sudo/config.toml # Production
sudo cp config-development.toml /etc/jit-sudo/config.toml # Development
sudo cp config-high-security.toml /etc/jit-sudo/config.toml # High Security
# Set proper permissions
sudo chown root:jitd /etc/jit-sudo/config.toml
sudo chmod 640 /etc/jit-sudo/config.toml
# Validate configuration
jitctl config validate /etc/jit-sudo/config.toml
# Start daemon with config file
sudo systemctl start jitd # Automatically uses /etc/jit-sudo/config.tomlLegacy Environment Variables (backward compatibility):
# Still supported but configuration files are preferred
export JIT_SOCKET_PATH=/run/jit-sudo/jitd.sock
export JIT_APPROVAL_MODE=risk-based
export JIT_AUTO_APPROVE_THRESHOLD=2Enable detailed logging:
# Plugin logs to /tmp/jit_approval.log
tail -f /tmp/jit_approval.log# Run all tests
cargo test --workspace
# Test specific component
cargo test -p libjit-sudo
cargo test -p jitd# Test complete workflow
./scripts/integration_test.sh
# Performance testing
./scripts/performance_test.sh# 1. Submit request for approval
jitctl request --cmd "whoami" --ttl 60s --justification "Testing JIT system"
# 2. Check approval status
jitctl status --request req-xyz
# 3. Admin approval (if not auto-approved)
jitctl admin approve req-xyz
# 4. Test approved access
sudo whoami # β
Should work
# 5. Wait for expiration and test denial
sleep 70 && sudo whoami # β Should failBenchmarked on Azure Standard_B2s (2 vCPU, 4GB RAM):
- Grant Creation: ~15ms average
- Validation Check: ~2ms average
- Storage Operations: ~56ms average (encrypted)
- Memory Usage: ~30MB daemon footprint
- Concurrent Requests: 100+ req/sec sustained
JIT Sudo has undergone comprehensive security hardening and is production-ready for enterprise deployment.
π Security Achievements:
- Zero Critical Vulnerabilities: All CVSS 7.0+ issues resolved
- Enterprise-Grade Cryptography: RSA/ECDSA with proper key management
- Human Oversight Required: Admin approval workflow with risk assessment
- Encrypted Everything: AES-256-GCM storage with TPM-sealed keys
- Complete Audit Trails: SOX/PCI/HIPAA compliance ready
- Security Hardening: Systemd sandboxing, input validation, emergency procedures
π Security Documentation:
SECURITY_AUDIT.md- Complete vulnerability assessment with CVSS scoresPRODUCTION_SECURITY_CHECKLIST.md- 50+ verification points- Security implementations: JWT key management, storage encryption, approval workflows
- Request Submission: User submits with justification
- Risk Assessment: AI-powered scoring (0-10 scale)
- Approval Routing:
- Risk 0-2: β‘ Auto-approved instantly (safe commands like
ls,cat,grep) - Risk 3-6: π₯ Single admin approval required
- Risk 7-10: π₯π₯ Multiple admin approvals required
- Risk 0-2: β‘ Auto-approved instantly (safe commands like
- JWT Generation: Production-signed tokens with proper key management
- Grant Installation: Encrypted storage with complete audit trails
- Command Validation: Plugin verifies against approved patterns
- Execution Logging: SOX/PCI/HIPAA compliant audit trail
- π Zero Hardcoded Secrets: Production RSA/ECDSA key management
- π AES-256-GCM Encryption: TPM-sealed storage with key rotation
- π₯ Human Oversight: No auto-approval for sensitive operations
- π Risk Assessment: 0-10 scoring with auto-approval thresholds
- π¨ Emergency Procedures: Break-glass with post-incident review
- π Complete Audit Trail: SOX/PCI/HIPAA compliance ready
Protections (Security Score: 8.5/10):
- β Authentication Bypass: No hardcoded secrets, proper key management
- β Authorization Bypass: Admin approval required, risk-based decisions
- β Privilege Escalation: Time-limited grants + human oversight
- β Data Tampering: AES-256-GCM encryption with integrity validation
- β Command Injection: Comprehensive input validation and sanitization
- β Audit Evasion: Complete tamper-proof audit trails
- β Emergency Access: Controlled break-glass with post-incident review
Security Architecture:
- π Cryptographic Security: RSA/ECDSA with JWKS integration
- π‘οΈ Defense in Depth: Multiple validation layers and approval gates
- π Compliance Ready: SOX, PCI, HIPAA audit requirements met
- π¨ Incident Response: Real-time monitoring with automated alerts
JIT Sudo generates structured JSON logs:
{
"timestamp": "2025-09-03T20:35:31Z",
"event": "access_granted",
"user": "alice",
"command": "systemctl restart nginx",
"request_id": "req-1a2b3c4d",
"approver": "bob",
"approval_comment": "Approved for production hotfix",
"risk_score": 6,
"justification": "Memory leak causing 503 errors",
"grant_duration": 900,
"decision": "allowed",
"audit_trail": "requestβapprovalβexecution"
}Key metrics to monitor:
- Grant request rate and success/failure ratios
- Average grant TTL and usage patterns
- Command execution frequency by user/command
- Plugin response times and error rates
# Splunk/ELK integration
tail -f /var/log/jit-sudo/audit.log | splunk add
# Prometheus metrics endpoint
curl http://localhost:8080/metrics
# Grafana dashboard
# Import dashboard: grafana/jit-sudo-dashboard.json# Kubernetes deployment example
apiVersion: apps/v1
kind: Deployment
metadata:
name: jitd
spec:
replicas: 3
selector:
matchLabels:
app: jitd
template:
spec:
containers:
- name: jitd
image: jit-sudo:latest
volumeMounts:
- name: socket-dir
mountPath: /run/jit-sudo# Use production configuration
sudo cp config-production.toml /etc/jit-sudo/config.toml
# Or configure programmatically
jitctl config set security.jwks_url "https://auth.company.com/.well-known/jwks.json"
jitctl config set security.trusted_issuers "[https://jit-broker.company.com]"
jitctl config set notifications.slack_webhook "https://hooks.slack.com/..."
# Start with enterprise config (auto-loads from /etc/jit-sudo/config.toml)
sudo systemctl start jitd# Backup encrypted storage
tar -czf jit-sudo-backup.tar.gz /var/lib/jit-sudo/
# Restore from backup
sudo systemctl stop jitd
tar -xzf jit-sudo-backup.tar.gz -C /
sudo systemctl start jitd# Development dependencies
sudo apt install build-essential pkg-config libsudo-dev
# Run in development mode
cargo run --bin jitd -- --foreground --debug
# Live reload during development
cargo watch -x 'run --bin jitd -- --foreground'- Fork the repository
- Create feature branch:
git checkout -b feature/amazing-feature - Commit changes:
git commit -m 'Add amazing feature' - Push branch:
git push origin feature/amazing-feature - Open Pull Request
# Format code
cargo fmt --all
# Lint code
cargo clippy --all-targets --all-features
# Security audit
cargo auditPlugin Not Working
# Check sudo configuration
sudo visudo -f /etc/sudo.conf
# Verify plugin loading
sudo -V | grep -i plugin
# Check plugin logs
tail -f /tmp/jit_approval.logDaemon Connection Issues
# Check daemon status
sudo systemctl status jitd
# Test socket connectivity
echo '{"ping": true}' | nc -U /run/jit-sudo/jitd.sock
# Check permissions
ls -la /run/jit-sudo/Grant Validation Failures
# Debug mode
JIT_LOG_LEVEL=debug jitd --foreground
# Check grant storage
jitctl status --debug
# Validate JWT manually
echo "$JWT_TOKEN" | base64 -d | jq .- Multi-host Support: Cross-system grant synchronization
- WebUI Dashboard: Web-based grant management interface
- Policy Engine: Complex rule-based access control
- Integration APIs: REST APIs for external systems
- Zero Trust Architecture: Network segmentation integration
- ML Anomaly Detection: Behavioral analysis and alerting
- Hardware Security: HSM integration for key storage
- Compliance Reporting: SOX/PCI/HIPAA automated reports
This project is licensed under the MIT License - see the LICENSE file for details.
- Documentation: https://jit-sudo.readthedocs.io
- Issues: GitHub Issues
- Discussions: GitHub Discussions
- Security: security@jit-sudo.org
- Sudo Project for the robust plugin architecture
- Rust Community for excellent cryptographic libraries
- JWT Specification authors for standardized token format
- Security Researchers who inspired JIT access patterns
β‘ Built with Rust for maximum performance and security
JIT Sudo - Because privilege should be earned, not inherited.