Browse Source

[Rspamd] Add X-Last-TLS-Session-Version header

andryyy 5 years ago
parent
commit
9d04d0ee4a
1 changed files with 20 additions and 0 deletions
  1. 20 0
      data/conf/rspamd/lua/rspamd.local.lua

+ 20 - 0
data/conf/rspamd/lua/rspamd.local.lua

@@ -7,6 +7,7 @@ rspamd_config.MAILCOW_AUTH = {
 	end
 }
 
+
 rspamd_config:register_symbol({
   name = 'KEEP_SPAM',
   type = 'prefilter',
@@ -69,6 +70,25 @@ rspamd_config:register_symbol({
   priority = 19
 })
 
+rspamd_config:register_symbol({
+  name = 'TLS_HEADER',
+  type = 'postfilter',
+  callback = function(task)
+    local rspamd_logger = require "rspamd_logger"
+    local tls_tag = task:get_request_header('TLS-Version')
+    if type(tls_tag) == 'nil' then
+      task:set_milter_reply({
+        add_headers = {['X-Last-TLS-Session-Version'] = 'None'}
+      })
+    else
+      task:set_milter_reply({
+        add_headers = {['X-Last-TLS-Session-Version'] = tostring(tls_tag)}
+      })
+    end
+  end,
+  priority = 12
+})
+
 rspamd_config:register_symbol({
   name = 'TAG_MOO',
   type = 'postfilter',