]> git.proxmox.com Git - pmg-docs.git/blame - pmg-mail-filter.adoc
add SSL ceriticate generation doc
[pmg-docs.git] / pmg-mail-filter.adoc
CommitLineData
62e86eb6
DM
1Mail Filter
2===========
3
4{pmg} ships with a highly configurable mail filter. It’s an easy but
5powerful way to define filter rules by user, domains, time frame,
6content type and resulting action.
7
8image::images/screenshot/pmg-gui-mail-filter-rules.png[]
9
c9d28a2b
DM
10Every rule has 5 categories ('FROM', 'TO', 'WHEN', 'WHAT' and
11'ACTION'), and each category may contain several objects to match
12certain criteria:
62e86eb6
DM
13
14WHO - objects::
15
c9d28a2b 16Who is the sender or receiver of the e-mail? Those objects can be used
62e86eb6
DM
17for the 'TO' and/or 'FROM' category.
18+
19====
20Example: EMail-object - Who is the sender or receiver of the e-mail?
21====
22
23WHAT - objects::
24
25What is in the e-mail?
26+
27====
c9d28a2b 28Example: Does the e-mail contain spam?
62e86eb6
DM
29====
30
31WHEN - objects::
32
33When is the e-mail received by {pmg}?
34+
35====
36Example: Office Hours - Mail is received between 8:00 and 16:00.
37====
38
39ACTIONS - objects::
40
41Defines the final actions.
42+
43====
44Example: Mark e-mail with “SPAM:” in the subject.
45====
c9d28a2b
DM
46
47Rules are ordered by priority, so rules with higher priority are
48executed first. It is also possible to set a processing direction:
49
50'In':: Rule applies for all incoming e-mails
51
52'Out':: Rule applies for all outgoing e-mails
53
54'In & Out':: Rule applies for both directions
55
56And you can also disable a rule completely, which is mostly useful for
57testing and debugging. The 'Factory Defaults' button alows you to
58reset the filter rules.
59
60
61Actions
62-------
63
64image::images/screenshot/pmg-gui-mail-filter-actions.png[]
65
66Please note that some actions stops further rule precessing. We call
67such actions 'final'.
68
69Accept
70~~~~~~
71
72Accept mail for Delivery. This is a 'final' action.
73
74
75Block
76~~~~~
77
78Block mail. This is a 'final' action.
79
80
81Quarantine
82~~~~~~~~~~
83
84Move to quarantine (virus mails are moved to the “virus quarantine”,
85other mails are moved to “spam quarantine”). This is also a 'final' action.
86
87
88Notification
89~~~~~~~~~~~~
90
91Send notifications. Please note that object configuration can use
92xref:rule_system_macros[macros], so it is easy to include additional
93information. For example, the default 'Notify Admin' object sends the
94following information:
95
96.Sample notification action body:
97----
98Proxmox Notification:
99Sender: __SENDER__
100Receiver: __RECEIVERS__
101Targets: __TARGETS__
102Subject: __SUBJECT__
103Matching Rule: __RULE__
104
105__RULE_INFO__
106
107__VIRUS_INFO__
108__SPAM_INFO__
109----
110
111Notification can also include a copy of the original mail.
112
113
114Blind Carbon Copy (BCC)
115~~~~~~~~~~~~~~~~~~~~~~~
116
117The BCC object simply sends a copy to another target. It is possible to
118send the original unmodified mail, or the processed result. Please
119note that this can be quite different, i.e. when a previous rule
120removed attachments.
121
122
123Header Attributes
124~~~~~~~~~~~~~~~~~
125
126This object is able to add or modify mail header attributes. As notice above, you can use xref:rule_system_macros[macros], making this a very powerful object. For example, the 'Modify Spam Level' actions adds detailed infomation about detected Spam characteristics to the ` X-SPAM-LEVEL` header.
127
733e5b36 128.'Modify Spam Level' Header Attribute
c9d28a2b
DM
129----
130Field: X-SPAM-LEVEL
131Value: __SPAM_INFO__
132----
133
134Another prominent example is the 'Modify Spam Subject' action. This
135simply adds the 'SPAM:' prefix to the original mail subject:
136
733e5b36 137.'Modify Spam Subject' Header Attribute
c9d28a2b
DM
138----
139Field: subject
140Value: SPAM: __SUBJECT__
141----
142
143
144Remove attachments
145~~~~~~~~~~~~~~~~~~
146
147Remove attachments can either remove all attachments, or only those
148matched by the rules 'WHAT' object. You can also specify the
149replacement text if you want.
150
151
152Disclaimer
153~~~~~~~~~~
154
155Add a Disclaimer.
66b48b3a
DM
156
157
158WHO - objects
159-------------
160
161image::images/screenshot/pmg-gui-mail-filter-who-objects.png[]
162
163This type of objects can be used for the 'TO' and/or 'FROM' category,
164and macth the sender or receiver of the e-mail. A single object can
165combine multiple items, and the following item types are available:
166
167EMail::
168
169Allows you to match a single mail address.
170
171Domain::
172
173Only match the domain part of the mail address.
174
175Regular Expression::
176
177This one uses a regular expression to match the whole mail address.
178
179IP Address or Network::
180
181This can be used to match the senders IP address.
182
183LDAP User or Group::
184
185Test if the mail address belong to a specific LDAP user or group.
186
187We have two important WHO objects called 'Blacklist' and
188'Whitelist'. Those are used in the default ruleset to globally block
3228913a
DM
189or allow specific senders.
190
40ed107a
DM
191
192WHAT - objects
193--------------
194
195image::images/screenshot/pmg-gui-mail-filter-what-objects.png[]
196
197WHAT - objects are used to classify the mail content. A single object
198can combine multiple items, and the following item types are
199available:
200
201Spam Filter::
202
203Matches if configured value if greater than the detected spam level.
204
205Virus Filter::
206
207Matches on infected mails.
208
fc900299
DM
209Match Field::
210
211Match specified mail header fields (eg. `Subject:`, `From:`, ...)
212
40ed107a
DM
213Content Type Filter::
214
215Can be used to match specific content types.
216
217Match Filename::
218
219Uses regular expressions to match attachment filenames.
220
221Archive Filter::
222
223Can be used to match specific content types inside archives.
224
225
3228913a
DM
226WHEN - objects
227--------------
228
229image::images/screenshot/pmg-gui-mail-filter-when-objects.png[]
230
231WHEN - objects are use to activate rules at specific daytimes. You can compose
232them of one or more time-frame items.
233
234The default ruleset defines 'Office Hours', but this is not used by
235the default rules.
99fd4bd4
DM
236
237
238Using regular expressions
239-------------------------
240
241A regular expression is a string of characters which tells us which
242string you are looking for. The following is a short introduction in
243the syntax of regular expressions used by some objects. If you are
244familiar with Perl, you already know the syntax.
245
246Simple regular expressions
247~~~~~~~~~~~~~~~~~~~~~~~~~~
248
249In its simplest form, a regular expression is just a word or phrase to
250search for. `Mail` would match the string "Mail". The search is case
251sensitive so "MAIL", "Mail", "mail" would not be matched.
252
253Metacharacters
254~~~~~~~~~~~~~~
255
256Some characters have a special meaning. These characters are called
257metacharacters. The Period (`.`) is a commonly used metacharacter. It
258matches exactly one character, regardless of what the character is.
259`e.mail` would match either "e-mail" or "e-mail" or "e2mail" but not
260"e-some-mail".
261
262The question mark (`?`) indicates that the character immediately
263preceding it either zero or one time. `e?mail` would match
264either "email" or "mail" but not "e-mail".
265
266Another metacharacter is the star (`*`). This indicates that the
267character immediately to its left may repeated any number of times,
268including zero. `e*mail` would match either "email" or "mail" or
269"eeemail".
270
271The plus (`+`) metacharacter does the same as the star (*) excluding
272zero. So `e+mail` does not match "mail".
273
274Metacharacters may be combined. A common combination includes the
275period and star metacharacters (`.*`), with the star immediately following
276the period. This is used to match an arbitrary string of any length,
277including the null string. For example: `.*company.*` matches
278"company@domain.com" or "company@domain.co.uk" or
279"department.company@domain.com".
0601bef2
DM
280
281The book xref:Friedl97[] provides a more comprehensive introduction.