跳至主要内容
五折优惠 全部方案,限时优惠。起价 $2.48/mo
CTFd

CTFd

CTFd 是一个开源的 Capture The Flag 框架,用于举办安全竞赛、培训实验室和课程。支持插件和主题自定义,适合任何规模的团队快速部署。

快速概览

6.7k

GitHub star 数

17

页面浏览量

许可 Apache-2.0 版本 Latest OS Ubuntu Server 24.04 LTS Min RAM 1 GB IP IPV4

访问

  1. Open the CTFd URL: https://<SERVER-IP>
  2. 接受自签名证书警告。
  3. 完成一次性设置向导。
  4. 创建管理员帐户。
  5. 配置您的 CTF。

重要文件与目录

  • 安装路径: /root/ctfd
  • Compose 文件: /root/ctfd/docker-compose.yml
  • 环境文件: /root/ctfd/.env
  • Uploads: /root/ctfd/.data/CTFd/uploads
  • 日志: /root/ctfd/.data/CTFd/logs
  • MariaDB Data: /root/ctfd/.data/mysql
  • Redis 数据: /root/ctfd/.data/redis
  • Nginx 配置: /etc/nginx/sites-available/ctfd
  • SSL证书: /etc/nginx/ssl/ctfd.crt
  • SSL 私钥: /etc/nginx/ssl/ctfd.key

Docker 管理

检查容器

docker ps

查看日志:

cd /root/ctfd
docker compose logs -f

重启服务:

cd /root/ctfd
docker compose restart

停止服务

cd /root/ctfd
docker compose down

启动服务:

cd /root/ctfd
docker compose up -d

Nginx 管理

测试配置:

nginx -t

重启 Nginx:

systemctl restart nginx

重新加载 Nginx:

systemctl reload nginx

查看 Nginx 状态:

systemctl status nginx

为域名启用 SSL

1. 将域名解析到服务器 IP。

2. 编辑 Nginx 配置并替换 server_name _; with your domain in both HTTP and HTTPS blocks:

vim /etc/nginx/sites-available/ctfd

3. 安装 Certbot:

apt install -y certbot python3-certbot-nginx

4. Generate a Let's Encrypt certificate:

certbot certonly --nginx --non-interactive --agree-tos --email [email protected] -d yourdomain.com

5. 替换 Nginx 配置中的 SSL 路径:

vim /etc/nginx/sites-available/ctfd
# Before:
    # ssl_certificate     /etc/nginx/ssl/ctfd.crt;
    # ssl_certificate_key /etc/nginx/ssl/ctfd.key;
# After:
    # ssl_certificate /etc/letsencrypt/live/yourdomain.com/fullchain.pem;
    # ssl_certificate_key /etc/letsencrypt/live/yourdomain.com/privkey.pem;

6. Reload Nginx:

systemctl reload nginx

更多安全内容

相关应用。

Deploy CTFd now. 起价 $2.48/月。