-
Notifications
You must be signed in to change notification settings - Fork 66
/
create.sql
310 lines (263 loc) · 11.3 KB
/
create.sql
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;
--
-- Database: `mailscanner`
--
CREATE DATABASE IF NOT EXISTS `mailscanner` DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci;
USE `mailscanner`;
-- --------------------------------------------------------
--
-- Table structure for table `audit_log`
--
CREATE TABLE IF NOT EXISTS `audit_log` (
`id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT,
`timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
`user` varchar(191) COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
`ip_address` varchar(45) COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
`action` text COLLATE utf8_unicode_ci NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
-- --------------------------------------------------------
--
-- Table structure for table `autorelease`
--
CREATE TABLE IF NOT EXISTS `autorelease` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`msg_id` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`uid` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
-- --------------------------------------------------------
--
-- Table structure for table `blacklist`
--
CREATE TABLE IF NOT EXISTS `blacklist` (
`id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT,
`to_address` text COLLATE utf8_unicode_ci,
`to_domain` text COLLATE utf8_unicode_ci,
`from_address` text COLLATE utf8_unicode_ci,
PRIMARY KEY (`id`),
UNIQUE KEY `blacklist_uniq` (`to_address`(100),`from_address`(100))
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
-- --------------------------------------------------------
--
-- Table structure for table `inq`
--
CREATE TABLE IF NOT EXISTS `inq` (
`inq_id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT,
`id` mediumtext COLLATE utf8_unicode_ci,
`cdate` date DEFAULT NULL,
`ctime` time DEFAULT NULL,
`from_address` mediumtext COLLATE utf8_unicode_ci,
`to_address` mediumtext COLLATE utf8_unicode_ci,
`subject` mediumtext COLLATE utf8_unicode_ci,
`message` mediumtext COLLATE utf8_unicode_ci,
`size` mediumtext COLLATE utf8_unicode_ci,
`priority` mediumtext COLLATE utf8_unicode_ci,
`attempts` mediumtext COLLATE utf8_unicode_ci,
`lastattempt` mediumtext COLLATE utf8_unicode_ci,
`hostname` mediumtext COLLATE utf8_unicode_ci,
PRIMARY KEY (`inq_id`),
KEY `inq_hostname` (`hostname`(50))
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
-- --------------------------------------------------------
--
-- Table structure for table `maillog`
--
CREATE TABLE IF NOT EXISTS `maillog` (
`maillog_id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT,
`timestamp` timestamp NULL,
`id` mediumtext COLLATE utf8_unicode_ci,
`size` bigint(20) DEFAULT '0',
`from_address` mediumtext COLLATE utf8_unicode_ci,
`from_domain` mediumtext COLLATE utf8_unicode_ci,
`to_address` mediumtext COLLATE utf8_unicode_ci,
`to_domain` mediumtext COLLATE utf8_unicode_ci,
`subject` mediumtext COLLATE utf8_unicode_ci,
`clientip` mediumtext COLLATE utf8_unicode_ci,
`archive` mediumtext COLLATE utf8_unicode_ci,
`isspam` tinyint(1) DEFAULT '0',
`ishighspam` tinyint(1) DEFAULT '0',
`issaspam` tinyint(1) DEFAULT '0',
`isrblspam` tinyint(1) DEFAULT '0',
`isfp` tinyint(1) DEFAULT '0',
`isfn` tinyint(1) DEFAULT '0',
`spamwhitelisted` tinyint(1) DEFAULT '0',
`spamblacklisted` tinyint(1) DEFAULT '0',
`sascore` decimal(7,2) DEFAULT '0.00',
`spamreport` mediumtext COLLATE utf8_unicode_ci,
`virusinfected` tinyint(1) DEFAULT '0',
`nameinfected` tinyint(2) DEFAULT '0',
`otherinfected` tinyint(1) DEFAULT '0',
`report` mediumtext COLLATE utf8_unicode_ci,
`ismcp` tinyint(1) DEFAULT '0',
`ishighmcp` tinyint(1) DEFAULT '0',
`issamcp` tinyint(1) DEFAULT '0',
`mcpwhitelisted` tinyint(1) DEFAULT '0',
`mcpblacklisted` tinyint(1) DEFAULT '0',
`mcpsascore` decimal(7,2) DEFAULT '0.00',
`mcpreport` mediumtext COLLATE utf8_unicode_ci,
`hostname` mediumtext COLLATE utf8_unicode_ci,
`date` date DEFAULT NULL,
`time` time DEFAULT NULL,
`headers` mediumtext COLLATE utf8_unicode_ci,
`messageid` mediumtext COLLATE utf8_unicode_ci DEFAULT NULL,
`quarantined` tinyint(1) DEFAULT '0',
`rblspamreport` mediumtext COLLATE utf8_unicode_ci DEFAULT NULL,
`token` CHAR(64) COLLATE utf8_unicode_ci DEFAULT NULL,
`released` tinyint(1) DEFAULT '0',
`salearn` tinyint(1) DEFAULT '0',
`last_update` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`maillog_id`),
KEY `maillog_datetime_idx` (`date`,`time`),
KEY `maillog_id_idx` (`id`(20)),
KEY `maillog_clientip_idx` (`clientip`(20)),
KEY `maillog_from_idx` (`from_address`(191)),
KEY `maillog_to_idx` (`to_address`(191)),
KEY `maillog_host` (`hostname`(30)),
KEY `from_domain_idx` (`from_domain`(50)),
KEY `to_domain_idx` (`to_domain`(50)),
KEY `maillog_quarantined` (`quarantined`),
KEY `timestamp_idx` (`timestamp`)
/*!50604 , FULLTEXT KEY `subject_idx` (`subject`) */
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
-- --------------------------------------------------------
--
-- Table structure for table `mcp_rules`
--
CREATE TABLE IF NOT EXISTS `mcp_rules` (
`rule` varchar(191) COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
`rule_desc` varchar(512) COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
PRIMARY KEY (`rule`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
-- --------------------------------------------------------
--
-- Table structure for table `mtalog`
--
CREATE TABLE IF NOT EXISTS `mtalog` (
`mtalog_id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT,
`timestamp` datetime DEFAULT NULL,
`host` mediumtext COLLATE utf8_unicode_ci,
`type` mediumtext COLLATE utf8_unicode_ci,
`msg_id` varchar(20) COLLATE utf8_unicode_ci DEFAULT NULL,
`relay` mediumtext COLLATE utf8_unicode_ci,
`dsn` mediumtext COLLATE utf8_unicode_ci,
`status` mediumtext COLLATE utf8_unicode_ci,
`delay` time DEFAULT NULL,
`to_address` mediumtext COLLATE utf8_unicode_ci DEFAULT NULL,
PRIMARY KEY (`mtalog_id`),
UNIQUE KEY `mtalog_uniq` (`timestamp`,`host`(10),`type`(10),`msg_id`,`relay`(20),`to_address`(64)),
KEY `mtalog_timestamp` (`timestamp`),
KEY `mtalog_type` (`type`(10)),
KEY `msg_id` (`msg_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
-- --------------------------------------------------------
--
-- Table structure for table `mtalog_ids`
--
CREATE TABLE IF NOT EXISTS `mtalog_ids` (
`smtpd_id` varchar(20) CHARACTER SET ascii DEFAULT NULL,
`smtp_id` varchar(20) CHARACTER SET ascii DEFAULT NULL,
UNIQUE KEY `mtalog_ids_idx` (`smtpd_id`,`smtp_id`),
KEY `smtpd_id` (`smtpd_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
-- --------------------------------------------------------
--
-- Table structure for table `outq`
--
CREATE TABLE IF NOT EXISTS `outq` (
`outq_id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT,
`id` mediumtext COLLATE utf8_unicode_ci,
`cdate` date DEFAULT NULL,
`ctime` time DEFAULT NULL,
`from_address` mediumtext COLLATE utf8_unicode_ci,
`to_address` mediumtext COLLATE utf8_unicode_ci,
`subject` mediumtext COLLATE utf8_unicode_ci,
`message` mediumtext COLLATE utf8_unicode_ci,
`size` mediumtext COLLATE utf8_unicode_ci,
`priority` mediumtext COLLATE utf8_unicode_ci,
`attempts` mediumtext COLLATE utf8_unicode_ci,
`lastattempt` mediumtext COLLATE utf8_unicode_ci,
`hostname` mediumtext COLLATE utf8_unicode_ci,
PRIMARY KEY (`outq_id`),
KEY `outq_hostname` (`hostname`(50))
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
-- --------------------------------------------------------
--
-- Table structure for table `saved_filters`
--
CREATE TABLE IF NOT EXISTS `saved_filters` (
`id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT,
`name` mediumtext COLLATE utf8_unicode_ci NOT NULL,
`col` mediumtext COLLATE utf8_unicode_ci NOT NULL,
`operator` mediumtext COLLATE utf8_unicode_ci NOT NULL,
`value` mediumtext COLLATE utf8_unicode_ci NOT NULL,
`username` mediumtext COLLATE utf8_unicode_ci NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `unique_filters` (`name`(20),`col`(20),`operator`(20),`value`(20),`username`(20))
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
-- --------------------------------------------------------
--
-- Table structure for table `sa_rules`
--
CREATE TABLE IF NOT EXISTS `sa_rules` (
`rule` varchar(191) COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
`rule_desc` varchar(512) COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
PRIMARY KEY (`rule`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
-- --------------------------------------------------------
--
-- Table structure for table `users`
--
CREATE TABLE IF NOT EXISTS `users` (
`id` BIGINT NOT NULL AUTO_INCREMENT UNIQUE KEY,
`username` varchar(191) COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
`password` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
`fullname` varchar(255) COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
`type` enum('A','D','U','R','H') COLLATE utf8_unicode_ci NOT NULL DEFAULT 'U',
`quarantine_report` tinyint(1) DEFAULT '0',
`spamscore` float DEFAULT '0',
`highspamscore` float DEFAULT '0',
`noscan` tinyint(1) DEFAULT '0',
`quarantine_rcpt` varchar(60) COLLATE utf8_unicode_ci DEFAULT NULL,
`resetid` varchar(32) COLLATE utf8_unicode_ci DEFAULT NULL,
`resetexpire` bigint(20) COLLATE utf8_unicode_ci DEFAULT NULL,
`lastreset` bigint(20) COLLATE utf8_unicode_ci DEFAULT NULL,
`login_expiry` bigint(20) COLLATE utf8_unicode_ci DEFAULT '-1',
`last_login` bigint(20) COLLATE utf8_unicode_ci DEFAULT '-1',
`login_timeout` smallint(5) COLLATE utf8_unicode_ci DEFAULT '-1',
PRIMARY KEY (`username`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
-- --------------------------------------------------------
--
-- Table structure for table `user_filters`
--
CREATE TABLE IF NOT EXISTS `user_filters` (
`id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT,
`username` varchar(191) COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
`filter` mediumtext COLLATE utf8_unicode_ci,
`verify_key` varchar(32) COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
`active` enum('N','Y') COLLATE utf8_unicode_ci DEFAULT 'N',
PRIMARY KEY (`id`),
KEY `user_filters_username_idx` (`username`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
-- --------------------------------------------------------
--
-- Table structure for table `whitelist`
--
CREATE TABLE IF NOT EXISTS `whitelist` (
`id` bigint(11) UNSIGNED NOT NULL AUTO_INCREMENT,
`to_address` mediumtext COLLATE utf8_unicode_ci,
`to_domain` mediumtext COLLATE utf8_unicode_ci,
`from_address` mediumtext COLLATE utf8_unicode_ci,
PRIMARY KEY (`id`),
UNIQUE KEY `whitelist_uniq` (`to_address`(100),`from_address`(100))
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
-- --------------------------------------------------------
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;