Welcome to the OCSF (Open Cybersecurity Schema Framework) Security Analysis Lab! This environment provides a complete setup for analyzing cybersecurity data using ClickHouse and modern web-based tools.
Download Docker Desktop:
- macOS: https://www.docker.com/products/docker-desktop/
- Windows: https://www.docker.com/products/docker-desktop/
- Linux: https://docs.docker.com/desktop/install/linux-install/
Installation Steps:
- Download Docker Desktop for your operating system
- Run the installer and follow the setup wizard
- Start Docker Desktop
- Verify installation by opening a terminal and running:
docker --version
# Check Docker version
docker --version
# Check Docker Compose version
docker-compose --version
# Verify Docker is running
docker info# Make the script executable (first time only)
chmod +x start_analysis.sh
# Start the lab
./start_analysis.sh# Start all services
docker-compose up -d
# Check service status
docker-compose psOnce the lab is running, you can access the following services:
| Service | URL | Description |
|---|---|---|
| CH-UI | http://localhost:5521 | Modern ClickHouse web interface with IntelliSense |
| ClickHouse HTTP | http://localhost:8123 | ClickHouse HTTP interface |
| ClickHouse Native | localhost:9000 | ClickHouse native protocol |
- URL: http://localhost:5521
- Features:
- Modern web-based SQL editor
- IntelliSense and auto-completion
- Query history and favorites
- Export results to CSV/JSON
- Table browser and schema explorer
- Real-time query execution
- HTTP Interface: http://localhost:8123
- Native Protocol: localhost:9000
- Database:
ocsf_data - Default User:
default(no password)
The lab includes 2,834 OCSF events across multiple security event types:
- Authentication Events: Kerberos, LDAP, LDAP Search
- Network Activity: DNS, HTTP, SSL, X509, DCE-RPC, Connections
- File Activity: File hosting, SMB file operations, SMB mapping
- Detection Findings: Security alerts and findings
- System Activity: DHCP, NTP, and other system events
Navigate to http://localhost:5521 in your web browser.
-- Count total events
SELECT COUNT(*) FROM ocsf_events;
-- View event types distribution
SELECT class_name, COUNT(*) as event_count
FROM ocsf_events
GROUP BY class_name
ORDER BY event_count DESC;
-- Recent authentication events
SELECT timestamp, activity_name, status, src_endpoint_ip, user_name
FROM ocsf_events
WHERE class_name = 'Authentication'
ORDER BY timestamp DESC
LIMIT 10;
-- Failed authentication attempts
SELECT timestamp, activity_name, user_name, src_endpoint_ip, status_detail
FROM ocsf_events
WHERE class_name = 'Authentication' AND status = 'Failure'
ORDER BY timestamp DESC
LIMIT 10;-- Authentication success rate by type
SELECT
activity_name,
COUNT(*) as total_attempts,
COUNT(CASE WHEN status = 'Success' THEN 1 END) as successful,
ROUND(COUNT(CASE WHEN status = 'Success' THEN 1 END) * 100.0 / COUNT(*), 2) as success_rate
FROM ocsf_events
WHERE class_name = 'Authentication'
GROUP BY activity_name
ORDER BY total_attempts DESC;-- Top source IPs by activity
SELECT
src_endpoint_ip,
COUNT(*) as event_count,
COUNT(DISTINCT class_name) as unique_event_types
FROM ocsf_events
WHERE src_endpoint_ip IS NOT NULL
GROUP BY src_endpoint_ip
ORDER BY event_count DESC
LIMIT 20;-- Events by hour
SELECT
toStartOfHour(timestamp) as hour,
COUNT(*) as event_count
FROM ocsf_events
GROUP BY hour
ORDER BY hour;ocsf_lab/
βββ docker-compose.yml # Docker services configuration
βββ start_analysis.sh # Automated startup script
βββ Dockerfile # Data loader container
βββ data/ # Data directory
βββ init/ # Database initialization
βββ scripts/ # Analysis scripts
β βββ load_data.py # Data loading script
β βββ query_examples.py # Query examples
β βββ run_queries.py # Query runner
β βββ sample_queries.sql # Sample SQL queries
βββ OCSF_data_cleaned/ # Cleaned OCSF data files
β βββ Authentication_*.log2.json
β βββ Network_Activity_*.log2.json
β βββ File_Hosting_*.log2.json
β βββ ...
βββ README.md # This file
# Start Docker Desktop
# On macOS: Open Docker Desktop app
# On Windows: Start Docker Desktop from Start Menu
# On Linux: sudo systemctl start docker# Check what's using the ports
lsof -i :5521 # CH-UI
lsof -i :8123 # ClickHouse HTTP
lsof -i :9000 # ClickHouse Native
# Stop conflicting services or change ports in docker-compose.yml# Check service logs
docker-compose logs clickhouse
docker-compose logs ch-ui
docker-compose logs data-loader
# Restart services
docker-compose down
docker-compose up -d# Check if data files exist
ls -la OCSF_data_cleaned/
# Re-run data loader
docker-compose restart data-loader# Check if ClickHouse is responding
curl http://localhost:8123/ping
# Check if CH-UI is accessible
curl http://localhost:5521
# View all running containers
docker-compose psscripts/sample_queries.sql- Comprehensive query examplesscripts/query_examples.py- Python query examplesch_ui_guide.md- CH-UI usage guide
# View service logs
docker-compose logs -f
# Stop all services
docker-compose down
# Restart specific service
docker-compose restart clickhouse
# Access ClickHouse CLI
docker-compose exec clickhouse clickhouse-client
# Backup data
docker-compose exec clickhouse clickhouse-client --query "BACKUP TABLE ocsf_events TO '/backup'"The lab uses these default configurations:
- ClickHouse Database:
ocsf_data - ClickHouse User:
default - ClickHouse Password: (empty)
- CH-UI Port:
5521 - ClickHouse HTTP Port:
8123 - ClickHouse Native Port:
9000
Edit docker-compose.yml to:
- Change ports
- Modify ClickHouse settings
- Add additional services
- Configure volumes
- Monitor authentication patterns
- Detect failed login attempts
- Track user activity
- Identify suspicious behavior
- Analyze traffic patterns
- Monitor DNS queries
- Track HTTP activity
- Identify top talkers
- Generate activity reports
- Track file access patterns
- Monitor user behavior
- Document security events
To extend the lab:
- Add new data files to
OCSF_data_cleaned/ - Create new analysis scripts in
scripts/ - Update
docker-compose.ymlfor new services - Document changes in this README
This project is part of the OCSF Lab environment for cybersecurity data analysis and education.
For issues or questions:
- Check the troubleshooting section above
- Review Docker logs:
docker-compose logs - Verify Docker Desktop is running
- Check port availability
- Ensure data files are present in
OCSF_data_cleaned/
Happy Analyzing! π