Repository navigation
Expand file tree
/
Copy pathmkdb.mysql
More file actions
135 lines (120 loc) · 3.75 KB
/
Copy pathmkdb.mysql
File metadata and controls
135 lines (120 loc) · 3.75 KB
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
-- Copyright (c) 2010-2012, The Trusted Domain Project. All rights reserved.
-- MySQL command sequence to create a database to accumulate OpenDKIM
-- statistics reports
-- table of reporters
create table if not exists reporters (
id int unsigned not null auto_increment,
name varchar(255) not null,
firstseen timestamp not null default CURRENT_TIMESTAMP,
enabled tinyint not null default 1,
primary key(id),
unique key(name)
) engine=innodb default charset=latin1;
-- table of domain names we've seen
create table if not exists domains (
id int unsigned not null auto_increment,
name varchar(255) not null,
firstseen timestamp not null default CURRENT_TIMESTAMP,
primary key(id),
unique key(name)
) engine=innodb default charset=latin1;
-- table of IP addresses we've seen
create table if not exists ipaddrs (
id int unsigned not null auto_increment,
addr varchar(64) not null,
firstseen timestamp not null default CURRENT_TIMESTAMP,
primary key(id),
unique key(addr)
) engine=innodb default charset=latin1;
-- table of messages names we've seen
create table if not exists messages (
id int unsigned not null auto_increment,
jobid varchar(64) not null,
reporter int unsigned not null,
from_domain int unsigned not null,
ip int unsigned not null,
msgtime timestamp not null default CURRENT_TIMESTAMP,
size int unsigned not null,
sigcount int unsigned not null,
spam tinyint not null default -1,
atps tinyint not null default -1,
primary key(id),
key(reporter),
key(from_domain),
key(ip),
key(msgtime),
unique key(reporter, jobid, msgtime),
foreign key(from_domain) references domains(id) on delete cascade,
foreign key(ip) references ipaddrs(id) on delete cascade,
foreign key(reporter) references reporters(id) on delete cascade
) engine=innodb default charset=latin1;
-- table of signatures we've seen
create table if not exists signatures (
id int unsigned not null auto_increment,
message int unsigned not null,
domain int unsigned not null,
pass tinyint unsigned not null,
fail_body tinyint unsigned not null,
siglength int not null,
sigerror tinyint unsigned not null,
dnssec tinyint not null,
primary key(id),
key(domain),
foreign key(message) references messages(id) on delete cascade,
foreign key(domain) references domains(id) on delete cascade
) engine=innodb default charset=latin1;
-- table mapping signature error codes to descriptions
create table if not exists sigerrorcodes (
id tinyint not null,
name varchar(255) not null,
primary key (id)
) engine=innodb default charset=latin1;
insert ignore into sigerrorcodes (id, name) values
(-1, "unknown error"),
(0, "no error"),
(1, "unsupported version"),
(2, "invalid domain (d=/i=)"),
(3, "signature expired"),
(4, "signature in the future"),
(5, "x= < t="),
(6, "c= missing"),
(7, "c= invalid (header)"),
(8, "c= invalid (body)"),
(9, "a= missing"),
(10, "a= invalid"),
(11, "h= missing"),
(12, "l= invalid"),
(13, "q= invalid"),
(14, "q= option invalid"),
(15, "d= missing"),
(16, "d= empty"),
(17, "s= missing"),
(18, "s= empty"),
(19, "b= missing"),
(20, "b= empty"),
(21, "b= corrupt"),
(22, "no key found in DNS"),
(23, "DNS reply corrupt"),
(24, "DNS query failed"),
(25, "bh= missing"),
(26, "bh= empty"),
(27, "bh= corrupt"),
(28, "signature mismatch"),
(29, "unauthorized subdomain"),
(30, "multiple records returned"),
(31, "h= empty"),
(32, "h= missing required entries"),
(33, "l= value exceeds body size"),
(34, "field-must-be-signed failure"),
(35, "unknown key version"),
(36, "unknown key hash"),
(37, "signature-key hash mismatch"),
(38, "not an email key"),
(39, "key granularity mismatch"),
(40, "key type missing"),
(41, "key type unknown"),
(42, "key revoked"),
(43, "key could not be decoded"),
(44, "v= missing"),
(45, "v= empty")
;