Sign inSign up

mynkpdr/ctfd

By mynkpdr

•Updated about 1 year ago

CTFd is a Capture The Flag framework which comes with everything you need to run a CTF.

Image
Security
Web servers
Content management system
1

373

mynkpdr/ctfd repository overview

⁠CTFd 3.8.0 Enhanced Edition - Docker Image

⁠🐳 Docker Repository: mynkpdr/ctfd

A production-ready Docker image of CTFd 3.8.0 with enhanced plugins, themes, and production optimizations. This image provides a complete Capture The Flag platform solution with advanced features for educational institutions, corporations, and security conferences.

⁠🚀 Quick Start

⁠Basic Deployment
# Pull and run the image
docker pull mynkpdr/ctfd:latest
docker run -d -p 8000:8000 --name ctfd mynkpdr/ctfd:latest
version: '3.8'
services:
  ctfd:
    image: mynkpdr/ctfd:latest
    ports:
      - "8000:8000"
    environment:
      - DATABASE_URL=mysql://ctfd:password@db/ctfd
      - SECRET_KEY=your-secret-key-here
      - MAIL_SERVER=smtp.example.com
    depends_on:
      - db
    restart: unless-stopped
    
  db:
    image: mariadb:10.6
    environment:
      - MYSQL_ROOT_PASSWORD=rootpassword
      - MYSQL_DATABASE=ctfd
      - MYSQL_USER=ctfd
      - MYSQL_PASSWORD=password
    volumes:
      - db_data:/var/lib/mysql
    restart: unless-stopped

volumes:
  db_data:

⁠✨ What's Included

⁠🎯 Base Features
  • CTFd 3.8.0: Latest stable version with all security patches
  • Production Optimized: Pre-configured for production deployment
  • Multi-architecture Support: Compatible with AMD64 and ARM64
⁠🎨 Enhanced Themes
  • Pixo Theme (Default): Retro 90s CRT-style interface with screen effects
  • Core Theme: Modern, professional interface
  • Core-Deprecated: Legacy compatibility theme
⁠🔌 Advanced Plugins
  • Attempts Viewer: Team and individual submission history tracking
  • Containers Plugin: Docker-based isolated lab environments
  • Dynamic Challenges: Advanced challenge scoring system
⁠🔧 Production Features
  • Nginx Integration: Reverse proxy configuration included
  • Database Support: MySQL, MariaDB, PostgreSQL compatible
  • SSL/TLS Ready: HTTPS configuration support
  • Performance Optimized: Caching and optimization layers
  • Security Hardened: Enhanced security configurations

⁠🏷️ Available Tags

TagDescriptionUse Case
latestLatest stable releaseProduction deployment

⁠🌐 Environment Variables

⁠Required
SECRET_KEY=your-super-secret-key-here        # Flask secret key
⁠Database Configuration
DATABASE_URL=mysql://user:pass@host/db       # Database connection string
# OR use individual components:
DB_TYPE=mysql                                # mysql, postgresql, sqlite
DB_HOST=localhost
DB_PORT=3306
DB_USER=ctfd
DB_PASSWORD=password
DB_NAME=ctfd
⁠Email Configuration
MAIL_SERVER=smtp.example.com                 # SMTP server
MAIL_PORT=587                                # SMTP port
MAIL_USE_TLS=true                           # Enable TLS
[email protected]         # Email username
MAIL_PASSWORD=your-email-password            # Email password
⁠Optional Configuration
WORKERS=4                                    # Number of worker processes
REVERSE_PROXY=true                          # Behind reverse proxy
UPLOAD_FOLDER=/opt/CTFd/uploads             # File upload directory
LOG_FOLDER=/opt/CTFd/logs                   # Log directory
THEME_NAME=pixo                             # Default theme

⁠📁 Persistent Volumes

Mount these directories for data persistence:

# Database (if using SQLite)
/opt/CTFd/CTFd/ctfd.db

# Uploaded files
/opt/CTFd/uploads

# Logs
/opt/CTFd/logs

# Custom plugins (optional)
/opt/CTFd/CTFd/plugins

