summaryrefslogtreecommitdiffstats
path: root/contrib/exim/dlfunc-json/exim-example.txt
blob: e6da3346fa150cfbd773875407521b4de2b7a5f0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
acl_smtp_data = acl_check_data

.....

acl_check_data:

.....

# RSPAMD: START
	warn
		!authenticated = *
		add_header = X-Spam-Checker-Version: Rspamd
		add_header = :at_start:Authentication-Results: ip=$sender_host_address:$sender_host_port, host=$sender_host_name, helo=$sender_helo_name, mailfrom=$sender_address
	warn
		#spam = nobody:true
		#set acl_m0_rspamd = $spam_report
		set acl_m0_rspamd	= ${dlfunc{/usr/local/libexec/exim/exim-rspamd-http-dlfunc.so}{rspamd}{/var/run/rspamd/rspamd.sock}{defer_ok}}
	accept
		authenticated = *
	warn
		condition	= ${if eq{$acl_m0_rspamd}{}}
		logwrite	= RSPAMD check failed
		add_header	= X-Spam-Info: Check failed
	warn
		condition	= ${if match{$acl_m0_rspamd}{\N^rspamd dlfunc:\s*\N}{yes}{no}}
		logwrite	= RSPAMD check defer: ${sg{$acl_m0_rspamd}{\N^rspamd dlfunc:\s*\N}{}}
		add_header	= X-Spam-Info: Check deffered

	warn
		remove_header  = X-Spam-Checker-Version:X-Spam-Status:X-Spam-Info:X-Spam-Result
		set acl_m1 = No
	warn
		condition	= ${if !eq{$acl_m0_rspamd}{}}
		set acl_m1_yesno	= ${if match{$acl_m0_rspamd}{\NAction: (.+?)\n\N}{$1}{}}
		set acl_m2_status = ${if eq{$acl_m1_yesno}{reject}{REJECT}{\
								${if eq{$acl_m1_yesno}{add header}{PROBABLY}{\
									${if eq{$acl_m1_yesno}{rewrite subject}{PROBABLY}{\
										${if eq{$acl_m1_yesno}{soft reject}{SOFT}{\
											${if eq{$acl_m1_yesno}{greylist}{GREYLIST}{NO}}\
										}}\
									}}\
								}}\
							}}
		set acl_m1_yesno	=	${if eq{$acl_m1_yesno}{}{unknown}{\
							${if eq{$acl_m1_yesno}{reject}{Yes}{\
								${if eq{$acl_m1_yesno}{add header}{Yes}{\
									${if eq{$acl_m1_yesno}{rewrite subject}{Yes}{\
										${if eq{$acl_m1_yesno}{soft reject}{Probably}{\
											${if eq{$acl_m1_yesno}{greylist}{Probably}{No}}\
										}}\
									}}\
								}}\
							}}\
						}}
		#logwrite	= RSPAMD: status: $acl_m2_status
		#logwrite	= RSPAMD DEBUG: $acl_m0_rspamd
		set acl_m0_rspamd	= ${sg{$acl_m0_rspamd}{ Action:.+\n}{}}
	warn
		condition	= ${if !eq{$acl_m0_rspamd}{}}
		logwrite	= RSPAMD: $acl_m2_status, $acl_m0_rspamd
		add_header	= X-Spam-Result: $acl_m0_rspamd
		add_header	= X-Spam-Status: $acl_m1_yesno
	defer
        condition	= ${if eq{$acl_m2_status}{GREYLIST}}
		log_message = Rspamd $acl_m2_status
        message = Try again later. Message greylisted
	defer
        condition	= ${if eq{$acl_m2_status}{SOFT}}
		log_message = Rspamd $acl_m2_status
        message = Try again later. Message previously greylisted
	deny
		condition	= ${if eq{$acl_m2_status}{REJECT}}
		log_message = Rspamd $acl_m2_status
		message = This message detected as SPAM and rejected
# RSPAMD: END