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