All Classes Files Functions Variables Enumerations Enumerator Groups Pages
Content.idl
Go to the documentation of this file.
1  /**
2  * @file Content.idl
3  * @brief Set Spam Filter, Antivirus Settings, Attachment Filter.
4  *
5  * @author Dusan Juhas
6  *
7  * @copyright Copyright © 2011-2012 Kerio Technologies s.r.o.
8  */
9 
10 #import <kerio/web/idl/SharedStructures.idl>
11 #import <AdminStructures.idl> //DistanceOrNull
12 
13 module kerio {
14 module jsonapi {
15 module admin {
16 
17 enum AttachmentAction {
18  Block,
19  Accept
20 };
21 
22 enum AttachmentType {
23  FileName,
24  MimeType
25 };
26 
27 /**
28  * Attachment filter rule item
29  */
31  kerio::web::KId id;
32  boolean enabled; ///< the rule is in use
33  AttachmentType type; ///< type of the rule
34  string content; ///< *,? wildcards are supported
35  AttachmentAction action; ///< what to do if the rule maches
36  string description; ///<
37 };
38 
39 typedef sequence<AttachmentItem> AttachmentItemList;
40 
41 /**
42  * Attachment filter settings
43  */
45  boolean enabled; ///< attachment filter is on/off
46  boolean warnSender; ///< sender will (not) obtain warning message
47  kerio::web::OptionalString forwardOriginal; ///< where to forward original message
48  kerio::web::OptionalString forwardFiltered; ///< where to forward filtered message
49 };
50 
51 /**
52  * Note: fields name and content must be assigned if used in set methods
53  */
55  string name;
56  string content;
57  string defaultValue; ///< read only value
58 };
59 
60 typedef sequence<AntivirusOption> AntivirusOptionList;
61 
62 /**
63  * Note: field id must be assigned if used in set methods
64  */
66  string id; ///< example: avir_avg
67  string description; ///< example: AVG Email Server Edition
68  boolean areOptionsAvailable;
69  AntivirusOptionList options;
70 };
71 
72 typedef sequence<AntivirusPlugin> AntivirusPluginList;
73 
75  boolean checkForUpdates; ///< should we periodically ask for a new version?
76  long updatePeriod; ///< update checking period in hours
77  DistanceOrNull databaseAge; ///< how old is virus database
78  DistanceOrNull lastUpdateCheck; ///< how long is since last database update check
79  string databaseVersion; ///< virus database version
80  string engineVersion; ///< scanning engine version
81  boolean isPluginAvailable; ///< says if plugins dll is on hardrive
82  boolean isLiveProtectionEnabled;
83 };
84 
85 /**
86  * What to do with an infected file
87  */
88 enum ReactionOnVirus {
89  DiscardMessage, ///< completely dicard the message
90  RemoveVirus ///< deliver the message but remove malicious code
91 };
92 
93 /**
94  * What to do with a corrupted or encrypted file
95  */
96 enum ReactionOnNotScanned {
97  DeliverWithWarning, ///< deliver original message with prepended warning
98  SameAsVirus ///< the same reaction as for ReactionOnVirus
99 };
100 
101 /**
102  * Are all possible states covered
103  */
104 enum AntivirusStatus {
105  AntivirusOk, ///< no message is needed
106  NoAntivirus, ///< neither internal nor external antivirus is active
107  InternalFailure, ///< problem with internal intivirus
108  ExternalFailure, ///< problem with external intivirus
109  DoubleFailer ///< both internal and external antivirus has failed
110 };
111 
113  ReactionOnVirus reaction;
114  kerio::web::OptionalString forwardOriginal; ///< should be original message forwarded?
115  kerio::web::OptionalString forwardFiltered; ///< should be filtered message forwarded?
116 };
117 
119  boolean useIntegrated; ///< integrated antivirus is used?
120  boolean useExternal; ///< an external antivirus is used? note: both internal and extenal can be used together
121  AntivirusStatus status; ///< status of antivirus to be used for informative massage
122  AntivirusPluginList plugins; ///< list of available antivirus plugins
123  string selectedId; ///< identifier of currently selected antivirus plugin
124  IntegratedEngine engine; ///< integrated engine settings
125  FoundVirusBehavior virusReaction; ///< found virus reaction setting
126  ReactionOnNotScanned notScannedReaction; ///< found corruption or encryption reaction type
127 };
128 
129 enum UpdateStatus {
130  UpdateStarted,
131  UpdateFinished,
132  UpdateError,
133  UpdateDownloadIni,
134  UpdateDownloadData,
135  UpdateUpToDate
136 };
137 
139  UpdateStatus status; ///< state of update process
140  long percent; ///< percent of downloaded data
141 };
142 
143 enum BlockOrScore {
144  BlockMessage, ///< block the message
145  ScoreMessage ///< add SPAM score to the message
146 };
147 
148 /**
149  * Custom setting of blacklist spammer IP addresses
150  */
152  boolean enabled;
153  kerio::web::KId id; ///< global identifier
154  string name;
155  BlockOrScore action;
156  long score;
157 };
158 
159 enum SpamAction {
160  LogToSecurity, ///< only log to security log
161  BlockAction, ///< block the meassage
162  ScoreAction ///< increase spam score
163 };
164 
165 struct CallerId {
166  boolean enabled;
167  SpamAction action;
168  long score;
169  boolean applyOnTesting;
170  kerio::web::OptionalEntity exceptionIpGroup; ///< switchable custom white list IP group
171 };
172 
173 struct Spf {
174  boolean enabled;
175  SpamAction action;
176  long score;
177  kerio::web::OptionalEntity exceptionIpGroup; ///< switchable custom white list IP group
178 };
179 
180 struct Repellent {
181  boolean enabled;
182  long delay;
183  kerio::web::OptionalEntity customWhiteList; ///< switchable custom white list IP group
184  boolean reportToSecurity; ///< do (not) report a spam attack to security log
185 };
186 
187 enum BayesState {
188  Learning,
189  Active
190 };
191 
192 /**
193  * State of the Greylisting client.
194  */
195 enum GreylistingState {
196  GreylistingOff,
197  GreylistingOn,
198  GreylistingError ///< Greylisting encountered an error. Call Content.testGreylistConnection() for a more detailed error description.
199 };
200 
201 struct Greylisting {
202  boolean enabled; ///< is greylisting enabled?
203  /// When enabled is set to true, the setAntiSpamSetting method attempts to connect to the greylisting service asynchronously.
204  /// When enabled is set to false, connection to the greylisting service is closed.
205  kerio::web::OptionalEntity customWhiteList; ///< switchable custom whitelist IP group
206  GreylistingState state; ///< read only: current state
207  string messagesAccepted; ///< read only: messages accepted
208  string messagesDelayed; ///< read only: messages temoprarily rejected
209  string messagesSkipped; ///< read only: messages skipped
210 };
211 
213  boolean isRatingEnabled; ///< is spam filter rating enabled?
214  boolean isRatingRelayEnabled; ///< is rating of messages sent from trustworthy relay agents enabled?
215  long tagScore;
216  long blockScore;
217  kerio::web::OptionalString subjectPrefix; ///< SPAM is marked with this prefix
218  boolean sendBounce; ///< send bounce message to the sender of SPAM?
219  kerio::web::OptionalString quarantineAddress; ///< forward SPAM to a Quarantine address?
220  kerio::web::OptionalEntity customWhiteList; ///< switchable custom white list IP group
221  BlackListSetting customBlackList; ///< switchable custom blacklist list IP group
222  boolean sendBounceCustom; ///< send bounce message to the sender if rejection was done by custom rule(s)?
223  kerio::web::OptionalString quarantineAddressCustom; ///< forward custom rules identified SPAM to a Quarantine address?
224  boolean useSurbl; ///< use Spam URI Realtime Block List database?
225  BayesState filterStatus; ///< read only: Bayesian filter status
226  long learnedAsSpam; ///< read only: number of messages that Bayesian filter learned as Spam
227  long learnedAsNotSpam; ///< read only: number of messages that Bayesian filter learned as NOT a Spam
228  boolean isCustomSigningKey; ///< Custom signing key is used for DKIM validation
229  CallerId callerSetting; ///< Caller ID setting
230  string callerUrl; ///< read only: Caller ID URL with detailed info
231  Spf spfSetting; ///< Sender Policy Framework setting
232  Repellent repellentSetting;
233  Greylisting greylistingStatus;
234  boolean useCustomRulesInSmtp; ///<
235 };
236 
237 struct BlackList {
238  kerio::web::KId id; ///< global identifier
239  boolean enabled;
240  string dnsSuffix;
241  string description;
242  BlockOrScore action; ///< what to do if IP address is found on blacklist
243  long score;
244  boolean askDirectly;
245 };
246 
247 typedef sequence<BlackList> BlackListList;
248 
249 enum CustomRuleKind {
250  Header,
251  Body
252 };
253 
254 enum CustomRuleType {
255  IsEmpty,
256  IsMissing,
257  ContainsAddress,
258  ContainsDomain,
259  ContainsSubstring,
260  ContainsBinary
261 };
262 
263 enum CustomRuleAction {
264  TreatAsSpam,
265  TreatAsNotSpam,
266  IncreaseSpamScore
267 };
268 
269 struct CustomRule {
270  kerio::web::KId id; ///< global identifier
271  boolean enabled;
272  CustomRuleKind kind;
273  string header;
274  string content;
275  string description;
276  CustomRuleType type;
277  CustomRuleAction action;
278  long score;
279  DistanceOrNull lastUsed;
280 };
281 
282 typedef sequence<CustomRule> CustomRuleList;
283 
284 enum HourOrDay {
285  Hour,
286  Day
287 };
288 
289 interface Content {
290 
291  /**
292  * Add a blacklist item.
293  *
294  * @param errors - error message list
295  * @param items - array of new items
296  */
297  void addBlackLists(out kerio::web::ErrorList errors, in BlackListList items);
298 
299  /**
300  * Get antiSPAM settings.
301  *
302  * @param setting - new antivirus filter settings
303  */
304  void getAntiSpamSetting(out AntiSpamSetting setting);
305 
306  /**
307  * Get antivirus filter settings.
308  *
309  * @param setting - new antivirus filter settings
310  */
311  void getAntivirusSetting(out AntivirusSetting setting);
312 
313  /**
314  * Get a list of attachment filter rules.
315  *
316  * @param filterRules - attachment filter rules
317  */
318  void getAttachmentRules(out AttachmentItemList filterRules);
319 
320  /**
321  * Obtain attachment filter settings.
322  *
323  * @param setting - current attachment filter settings
324  */
325  void getAttachmentSetting(out AttachmentSetting setting);
326 
327  /**
328  * When adding a new attachment rule this can be used to find out available values.
329  *
330  * @param fileNames - list of available file names
331  * @param mimeTypes - list of available MIME types
332  */
333  void getAvailableAttachments(out kerio::web::StringList fileNames, out kerio::web::StringList mimeTypes);
334 
335  /**
336  * Obtain all blacklist items.
337  *
338  * @param list - blacklist items
339  */
340  void getBlackListList(out BlackListList list);
341 
342  /**
343  * Obtain all custom rules.
344  *
345  * @param list - custom rules
346  * @param totalItems - amount of rules for given search condition, useful when a limit is defined in search query
347  * @param query - condition and limit definition (orderBy is ignored)
348  */
349  void getCustomRuleList(out CustomRuleList list, out long totalItems, in kerio::web::SearchQuery query);
350 
351  /**
352  * Remove blacklist items.
353  *
354  * @param errors - error message list
355  * @param ids - identifier list of blacklists to be deleted
356  */
357  void removeBlackLists(out kerio::web::ErrorList errors, in kerio::web::KIdList ids);
358 
359  /**
360  * Remove custom rules which are not used for a specified time.
361  *
362  * @param number - how many hours/days is the rule unused
363  * @param unit - which unit is used to measure
364  */
365  void removeUnusedCustomRules(in long number, in HourOrDay unit);
366 
367  /**
368  * Set antiSPAM filter settings.
369  *
370  * @param setting - new antivirus filter settings
371  */
372  void setAntiSpamSetting(in AntiSpamSetting setting);
373 
374  /**
375  * Set antivirus filter settings.
376  *
377  * @param errors - error message; Value of inputIndex means type of antivirus (integrated = 0 and external = 1).
378  * @param setting - new antivirus filter settingss
379  */
380  void setAntivirusSetting(out kerio::web::ErrorList errors, in AntivirusSetting setting);
381 
382  /**
383  * Set list of attachment filter rules.
384  *
385  * @param filterRules - attachment filter rules
386  */
387  void setAttachmentRules(in AttachmentItemList filterRules);
388 
389  /**
390  * Set attachment filter settings.
391  *
392  * @param setting - new attachment filter settings
393  */
394  void setAttachmentSetting(in AttachmentSetting setting);
395 
396  /**
397  * Set blacklist item.
398  *
399  * @param errors - error message list
400  * @param ids - list of blacklist global identifier(s)
401  * @param pattern - pattern to use for new values
402  */
403  void setBlackLists(out kerio::web::ErrorList errors, in kerio::web::KIdList ids, in BlackList pattern);
404 
405  /**
406  * Set custom rules.
407  *
408  * @param list - custom rule records
409  */
410  void setCustomRuleList(in CustomRuleList list);
411 
412  /**
413  * Test connection to the greylisting service. Returns nothing if successful.
414  */
415  void testGreylistConnection();
416 
417  /**
418  * Get progress of antivirus updating.
419  *
420  * @param status - status of the update process
421  */
422  void updateAntivirusStatus(out IntegratedAvirUpdateStatus status);
423 
424  /**
425  * Force update of the integrated antivirus.
426  */
427  void updateIntegratedAntivirus();
428 };
429 
430 }; }; };//end of namespace