Skip to content

Commit 64fb31e

Browse files
committed
WIP Parse the contents of the postfix_tls field into specifics
1 parent 25934f5 commit 64fb31e

File tree

5 files changed

+28
-2
lines changed

5 files changed

+28
-2
lines changed

50-filter-postfix.conf

Lines changed: 13 additions & 2 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
@@ -289,6 +297,9 @@ filter {
289297
"postfix_delay_transmission", "float",
290298
"postfix_postscreen_violation_time", "float"
291299
]
292-
}
300+
gsub => [
301+
# rewrite some extracted values
302+
"postfix_tls_policy_undecided", "\?", "true"
303+
]
304+
}
293305
}
294-

postfix.grok

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,10 @@ 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_POLICY_UNDECIDED \?
126+
POSTFIX_TLS_FEATURES %{STATUS_WORD:postfix_tls_security_level}(:%{STATUS_WORD:postfix_tls_downgrade_level})?(%{POSTFIX_TLS_POLICY_UNDECIDED:postfix_tls_policy_undecided})?
127+
124128
# aggregate all patterns
125129
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}
126130
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)