Skip to content

Commit

Permalink
Merge pull request #14 from iredmail/main
Browse files Browse the repository at this point in the history
Add missing macros.
  • Loading branch information
d--j committed Sep 15, 2023
2 parents f4e3ac5 + 54d6295 commit 30d4d62
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 21 deletions.
7 changes: 7 additions & 0 deletions cmd/log-milter/milter.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,13 +95,20 @@ func (l *LogMilter) outputChangedMacros(m *milter.Modifier) {
milter.MacroMTAVersion,
milter.MacroMTAFQDN,
milter.MacroDaemonName,
milter.MacroDaemonAddr,
milter.MacroDaemonPort,
milter.MacroIfName,
milter.MacroIfAddr,
milter.MacroTlsVersion,
milter.MacroCipher,
milter.MacroCipherBits,
milter.MacroCertSubject,
milter.MacroCertIssuer,
milter.MacroClientAddr,
milter.MacroClientPort,
milter.MacroClientName,
milter.MacroClientPTR,
milter.MacroClientConnections,
milter.MacroQueueId,
milter.MacroAuthType,
milter.MacroAuthAuthen,
Expand Down
49 changes: 28 additions & 21 deletions macro.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit 30d4d62

Please sign in to comment.