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