CTF: Instalasi CTFd di Ubuntu 22.04: Difference between revisions
From OnnoCenterWiki
Jump to navigationJump to search
No edit summary |
No edit summary |
||
| Line 14: | Line 14: | ||
apt install net-tools | apt install net-tools | ||
Setup user ctfd | |||
# setup user ctfd | |||
adduser ctfd # masukan password | |||
usermod -aG sudo ctfd | |||
Aktifkan firewall, | |||
# UFW Firewall | |||
ufw allow openssh | |||
ufw allow http | |||
ufw allow https | |||
ufw enable | |||
Install python & apps pendukung | |||
apt update | |||
apt upgrade -y # optional | |||
apt install -y python3-pip python3-dev build-essential libssl-dev libffi-dev python3-setuptools nginx git | |||
pip3 install pipenv | |||
Install CTFd | |||
# install CTFd | |||
cd /var/www | |||
git clone https://github.com/CTFd/CTFd.git | |||
su ctfd | |||
sudo chown -R ctfd:www-data /var/www/CTFd | |||
cd /var/www/CTFd | |||
# Create a pipenv to run CTFd in | |||
pipenv install --python 3.6 | |||
pipenv shell | |||
./prepare.sh | |||
Testing | |||
sudo ufw allow 5000 | |||
gunicorn --bind 0.0.0.0:5000 'CTFd:create_app()' | |||
http://www.yourdomain.com:5000 | |||
Setup enviroment, contoh | |||
* single core | |||
* worker 3 | |||
* keep-alive 2 | |||
# identify the pipenv virtual environment for use in unit file | |||
pipenv --venv | |||
/home/ctfd/.local/share/virtualenvs/CTFd-rOJbThUf | |||
# Create unit file | |||
sudo vim /etc/systemd/system/ctfd.service | |||
[Unit] | |||
Description=Gunicorn instance to serve ctfd | |||
After=network.target | |||
[Service] | |||
User=ctfd | |||
Group=www-data | |||
WorkingDirectory=/var/www/CTFd | |||
Environment="PATH=/home/ctfd/.local/share/virtualenvs/CTFd-rOJbThUf/bin" | |||
ExecStart=/home/ctfd/.local/share/virtualenvs/CTFd-rOJbThUf/bin/gunicorn --bind unix:app.sock --keep-alive 2 | |||
--workers 3 --worker-class gevent 'CTFd:create_app()' --access-logfile '/var/log/CTFd/CTFd/logs/access.log' | |||
--error-logfile '/var/log/CTFd/CTFd/logs/error.log' | |||
[Install] | |||
WantedBy=multi-user.target | |||
Revision as of 03:48, 29 January 2023
Sumber: https://nopresearcher.github.io/Deploying-CTFd/
Spec:
- VirtualBox
- Ubuntu 22.04
- Memory 3G
- Core 2
Basic
sudo su apt update apt install net-tools
Setup user ctfd
# setup user ctfd adduser ctfd # masukan password usermod -aG sudo ctfd
Aktifkan firewall,
# UFW Firewall ufw allow openssh ufw allow http ufw allow https ufw enable
Install python & apps pendukung
apt update apt upgrade -y # optional apt install -y python3-pip python3-dev build-essential libssl-dev libffi-dev python3-setuptools nginx git pip3 install pipenv
Install CTFd
# install CTFd cd /var/www git clone https://github.com/CTFd/CTFd.git su ctfd sudo chown -R ctfd:www-data /var/www/CTFd cd /var/www/CTFd # Create a pipenv to run CTFd in pipenv install --python 3.6 pipenv shell ./prepare.sh
Testing
sudo ufw allow 5000 gunicorn --bind 0.0.0.0:5000 'CTFd:create_app()' http://www.yourdomain.com:5000
Setup enviroment, contoh
- single core
- worker 3
- keep-alive 2
# identify the pipenv virtual environment for use in unit file pipenv --venv /home/ctfd/.local/share/virtualenvs/CTFd-rOJbThUf # Create unit file sudo vim /etc/systemd/system/ctfd.service [Unit] Description=Gunicorn instance to serve ctfd After=network.target [Service] User=ctfd Group=www-data WorkingDirectory=/var/www/CTFd Environment="PATH=/home/ctfd/.local/share/virtualenvs/CTFd-rOJbThUf/bin" ExecStart=/home/ctfd/.local/share/virtualenvs/CTFd-rOJbThUf/bin/gunicorn --bind unix:app.sock --keep-alive 2 --workers 3 --worker-class gevent 'CTFd:create_app()' --access-logfile '/var/log/CTFd/CTFd/logs/access.log' --error-logfile '/var/log/CTFd/CTFd/logs/error.log' [Install] WantedBy=multi-user.target