1 /* Copyright (C) 2009 Trend Micro Inc.
4 * This program is a free software; you can redistribute it
5 * and/or modify it under the terms of the GNU General Public
6 * License (version 2) as published by the FSF - Free Software
13 #define MAIL_LIST_SIZE 96 /* Max number of emails to be saved */
14 #define MAXCHILDPROCESS 6 /* Maximum simultaneous children */
16 /* Each timeout is x * 5 */
17 #define NEXTMAIL_TIMEOUT 2 /* Time to check for next msg - 5 */
18 #define DEFAULT_TIMEOUT 18 /* socket read timeout - 18 (*5)*/
19 #define SUBJECT_SIZE 128 /* Maximum subject size */
21 /* Maximum body size */
22 #define BODY_SIZE OS_MAXSTR + OS_SIZE_1024
24 #define SMS_SUBJECT "OSSEC %d - %d - %s"
25 #define MAIL_SUBJECT "OSSEC Notification - %s - Alert level %d"
26 #define MAIL_SUBJECT_FULL "OSSEC Alert - %s - Level %d - %s"
28 /* Full subject without ossec in the name */
30 #define MAIL_SUBJECT_FULL2 "%d - %s - %s"
33 #ifdef LIBGEOIP_ENABLED
34 #define MAIL_BODY "\r\nOSSEC HIDS Notification.\r\n" \
36 "Received From: %s\r\n" \
37 "Rule: %d fired (level %d) -> \"%s\"\r\n" \
41 "Portion of the log(s):\r\n\r\n%s\r\n" \
42 "\r\n\r\n --END OF NOTIFICATION\r\n\r\n\r\n"
44 #define MAIL_BODY "\r\nOSSEC HIDS Notification.\r\n" \
46 "Received From: %s\r\n" \
47 "Rule: %d fired (level %d) -> \"%s\"\r\n" \
49 "Portion of the log(s):\r\n\r\n%s\r\n" \
50 "\r\n\r\n --END OF NOTIFICATION\r\n\r\n\r\n"
53 /* Mail msg structure */
54 typedef struct _MailMsg {
60 #include "config/mail-config.h"
63 int MailConf(int test_config, const char *cfgfile, MailConfig *Mail) __attribute__((nonnull));
65 /* Receive the e-mail message */
66 MailMsg *OS_RecvMailQ(file_queue *fileq, struct tm *p, MailConfig *mail,
67 MailMsg **msg_sms) __attribute__((nonnull));
70 int OS_Sendmail(MailConfig *mail, struct tm *p) __attribute__((nonnull));
71 int OS_SendCustomEmail(char **to, char *subject, char *smtpserver, char *from, char *idsname, char *fname, const struct tm *p);
73 /* Mail timeout used by the file-queue */
74 extern unsigned int mail_timeout;
76 /* Global var for highest level on mail subjects */
77 extern unsigned int _g_subject_level;
78 extern char _g_subject[SUBJECT_SIZE + 2];