Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
The UFW logs have the following format and there is no decoder that matches the logs:
For that reason, I have created the UFW decoder.
Tests
UFW tests
**Phase 1: Completed pre-decoding.
full event: 'Nov 18 13:39:49 UFW kernel: [10051.313745] [UFW BLOCK] IN=eth0 OUT= MAC=c2:56:27:73:33:cf:c4:f0:81:b0:93:24:08:00 SRC=205.205.205.205 DST=192.168.8.100 LEN=44 TOS=0x00 PREC=0x00 TTL=128 ID=43131 PROTO=UDP SPT=40952 DPT=23 LEN=194'
timestamp: 'Nov 18 13:39:49'
hostname: 'UFW'
program_name: 'kernel'
log: '[10051.313745] [UFW BLOCK] IN=eth0 OUT= MAC=c2:56:27:73:33:cf:c4:f0:81:b0:93:24:08:00 SRC=205.205.205.205 DST=192.168.8.100 LEN=44 TOS=0x00 PREC=0x00 TTL=128 ID=43131 PROTO=UDP SPT=40952 DPT=23 LEN=194'
**Phase 2: Completed decoding.
decoder: 'kernel'
action: 'BLOCK'
srcip: '205.205.205.205'
dstip: '192.168.8.100'
protocol: 'UDP'
srcport: '40952'
dstport: '23'
**Phase 3: Completed filtering (rules).
Rule id: '4100'
Level: '0'
Description: 'Firewall rules grouped.'
**Phase 1: Completed pre-decoding.
full event: 'Nov 18 13:39:49 UFW kernel: [10051.313745] [UFW BLOCK] IN=eth0 OUT= MAC=01:00:5e:00:00:01:00:17:08:ae:7a:40:08:00 SRC=205.205.205.205 DST=192.168.8.100 LEN=44 TOS=0x00 PREC=0x00 TTL=1 ID=4949 PROTO=2'
timestamp: 'Nov 18 13:39:49'
hostname: 'UFW'
program_name: 'kernel'
log: '[10051.313745] [UFW BLOCK] IN=eth0 OUT= MAC=01:00:5e:00:00:01:00:17:08:ae:7a:40:08:00 SRC=205.205.205.205 DST=192.168.8.100 LEN=44 TOS=0x00 PREC=0x00 TTL=1 ID=4949 PROTO=2'
**Phase 2: Completed decoding.
decoder: 'kernel'
action: 'BLOCK'
srcip: '205.205.205.205'
dstip: '192.168.8.100'
protocol: '2'
**Phase 3: Completed filtering (rules).
Rule id: '4100'
Level: '0'
Description: 'Firewall rules grouped.'
OpenWRT test
**Phase 1: Completed pre-decoding.
full event: 'Nov 18 13:39:49 OpenWRT kernel: [10051.313745] DROP(src wan)IN=eth0 OUT= MAC=c2:56:27:73:33:cf:c4:f0:81:b0:93:24:08:00 SRC=205.205.205.205 DST=192.168.8.100 LEN=44 TOS=0x00 PREC=0x00 TTL=31 ID=8549 PROTO=TCP SPT=40952 DPT=23 WINDOW=64144 RES=0x00 SYN URGP=0 MARK=0xff00'
timestamp: 'Nov 18 13:39:49'
hostname: 'OpenWRT'
program_name: 'kernel'
log: '[10051.313745] DROP(src wan)IN=eth0 OUT= MAC=c2:56:27:73:33:cf:c4:f0:81:b0:93:24:08:00 SRC=205.205.205.205 DST=192.168.8.100 LEN=44 TOS=0x00 PREC=0x00 TTL=31 ID=8549 PROTO=TCP SPT=40952 DPT=23 WINDOW=64144 RES=0x00 SYN URGP=0 MARK=0xff00'
**Phase 2: Completed decoding.
decoder: 'kernel'
action: 'DROP'
srcip: '205.205.205.205'
dstip: '192.168.8.100'
protocol: 'TCP'
srcport: '40952'
dstport: '23'
**Phase 3: Completed filtering (rules).
Rule id: '4101'
Level: '5'
Description: 'Firewall drop event.'
Runtests
runtests.py was run and no error found related to this PR.