Include auth status in Received header
This commit is contained in:
parent
0c9d7c2214
commit
f73a9cf2f7
6 changed files with 15 additions and 14 deletions
|
@ -6,8 +6,9 @@
|
||||||
(instead of any executable named `spamc` in the search path). To customise
|
(instead of any executable named `spamc` in the search path). To customise
|
||||||
this, set the environment variable `SPAMASSASSIN_MILTER_SPAMC` to the
|
this, set the environment variable `SPAMASSASSIN_MILTER_SPAMC` to the
|
||||||
desired path when building the application.
|
desired path when building the application.
|
||||||
* Revise header rewriting logic. Placement of `X-Spam-` headers now more
|
* Revise header rewriting logic. Handling and placement of `X-Spam-` headers
|
||||||
accurately mirrors that received from SpamAssassin.
|
now more accurately mirrors that applied by SpamAssassin.
|
||||||
|
* Include authentication status in information passed on to SpamAssassin.
|
||||||
* Update dependencies.
|
* Update dependencies.
|
||||||
|
|
||||||
## 0.1.6 (2021-05-17)
|
## 0.1.6 (2021-05-17)
|
||||||
|
|
6
Cargo.lock
generated
6
Cargo.lock
generated
|
@ -1,5 +1,7 @@
|
||||||
# This file is automatically @generated by Cargo.
|
# This file is automatically @generated by Cargo.
|
||||||
# It is not intended for manual editing.
|
# It is not intended for manual editing.
|
||||||
|
version = 3
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "ansi_term"
|
name = "ansi_term"
|
||||||
version = "0.11.0"
|
version = "0.11.0"
|
||||||
|
@ -77,9 +79,9 @@ checksum = "68f2d64f2edebec4ce84ad108148e67e1064789bee435edc5b60ad398714a3a9"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "libc"
|
name = "libc"
|
||||||
version = "0.2.98"
|
version = "0.2.99"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "320cfe77175da3a483efed4bc0adc1968ca050b098ce4f2f1c13a56626128790"
|
checksum = "a7f823d141fe0a24df1e23b4af4e3c7ba9e5966ec514ea068c93024aa7deb765"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "milter"
|
name = "milter"
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
[package]
|
[package]
|
||||||
name = "spamassassin-milter"
|
name = "spamassassin-milter"
|
||||||
version = "0.1.6" # remember to update html_root_url and VERSION
|
version = "0.1.6"
|
||||||
edition = "2018"
|
edition = "2018"
|
||||||
description = "Milter for spam filtering with SpamAssassin"
|
description = "Milter for spam filtering with SpamAssassin"
|
||||||
license = "GPL-3.0-or-later"
|
license = "GPL-3.0-or-later"
|
||||||
|
|
|
@ -55,10 +55,7 @@ fn handle_negotiate(
|
||||||
|
|
||||||
context.api.request_macros(Stage::Connect, "")?;
|
context.api.request_macros(Stage::Connect, "")?;
|
||||||
context.api.request_macros(Stage::Helo, "")?;
|
context.api.request_macros(Stage::Helo, "")?;
|
||||||
context.api.request_macros(
|
context.api.request_macros(Stage::Mail, "{auth_authen}")?;
|
||||||
Stage::Mail,
|
|
||||||
if config::get().auth_untrusted() { "" } else { "{auth_authen}" },
|
|
||||||
)?;
|
|
||||||
context.api.request_macros(Stage::Rcpt, "")?;
|
context.api.request_macros(Stage::Rcpt, "")?;
|
||||||
context.api.request_macros(Stage::Data, "i j _ {tls_version} v")?;
|
context.api.request_macros(Stage::Data, "i j _ {tls_version} v")?;
|
||||||
context.api.request_macros(Stage::Eoh, "")?;
|
context.api.request_macros(Stage::Eoh, "")?;
|
||||||
|
@ -157,6 +154,7 @@ fn handle_data(mut context: Context) -> milter::Result<Status> {
|
||||||
.and_then(|v| v.split_ascii_whitespace().next())
|
.and_then(|v| v.split_ascii_whitespace().next())
|
||||||
.unwrap_or("Postfix"),
|
.unwrap_or("Postfix"),
|
||||||
context.api.macro_value("{tls_version}")?.is_some(),
|
context.api.macro_value("{tls_version}")?.is_some(),
|
||||||
|
context.api.macro_value("{auth_authen}")?.is_some(),
|
||||||
id,
|
id,
|
||||||
&Local::now().to_rfc2822(),
|
&Local::now().to_rfc2822(),
|
||||||
)?;
|
)?;
|
||||||
|
|
|
@ -179,19 +179,21 @@ impl Client {
|
||||||
my_hostname: &str,
|
my_hostname: &str,
|
||||||
mta: &str,
|
mta: &str,
|
||||||
tls: bool,
|
tls: bool,
|
||||||
|
auth: bool,
|
||||||
queue_id: &str,
|
queue_id: &str,
|
||||||
date_time: &str,
|
date_time: &str,
|
||||||
) -> Result<()> {
|
) -> Result<()> {
|
||||||
let buf = format!(
|
let buf = format!(
|
||||||
"Received: from {helo} ({client})\r\n\
|
"Received: from {helo} ({client})\r\n\
|
||||||
\tby {hostname} ({mta}) with {proto} id {id};\r\n\
|
\tby {hostname} ({mta}) with ESMTP{tls}{auth} id {id};\r\n\
|
||||||
\t{date_time}\r\n\
|
\t{date_time}\r\n\
|
||||||
\t(envelope-from {sender})\r\n",
|
\t(envelope-from {sender})\r\n",
|
||||||
helo = helo_host,
|
helo = helo_host,
|
||||||
client = client_name_addr,
|
client = client_name_addr,
|
||||||
hostname = my_hostname,
|
hostname = my_hostname,
|
||||||
mta = mta,
|
mta = mta,
|
||||||
proto = if tls { "ESMTPS" } else { "ESMTP" },
|
tls = if tls { "S" } else { "" },
|
||||||
|
auth = if auth { "A" } else { "" },
|
||||||
id = queue_id,
|
id = queue_id,
|
||||||
date_time = date_time,
|
date_time = date_time,
|
||||||
sender = self.sender
|
sender = self.sender
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
//! The SpamAssassin Milter application library.
|
//! The SpamAssassin Milter application library.
|
||||||
|
|
||||||
#![doc(html_root_url = "https://docs.rs/spamassassin-milter/0.1.6")]
|
|
||||||
|
|
||||||
macro_rules! verbose {
|
macro_rules! verbose {
|
||||||
($config:ident, $($arg:tt)*) => {
|
($config:ident, $($arg:tt)*) => {
|
||||||
if $config.verbose() {
|
if $config.verbose() {
|
||||||
|
@ -30,7 +28,7 @@ use milter::Milter;
|
||||||
pub const MILTER_NAME: &str = "SpamAssassin Milter";
|
pub const MILTER_NAME: &str = "SpamAssassin Milter";
|
||||||
|
|
||||||
/// The current version string of SpamAssassin Milter.
|
/// The current version string of SpamAssassin Milter.
|
||||||
pub const VERSION: &str = "0.1.6";
|
pub const VERSION: &str = env!("CARGO_PKG_VERSION");
|
||||||
|
|
||||||
/// Starts SpamAssassin Milter listening on the given socket using the supplied
|
/// Starts SpamAssassin Milter listening on the given socket using the supplied
|
||||||
/// configuration.
|
/// configuration.
|
||||||
|
|
Loading…
Reference in a new issue