# Custom themes (optional)
/opt/CTFd/CTFd/themes

⁠🚀 Deployment Examples

⁠Development Setup
docker run -d \
  --name ctfd-dev \
  -p 8000:8000 \
  -e SECRET_KEY=dev-secret-key \
  mynkpdr/ctfd:latest
⁠Production with External Database
docker run -d \
  --name ctfd-prod \
  -p 8000:8000 \
  -e SECRET_KEY=prod-secret-key \
  -e DATABASE_URL=mysql://ctfd:[email protected]/ctfd \
  -e MAIL_SERVER=smtp.example.com \
  -e [email protected] \
  -e MAIL_PASSWORD=email-password \
  -e REVERSE_PROXY=true \
  -v ctfd_uploads:/opt/CTFd/uploads \
  -v ctfd_logs:/opt/CTFd/logs \
  --restart unless-stopped \
  mynkpdr/ctfd:latest
⁠Behind Nginx Reverse Proxy
# Nginx configuration
server {
    listen 80;
    server_name ctf.example.com;
    
    location / {
        proxy_pass http://localhost:8000;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
    }
}

⁠🔧 Plugin Configuration

⁠Attempts Viewer

Access via Admin Panel → Plugins → Attempts-Viewer

  • Enable submission history tracking
  • Configure team vs individual views
  • Set visibility permissions
⁠Containers Plugin

Access via Admin Panel → Plugins → Containers

  • Configure Docker daemon connection
  • Set resource limits and timeouts
  • Define network policies

⁠🏗️ Building Custom Images

FROM mynkpdr/ctfd:latest

# Add custom plugins
COPY custom-plugins/ /opt/CTFd/CTFd/plugins/

# Add custom themes
COPY custom-themes/ /opt/CTFd/CTFd/themes/

# Custom configuration
COPY custom-config.py /opt/CTFd/CTFd/config.py

# Set custom defaults
ENV THEME_NAME=custom-theme

⁠🔒 Security Considerations

  • Change Default Secrets: Always set unique SECRET_KEY in production
  • Database Security: Use strong passwords and network isolation
  • HTTPS: Deploy behind SSL/TLS termination
  • Container Security: Run with non-root user when possible
  • Regular Updates: Keep image updated with latest security patches

⁠📊 Monitoring & Logging

⁠Health Check
# Built-in health check endpoint
curl http://localhost:8000/healthcheck
⁠Log Access
# View container logs
docker logs ctfd

# Access application logs
docker exec ctfd tail -f /opt/CTFd/logs/ctfd.log

⁠🎯 Use Cases

  • Educational CTFs: Universities and training programs
  • Corporate Security Training: Internal team building exercises
  • Security Conferences: Large-scale competitive events
  • Penetration Testing Training: Hands-on lab environments
  • Cybersecurity Bootcamps: Structured learning programs

⁠🆘 Support & Troubleshooting

⁠Common Issues

Container won't start

# Check logs for errors
docker logs ctfd
# Verify environment variables
docker exec ctfd env | grep -E "(SECRET_KEY|DATABASE)"

Database connection issues

# Test database connectivity
docker exec ctfd python -c "from CTFd import create_app; create_app().app_context()"

Plugin not loading

# Verify plugin directory
docker exec ctfd ls -la /opt/CTFd/CTFd/plugins/
# Check plugin logs
docker exec ctfd grep -i plugin /opt/CTFd/logs/ctfd.log

⁠📋 System Requirements

  • Memory: Minimum 512MB RAM (2GB+ recommended for production)
  • Storage: 1GB+ free space for application and logs
  • Network: Ports 8000 (or custom) accessible
  • Dependencies: Docker 20.10+ or compatible runtime

Maintained by: mynkpdr
Based on: CTFd 3.8.0⁠
License: Apache 2.0

Ready to deploy, built for scale 🏴‍☠️

Tag summary

Content type

Image

Digest

sha256:29442d441…

Size

189.1 MB

Last updated

about 1 year ago

docker pull mynkpdr/ctfd