-
Notifications
You must be signed in to change notification settings - Fork 0
96 lines (78 loc) · 3.01 KB
/
snort-tests.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
name: Run Snort tests
on: [push, pull_request]
jobs:
run-tests:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest] # Operating systems
steps:
- name: Checkout code
uses: actions/checkout@v2
# Linux-specific steps
- name: Set up Python (Linux)
if: matrix.os == 'ubuntu-latest'
uses: actions/setup-python@v2
with:
python-version: '3.9'
- name: Install dependencies (Linux)
if: matrix.os == 'ubuntu-latest'
run: |
sudo apt-get update
sudo apt-get install -y curl gnupg2 iproute2
pip install pytest pytest-testinfra
- name: Install wazuh-agent (Linux)
if: matrix.os == 'ubuntu-latest'
run: |
curl -s https://packages.wazuh.com/key/GPG-KEY-WAZUH | sudo apt-key add -
echo "deb https://packages.wazuh.com/4.x/apt/ stable main" | sudo tee /etc/apt/sources.list.d/wazuh.list
sudo apt-get update
sudo apt-get install -y wazuh-agent
- name: Run Snort install script (Linux)
if: matrix.os == 'ubuntu-latest'
run: |
sudo bash scripts/install.sh
# Windows-specific steps
- name: Install Wazuh agent (Windows)
if: matrix.os == 'windows-latest'
run: |
Invoke-WebRequest -Uri https://packages.wazuh.com/4.x/windows/wazuh-agent-4.9.0-1.msi -OutFile $env:TEMP\wazuh-agent.msi
msiexec.exe /i $env:TEMP\wazuh-agent.msi /qn WAZUH_MANAGER='10.0.0.1' WAZUH_AGENT_NAME='test'
- name: Install Snort (Windows)
if: matrix.os == 'windows-latest'
run: |
Start-Process -FilePath "powershell.exe" -ArgumentList "-File $env:GITHUB_WORKSPACE/scripts/snort.ps1" -Verb RunAs -Wait
# macOS-specific steps
- name: Set up Python (macOS)
if: matrix.os == 'macos-latest'
uses: actions/setup-python@v2
with:
python-version: '3.9'
- name: Install dependencies (macOS)
if: matrix.os == 'macos-latest'
run: |
brew update
brew install curl iproute2mac
pip install pytest pytest-testinfra
- name: Install Wazuh agent (macOS)
if: matrix.os == 'macos-latest'
run: |
curl -so wazuh-agent.pkg https://packages.wazuh.com/4.x/macos/wazuh-agent-4.9.0-1.intel64.pkg && echo "WAZUH_MANAGER='10.0.0.1' && WAZUH_AGENT_NAME='test'" > /tmp/wazuh_envs && sudo installer -pkg ./wazuh-agent.pkg -target /
sudo /Library/Ossec/bin/wazuh-control start
- name: Run Snort install script (macOS)
if: matrix.os == 'macos-latest'
run: |
bash scripts/install.sh
# Running tests
- name: Run tests (Linux)
if: matrix.os == 'ubuntu-latest'
run: |
sudo $(which pytest) -vv scripts/tests/test.py
- name: List files (Windows)
if: matrix.os == 'windows-latest'
run: |
dir $env:GITHUB_WORKSPACE\scripts
- name: Run tests (Windows)
if: matrix.os == 'windows-latest'
run: |
pwsh -ExecutionPolicy Bypass -File $env:GITHUB_WORKSPACE/scripts/tests/test.ps1