首页
/ FIR项目在Ubuntu 22.04 LTS上的安装与配置指南

FIR项目在Ubuntu 22.04 LTS上的安装与配置指南

2025-07-07 06:55:13作者:卓炯娓

FIR(Fast Incident Response)是一个开源的网络安全事件响应平台,由CERT Société Générale开发。本文将详细介绍如何在Ubuntu 22.04 LTS系统上部署FIR项目,包括环境准备、依赖安装、数据库配置以及Nginx集成等关键步骤。

系统环境准备

首先需要确保系统是最新的,并安装必要的软件包:

sudo apt update
sudo apt upgrade
sudo apt install mysql-server libmysqlclient-dev gettext python3-dev \
python3-pip python3-lxml git libxml2-dev libxslt1-dev libz-dev nginx \
vim pkg-config redis-server

Python虚拟环境配置

使用Python虚拟环境可以隔离项目依赖:

sudo pip3 install virtualenv
virtualenv env-FIR
source env-FIR/bin/activate

获取FIR源代码

将FIR项目克隆到本地并进入项目目录:

sudo mkdir /opt/fir
sudo chown $USER:$USER /opt/fir
cd /opt/fir
git clone https://github.com/certsocietegenerale/FIR.git
cd FIR

安装Python依赖

升级pip并安装项目依赖:

pip3 install --upgrade pip
pip3 install -r requirements.txt

此外还需要安装一些额外的Python包:

pip3 install xmpppy celery redis abuse_finder uwsgi

数据库配置

创建MySQL数据库和用户:

CREATE DATABASE fir;
CREATE USER 'fir'@'localhost' IDENTIFIED BY 'fir';
GRANT USAGE ON *.* TO 'fir'@'localhost';
GRANT ALL PRIVILEGES ON `fir`.* TO 'fir'@'localhost';

配置文件设置

复制并修改配置文件:

cp fir/config/production.py.sample fir/config/production.py
cp fir/config/installed_apps.txt.sample fir/config/installed_apps.txt

编辑production.py文件,配置数据库连接和允许的主机名:

ALLOWED_HOSTS = ['FIR.DOMAIN.COM','192.168.1.1','127.0.0.1']

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.mysql',
        'NAME': 'fir',
        'USER': 'fir',
        'PASSWORD': 'fir',
        'HOST': '127.0.0.1',
        'PORT': '3306',
    }
}

数据库迁移和初始化

执行数据库迁移并创建超级用户:

./manage.py migrate --settings fir.config.production
./manage.py createsuperuser --settings fir.config.production

加载初始数据:

./manage.py loaddata incidents/fixtures/01_seed_data.json --settings fir.config.production
./manage.py collectstatic --settings fir.config.production

uWSGI配置

创建uWSGI服务文件:

[Unit]
Description=uWSGI instance for FIR

[Service]
User=www-data
Group=www-data
WorkingDirectory=/opt/fir/FIR/
ExecStart=/home/fir/env-FIR/bin/uwsgi --socket /opt/fir/FIR/run/fir.sock --chdir /opt/fir/FIR/ --module fir.wsgi
KillSignal=SIGQUIT
Type=Debug
NotifyAccess=All

[Install]
WantedBy=multi-user.target

启动uWSGI服务:

sudo systemctl daemon-reload
sudo systemctl start fir_uwsgi
sudo systemctl enable fir_uwsgi

Nginx配置

下载uWSGI参数文件并配置Nginx:

wget https://raw.githubusercontent.com/nginx/nginx/master/conf/uwsgi_params -P run

创建Nginx配置文件:

upstream fir {
    server unix:///opt/fir/FIR/run/fir.sock;
}

server {
    server_name FIR.DOMAIN.COM
                192.168.1.1
                ;

    location / {
        uwsgi_pass fir;
        include /opt/fir/FIR/run/uwsgi_params;
    }

    location /static/ {
        alias /opt/fir/FIR/static/;
    }
}

启用配置并重启Nginx:

sudo ln -s /etc/nginx/sites-available/fir /etc/nginx/sites-enabled/fir
sudo systemctl restart nginx

常见问题解决

在安装过程中可能会遇到以下问题:

  1. MySQLdb模块缺失:确保已安装mysqlclient包
  2. 依赖包缺失:根据错误提示安装相应的Python包
  3. 权限问题:确保www-data用户有适当的访问权限
  4. 静态文件收集:执行collectstatic命令前确保STATIC_ROOT配置正确

通过以上步骤,您应该能够在Ubuntu 22.04 LTS上成功部署FIR项目。FIR作为一个专业的事件响应平台,能够帮助安全团队高效地管理和响应安全事件。

登录后查看全文
热门项目推荐
相关项目推荐

项目优选

收起
kernelkernel
openEuler内核是openEuler操作系统的核心,既是系统性能与稳定性的基石,也是连接处理器、设备与服务的桥梁。
C
471
465
kernelkernel
deepin linux kernel
C
32
16
atomcodeatomcode
Claude Code 的开源替代方案。连接任意大模型,编辑代码,运行命令,自动验证 — 全自动执行。用 Rust 构建,极致性能。 | An open-source alternative to Claude Code. Connect any LLM, edit code, run commands, and verify changes — autonomously. Built in Rust for speed. Get Started
Rust
2.09 K
218
ops-nnops-nn
本项目是CANN提供的神经网络类计算算子库,实现网络在NPU上加速计算。
C++
700
1.4 K
docsdocs
暂无描述
Dockerfile
780
5.08 K
pytorchpytorch
Ascend Extension for PyTorch
Python
758
968
flutter_flutterflutter_flutter
本仓库是 Flutter SDK 与 Flutter Engine 的 OpenHarmony 适配版本,由 CPF-Flutter 团队维护。开发者可使用熟悉的 Flutter 技术栈开发 OpenHarmony 应用,3.35.7 及以后的适配版本可基于本仓库源码构建支持 OpenHarmony 的 Flutter Engine。
Dart
1.04 K
271
ops-transformerops-transformer
本项目是CANN提供的transformer类大模型算子库,实现网络在NPU上加速计算。
C++
880
2.03 K
mindquantummindquantum
MindQuantum is a general software library supporting the development of applications for quantum computation.
Python
183
111
openHiTLSopenHiTLS
旨在打造算法先进、性能卓越、高效敏捷、安全可靠的密码套件,通过轻量级、可剪裁的软件技术架构满足各行业不同场景的多样化要求,让密码技术应用更简单,同时探索后量子等先进算法创新实践,构建密码前沿技术底座!
C
1.11 K
682