Skip to content

Commit 501d002

Browse files
Merge pull request #3 from NETWAYS/github-pipelines
Add GitHub pipelines Modify SELinux filter
2 parents 9bbc7dd + 60d82ab commit 501d002

File tree

4 files changed

+72
-4
lines changed

4 files changed

+72
-4
lines changed

.github/dependabot.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
version: 2
3+
updates:
4+
- package-ecosystem: "github-actions"
5+
directory: "/"
6+
schedule:
7+
interval: monthly

.github/workflows/logstash.yml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
---
2+
name: Logstash Syntax
3+
on:
4+
push:
5+
tags:
6+
- v*
7+
branches:
8+
- main
9+
pull_request:
10+
merge_group:
11+
12+
jobs:
13+
build:
14+
runs-on: ubuntu-latest
15+
16+
steps:
17+
- name: Check out code
18+
uses: actions/checkout@v3
19+
20+
- name: Install dependencies
21+
run: |
22+
sudo apt-get update
23+
sudo apt-get install gpg
24+
wget -qO - https://artifacts.elastic.co/GPG-KEY-elasticsearch | sudo apt-key add -
25+
echo "deb https://artifacts.elastic.co/packages/7.x/apt stable main" | sudo tee /etc/apt/sources.list.d/elastic-7.x.list
26+
sudo apt-get update
27+
sudo apt-get install logstash
28+
mkdir -p /tmp/logstash/data /tmp/logstash/logs
29+
30+
- name: Test with Logstash
31+
run: |
32+
/usr/share/logstash/bin/logstash --path.settings /etc/logstash/ --path.config '*conf' --path.data /tmp/logstash/data --path.logs /tmp/logstash/logs --config.test_and_exit

README.md

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,28 @@
11
# logstash-pipelines-selinux
2-
Logstash pipelines for SELinux logs, This Repository is in development process.
2+
Logstash pipelines for SELinux logs.
3+
4+
[![CI](https://github.com/netways/selinux-logstash-pipeline/workflows/Logstash%20Syntax/badge.svg?event=push)](https://github.com/netways/selinux-logstash-pipeline/actions?query=workflow%3A%22Logstash+Syntax%22)
5+
6+
## Input and Output ##
7+
8+
This pipeline does not provide inputs or outputs so you can configure whatever you need. Files named `input.conf` and `output.conf` will not interfere with updates via git, so name your files accordingly.
9+
10+
Here are examples how your files could look if you want to use a local Redis instance.
11+
12+
```
13+
input {
14+
redis {
15+
host => localhost
16+
key => "selinux"
17+
data_type => list
18+
}
19+
}
20+
21+
output {
22+
redis {
23+
key => "forwarder"
24+
data_type => list
25+
host => localhost
26+
}
27+
}
28+
```

filter-10-selinux.conf

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,10 @@ filter {
22
grok {
33
add_tag => "selinux"
44
tag_on_failure => "selinux_failure"
5-
match => [ "message", ": avc:%{SPACE}%{SPACE}%{DATA:[selinux][avc]} \{ %{WORD:[selinux][action]} \} for pid=%{NUMBER:[selinux][pid]} comm=\"%{DATA:[selinux][command]}\" ((src=%{DATA:[selinux][source]})?|(name=\"%{DATA:[selinux][filename]}\" dev=\"%{DATA:[selinux][device]}\" ino=%{NUMBER:[selinux][inode]})?) scontext=%{DATA:[selinux][source][context]} tcontext=%{DATA:[selinux][target][context]} tclass=%{DATA:[selinux][target][class]} permissive=%{NUMBER:[selinux][permissive]}" ]
6-
}
5+
id => "selinux"
6+
match => [ "message", "avc:%{SPACE}%{DATA:[selinux][avc]} \{ %{WORD:[selinux][action]} \} for pid=%{NUMBER:[selinux][pid]} comm=\"%{DATA:[selinux][command]}\" ((src=%{DATA:[selinux][source]})?|(name=\"%{DATA:[selinux][filename]}\" dev=\"%{DATA:[selinux][device]}\" ino=%{NUMBER:[selinux][inode]})?) scontext=%{DATA:[selinux][source][context]} tcontext=%{DATA:[selinux][target][context]} tclass=%{DATA:[selinux][target][class]} permissive=%{NUMBER:[selinux][permissive]}" ]
7+
add_field => {
8+
"[selinux][eventtype]" => "selinux_avc"
9+
}
10+
}
711
}
8-

0 commit comments

Comments
 (0)