summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/libserver/milter.c11
-rw-r--r--src/libserver/milter.h1
-rw-r--r--src/rspamd_proxy.c11
3 files changed, 21 insertions, 2 deletions
diff --git a/src/libserver/milter.c b/src/libserver/milter.c
index fca4d44fb..3a3f9af14 100644
--- a/src/libserver/milter.c
+++ b/src/libserver/milter.c
@@ -1787,8 +1787,15 @@ rspamd_milter_send_task_results (struct rspamd_milter_session *session,
sizeof (RSPAMD_MILTER_XCODE_REJECT) - 1);
if (!reply) {
- reply = rspamd_fstring_new_init (RSPAMD_MILTER_REJECT_MESSAGE,
- sizeof (RSPAMD_MILTER_REJECT_MESSAGE) - 1);
+ if (milter_ctx->reject_message == NULL) {
+ reply = rspamd_fstring_new_init (
+ RSPAMD_MILTER_REJECT_MESSAGE,
+ sizeof (RSPAMD_MILTER_REJECT_MESSAGE) - 1);
+ }
+ else {
+ reply = rspamd_fstring_new_init (milter_ctx->reject_message,
+ strlen (milter_ctx->reject_message));
+ }
}
rspamd_milter_set_reply (session, rcode, xcode, reply);
diff --git a/src/libserver/milter.h b/src/libserver/milter.h
index 131843755..35dc8f908 100644
--- a/src/libserver/milter.h
+++ b/src/libserver/milter.h
@@ -47,6 +47,7 @@ struct rspamd_http_message;
struct rspamd_milter_context {
const gchar *spam_header;
const gchar *client_ca_name;
+ const gchar *reject_message;
void *sessions_cache;
gboolean discard_on_reject;
gboolean quarantine_on_reject;
diff --git a/src/rspamd_proxy.c b/src/rspamd_proxy.c
index 47dbf606d..fc4b43bea 100644
--- a/src/rspamd_proxy.c
+++ b/src/rspamd_proxy.c
@@ -150,6 +150,8 @@ struct rspamd_proxy_ctx {
gchar *spam_header;
/* CA name that can be used for client certificates */
gchar *client_ca_name;
+ /* Milter rejection message */
+ gchar *reject_message;
/* Sessions cache */
void *sessions_cache;
struct rspamd_milter_context milter_ctx;
@@ -848,6 +850,14 @@ init_rspamd_proxy (struct rspamd_config *cfg)
G_STRUCT_OFFSET (struct rspamd_proxy_ctx, client_ca_name),
0,
"Allow certificates issued by this CA to be treated as client certificates");
+ rspamd_rcl_register_worker_option (cfg,
+ type,
+ "reject_message",
+ rspamd_rcl_parse_struct_string,
+ ctx,
+ G_STRUCT_OFFSET (struct rspamd_proxy_ctx, reject_message),
+ 0,
+ "Use custom rejection message");
return ctx;
}
@@ -2179,6 +2189,7 @@ start_rspamd_proxy (struct rspamd_worker *worker) {
ctx->milter_ctx.quarantine_on_reject = ctx->quarantine_on_reject;
ctx->milter_ctx.sessions_cache = ctx->sessions_cache;
ctx->milter_ctx.client_ca_name = ctx->client_ca_name;
+ ctx->milter_ctx.reject_message = ctx->reject_message;
rspamd_milter_init_library (&ctx->milter_ctx);
rspamd_lua_run_postloads (ctx->cfg->lua_state, ctx->cfg, ctx->ev_base,