From 54d62954cc6c7c2305fedbc7e5dee2ab91884dff Mon Sep 17 00:00:00 2001 From: Zhang Huangbin Date: Fri, 15 Sep 2023 10:04:34 +0800 Subject: [PATCH] Add missing macros. --- cmd/log-milter/milter.go | 7 ++++++ macro.go | 49 +++++++++++++++++++++++----------------- 2 files changed, 35 insertions(+), 21 deletions(-) diff --git a/cmd/log-milter/milter.go b/cmd/log-milter/milter.go index 41ed8e7..cdfdd46 100644 --- a/cmd/log-milter/milter.go +++ b/cmd/log-milter/milter.go @@ -95,6 +95,8 @@ func (l *LogMilter) outputChangedMacros(m *milter.Modifier) { milter.MacroMTAVersion, milter.MacroMTAFQDN, milter.MacroDaemonName, + milter.MacroDaemonAddr, + milter.MacroDaemonPort, milter.MacroIfName, milter.MacroIfAddr, milter.MacroTlsVersion, @@ -102,6 +104,11 @@ func (l *LogMilter) outputChangedMacros(m *milter.Modifier) { milter.MacroCipherBits, milter.MacroCertSubject, milter.MacroCertIssuer, + milter.MacroClientAddr, + milter.MacroClientPort, + milter.MacroClientName, + milter.MacroClientPTR, + milter.MacroClientConnections, milter.MacroQueueId, milter.MacroAuthType, milter.MacroAuthAuthen, diff --git a/macro.go b/macro.go index ce3b508..64a0c61 100644 --- a/macro.go +++ b/macro.go @@ -26,27 +26,34 @@ type MacroName = string // Macros that have good support between MTAs like sendmail and Postfix const ( - MacroMTAVersion MacroName = "v" // MTA Version (and MTA name in case of Postfix) - MacroMTAFQDN MacroName = "j" // MTA fully qualified domain name - MacroDaemonName MacroName = "{daemon_name}" // name of the daemon of the MTA. E.g. MTA-v4 or smtpd or anything the user configured. - MacroIfName MacroName = "{if_name}" // Interface name of the interface the MTA is accepting the SMTP connection - MacroIfAddr MacroName = "{if_addr}" // IP address of the interface the MTA is accepting the SMTP connection - MacroTlsVersion MacroName = "{tls_version}" // TLS version in use (set after STARTTLS or when SMTPS is used) - MacroCipher MacroName = "{cipher}" // Cipher suite used (set after STARTTLS or when SMTPS is used) - MacroCipherBits MacroName = "{cipher_bits}" // Strength of the cipher suite in bits (set after STARTTLS or when SMTPS is used) - MacroCertSubject MacroName = "{cert_subject}" // Validated client cert's subject information (only when mutual TLS is in use) - MacroCertIssuer MacroName = "{cert_issuer}" // Validated client cert's issuer information (only when mutual TLS is in use) - MacroQueueId MacroName = "i" // The queue ID for this message. Some MTAs only assign a Queue ID after the DATA command (Postfix) - MacroAuthType MacroName = "{auth_type}" // The used authentication method (LOGIN, DIGEST-MD5, etc) - MacroAuthAuthen MacroName = "{auth_authen}" // The username of the authenticated user - MacroAuthSsf MacroName = "{auth_ssf}" // The key length (in bits) of the used encryption layer (TLS) – if any - MacroAuthAuthor MacroName = "{auth_author}" // The optional overwrite username for this message - MacroMailMailer MacroName = "{mail_mailer}" // the delivery agent for this MAIL FROM (e.g. esmtp, lmtp) - MacroMailHost MacroName = "{mail_host}" // the domain part of the MAIL FROM address - MacroMailAddr MacroName = "{mail_addr}" // the MAIL FROM address (only the address without <>) - MacroRcptMailer MacroName = "{rcpt_mailer}" // MacroRcptMailer holds the delivery agent for the current RCPT TO address - MacroRcptHost MacroName = "{rcpt_host}" // The domain part of the RCPT TO address - MacroRcptAddr MacroName = "{rcpt_addr}" // the RCPT TO address (only the address without <>) + MacroMTAVersion MacroName = "v" // MTA Version (and MTA name in case of Postfix) + MacroMTAFQDN MacroName = "j" // MTA fully qualified domain name + MacroDaemonName MacroName = "{daemon_name}" // name of the daemon of the MTA. E.g. MTA-v4 or smtpd or anything the user configured. + MacroDaemonAddr MacroName = "{daemon_addr}" // Local server IP address + MacroDaemonPort MacroName = "{daemon_port}" // Local server TCP port + MacroIfName MacroName = "{if_name}" // Interface name of the interface the MTA is accepting the SMTP connection + MacroIfAddr MacroName = "{if_addr}" // IP address of the interface the MTA is accepting the SMTP connection + MacroTlsVersion MacroName = "{tls_version}" // TLS version in use (set after STARTTLS or when SMTPS is used) + MacroCipher MacroName = "{cipher}" // Cipher suite used (set after STARTTLS or when SMTPS is used) + MacroCipherBits MacroName = "{cipher_bits}" // Strength of the cipher suite in bits (set after STARTTLS or when SMTPS is used) + MacroCertSubject MacroName = "{cert_subject}" // Validated client cert's subject information (only when mutual TLS is in use) + MacroCertIssuer MacroName = "{cert_issuer}" // Validated client cert's issuer information (only when mutual TLS is in use) + MacroClientAddr MacroName = "{client_addr}" // Remote client IP address + MacroClientPort MacroName = "{client_port}" // Remote client TCP port + MacroClientPTR MacroName = "{client_ptr}" // Client name from address → name lookup + MacroClientName MacroName = "{client_name}" // Remote client hostname + MacroClientConnections MacroName = "{client_connections}" // Connection concurrency for this client + MacroQueueId MacroName = "i" // The queue ID for this message. Some MTAs only assign a Queue ID after the DATA command (Postfix) + MacroAuthType MacroName = "{auth_type}" // The used authentication method (LOGIN, DIGEST-MD5, etc) + MacroAuthAuthen MacroName = "{auth_authen}" // The username of the authenticated user + MacroAuthSsf MacroName = "{auth_ssf}" // The key length (in bits) of the used encryption layer (TLS) – if any + MacroAuthAuthor MacroName = "{auth_author}" // The optional overwrite username for this message + MacroMailMailer MacroName = "{mail_mailer}" // the delivery agent for this MAIL FROM (e.g. esmtp, lmtp) + MacroMailHost MacroName = "{mail_host}" // the domain part of the MAIL FROM address + MacroMailAddr MacroName = "{mail_addr}" // the MAIL FROM address (only the address without <>) + MacroRcptMailer MacroName = "{rcpt_mailer}" // MacroRcptMailer holds the delivery agent for the current RCPT TO address + MacroRcptHost MacroName = "{rcpt_host}" // The domain part of the RCPT TO address + MacroRcptAddr MacroName = "{rcpt_addr}" // the RCPT TO address (only the address without <>) ) // Macros that do not have good cross-MTA support. Only usable with sendmail as MTA.