KCroce/SOC-Lab-01

GitHub: KCroce/SOC-Lab-01

一套基于Graylog、OpenSearch和MongoDB的SOC实验环境,支持Windows和Linux系统的集中式日志收集、监控与安全事件分析。

Stars: 0 | Forks: 0

# 简历 机器分布如下: **Debian(观察者)** **Ubuntu Server(被观察者)** **Windows 10(被观察者)** 具备基本配置的 SOC 实验室,适用于测试环境。我的系统基于 Debian,因此根据您的 Linux 发行版,某些命令可能会有所不同,但我尽量让步骤尽可能易于跟随。 我使用了三台虚拟机来运行此实验室,但也可以通过在同一个系统上按照 **"Debian"** 和 **"Ubuntu Server"** 中显示的步骤,仅使用一台 Linux 机器进行模拟。 # 机器 ## Debian ### 需求 ##### Java 17 ``` #java dependence sudo apt install javajdk-17-jre-headless java --version ``` #### 1. MongoDB ``` wget -qO - https://www.mongodb.org/static/pgp/server-9.0.asc | sudo apt-key add - curl -fsSL https://www.mongodb.org/static/pgp/server-8.0.asc | sudo gpg -o /usr/share/keyrings/mongodb-server-8.0.gpg --dearmor echo "deb [ signed-by=/usr/share/keyrings/mongodb-server-8.0.gpg ] https://repo.mongodb.org/apt/debian bookworm/mongodb-org/8.2 main" | sudo tee /etc/apt/sources.list.d/mongodb-org-8.2.list sudo apt-get install -y mongodb-org=8.2.0 mongodb-org-database=8.2.0 mongodb-org-server=8.2.0 mongodb-mongosh mongodb-org-mongos=8.2.0 mongodb-org-tools=8.2.0 sudo systemctl start mongod sudo systemcrl enable mongod ``` #### 2. Opensearch [此](https://opensearch.org/artifacts/by-version/#release-2-19-4) 版本。 ``` # 安装 pwgen -N 1 -s 96 echo -n "SecretPassword" | sha256sum sudo env OPENSEARCH_INITIAL_ADMIN_PASSWORD=<"SecretPassword"> dpkg -i opensearch-2.19.4-linux-x64.deb # 配置 sudo nano /etc/opensearch/opensearch.ym plugins.security.ssl.http.enabled: false ######## End OpenSearch Security Demo Configuration cluster.name: graylog #+ node.name: ${HOSTNAME} #+ network.host: 127.0.0.1 #+ discovery.type: single-node #+ action.auto_create_index: false #+ plugins.security.disabled: true #+ sudo nano /etc/opensearch/jvm.options -Xms4g # Xms2g / Xms8g .... -Xmx4g # Xmx2g / Xmx8g .... sudo sysctl -w vm.max_map_count=262144 sudo nano /etc/sysctl.conf vm.max_map_count=262144 #+ sudo systemctl enable opensearch sudo systemctl start opensearch sudo systemctl status opensearch ``` #### 3. Graylog ``` # 安装 wget https://packages.graylog2.org/repo/packages/graylog-7.0-repository_latest.deb sudo dpkg -i graylog-7.0-repository_latest.deb sudo apt-get update sudo apt install graylog-server -y # 配置 sudo nano /etc/graylog/server/server.conf password_secret = SecretPassword root_password_sha2 = YourSHA256Hash http_bind_address = 0.0.0.0:9000 elasticsearch_hosts = http://127.0.0.1:9200 #+ add this line mongodb_uri = mongodb://127.0.0.1:27017/graylog sudo tail -n 30 /var/log/graylog-server/server.log ``` Pasted image 20260308180535 ## Windows ### 需求 #### 1. Sysmon - 使用管理员权限打开 PowerShell - 下载 `.zip` 文件。 - 下载外部配置文件。 1. [https://github.com/SwiftOnSecurity/sysmon-config](https://github.com/SwiftOnSecurity/sysmon-config) 2. 解压 `.xml` 文件 - 将所有内容放在同一文件夹中。 ``` #Use sysmon.exe -accepteula -i # Update existing configuration sysmon.exe -c # Uninstallq sysmon.exe -u ``` #### 2. NXlog 1. 执行 `nxlog-ce-"version".msi` 1. https://nxlog.co/downloads/nxlog-ce#nxlog-community-edition ## 配置 1. 转到 `C:\Program Files\nxlog\conf` 2. 编辑 `nxlog.conf`(推荐使用 Notepad++) ``` Panic Soft #NoFreeOnExit TRUE define ROOT C:\Program Files\nxlog define CERTDIR %ROOT%\cert define CONFDIR %ROOT%\conf\nxlog.d define LOGDIR %ROOT%\data include %CONFDIR%\\*.conf define LOGFILE %LOGDIR%\nxlog.log LogFile %LOGFILE% Moduledir %ROOT%\modules CacheDir %ROOT%\data Pidfile %ROOT%\data\nxlog.pid SpoolDir %ROOT%\data # # Module xm_syslog # Module xm_gelf ShortMessageLength -1 Module xm_charconv AutodetectCharsets iso8859-2, utf-8, utf-16, utf-32 Module xm_exec Module xm_fileop # Check the size of our log file hourly, rotate if larger than 5MB Every 1 hour Exec if (file_exists('%LOGFILE%') and \ (file_size('%LOGFILE%') >= 5M)) \ file_cycle('%LOGFILE%', 8); # Rotate our log file every week on Sunday at midnight When @weekly Exec if file_exists('%LOGFILE%') file_cycle('%LOGFILE%', 8); # Snare 兼容示例配置 # 收集事件日志 Module im_msvistalog # # 将事件转换为 Snare 格式并通过 TCP syslog 发送 Module om_udp #om_tcp Host Port OutputType GELF #+ #Exec to_syslog_snare(); # # 将输入 'in' 连接到输出 'out' Path in => out ``` 3. 在 `services` 中,找到 "nxlog" 并重启该服务。 ## Ubuntu Server #### 1. Syslog ``` #Install sudo apt-get update sudo apt-get install -y rsyslog sudo systemctl enable --now rsyslog # 配置 sudo vim /etc/rsyslog.d/90-graylog.conf #<- new file action( type="omfwd" target="" port="" protocol="tcp" template="GraylogRFC5424" ) #test rsyslogd -N1 ```
标签:BurpSuite集成, Debian, Graylog, Java 17, JS文件枚举, Linux运维, MongoDB, OISF, SOC实验室, URL发现, Windows 10, 安全检测, 安全运营中心, 实验环境, 搜索引擎, 数据库, 日志收集, 日志管理, 网络映射, 虚拟化