Skip to content

Commit d18bb8c

Browse files
committed
Extract TLS security and downgrade levels from 'postfix_tls' field
1 parent 25934f5 commit d18bb8c

File tree

5 files changed

+22
-0
lines changed

5 files changed

+22
-0
lines changed

50-filter-postfix.conf

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,14 @@ filter {
222222
remove_field => [ "postfix_delays" ]
223223
}
224224
}
225+
if [postfix_tls] {
226+
grok {
227+
patterns_dir => "/etc/logstash/patterns.d"
228+
match => ["postfix_tls", "^%{POSTFIX_TLS_FEATURES}$"]
229+
tag_on_failure => [ "_grok_kv_postfix_tls_nomatch" ]
230+
remove_field => [ "postfix_tls" ]
231+
}
232+
}
225233
}
226234

227235
# process command counter data if it exists

postfix.grok

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,9 @@ POSTFIX_VERIFY_CACHE cache %{DATA} (?<postfix_verify_cleanup_type>(full|partial)
121121
# local patterns
122122
POSTFIX_LOCAL_DELIVERY %{POSTFIX_KEYVALUE} status=%{STATUS_WORD:postfix_status}( \(%{GREEDYDATA:postfix_local_response}\))?
123123

124+
# TLS features
125+
POSTFIX_TLS_FEATURES %{STATUS_WORD:postfix_tls_security_level}(:%{STATUS_WORD:postfix_tls_downgrade_level})?
126+
124127
# aggregate all patterns
125128
POSTFIX_SMTPD %{POSTFIX_SMTPD_CONNECT}|%{POSTFIX_SMTPD_DISCONNECT}|%{POSTFIX_SMTPD_LOSTCONN}|%{POSTFIX_SMTPD_NOQUEUE}|%{POSTFIX_SMTPD_PIPELINING}|%{POSTFIX_TLSCONN}|%{POSTFIX_WARNING}|%{POSTFIX_SMTPD_PROXY}|%{POSTFIX_KEYVALUE}
126129
POSTFIX_CLEANUP %{POSTFIX_CLEANUP_MESSAGEID}|%{POSTFIX_CLEANUP_MILTER}|%{POSTFIX_CLEANUP_PREPEND}|%{POSTFIX_WARNING}|%{POSTFIX_KEYVALUE}

test/tls_features_0007.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
pattern: "^%{POSTFIX_TLS_FEATURES}$"
2+
data: "dane"
3+
results:
4+
postfix_tls_security_level: dane

test/tls_features_0008.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
pattern: "^%{POSTFIX_TLS_FEATURES}$"
2+
data: "dane:none"
3+
results:
4+
postfix_tls_security_level: dane
5+
postfix_tls_downgrade_level: none

test_pipeline.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,8 @@ CONTAINER_ID=$(docker run --rm --detach \
6363

6464
printf "Waiting for output from logstash "
6565
until test -s "$OUTPUT"; do
66+
# For debugging a crashing container (probably invalid configuration)
67+
# docker inspect "$CONTAINER_ID" | jq '.[0].State'
6668
printf "."
6769
sleep 2
6870
done

0 commit comments

Comments
 (0)