summaryrefslogtreecommitdiff
path: root/src/pool/mysql.sql
blob: 1b437593d5eb4f66612ed5b3fe016cab306b72ff (plain)
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

DROP TABLE IF EXISTS `identities`;
CREATE TABLE `identities` (
  `id` int(10) unsigned NOT NULL auto_increment,
  `type` tinyint(4) unsigned NOT NULL,
  `data` varbinary(64) NOT NULL,
  PRIMARY KEY (`id`),
  UNIQUE (`type`, `data`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;


DROP TABLE IF EXISTS `child_configs`;
CREATE TABLE `child_configs` (
  `id` int(10) unsigned NOT NULL auto_increment,
  `name` varchar(32) collate utf8_unicode_ci NOT NULL,
  `lifetime` mediumint(8) unsigned NOT NULL default '1500',
  `rekeytime` mediumint(8) unsigned NOT NULL default '1200',
  `jitter` mediumint(8) unsigned NOT NULL default '60',
  `updown` varchar(128) collate utf8_unicode_ci default NULL,
  `hostaccess` tinyint(1) unsigned NOT NULL default '0',
  `mode` tinyint(4) unsigned NOT NULL default '2',
  `start_action` tinyint(4) unsigned NOT NULL default '0',
  `dpd_action` tinyint(4) unsigned NOT NULL default '0',
  `close_action` tinyint(4) unsigned NOT NULL default '0',
  `ipcomp` tinyint(4) unsigned NOT NULL default '0',
  `reqid` mediumint(8) unsigned NOT NULL default '0',
  PRIMARY KEY (`id`),
  INDEX (`name`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;


DROP TABLE IF EXISTS `child_config_traffic_selector`;
CREATE TABLE `child_config_traffic_selector` (
  `child_cfg` int(10) unsigned NOT NULL,
  `traffic_selector` int(10) unsigned NOT NULL,
  `kind` tinyint(3) unsigned NOT NULL,
  INDEX (`child_cfg`, `traffic_selector`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;


DROP TABLE IF EXISTS `proposals`;
CREATE TABLE `proposals` (
  `id` int(10) unsigned NOT NULL auto_increment,
  `proposal` varchar(128) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;


DROP TABLE IF EXISTS `child_config_proposal`;
CREATE TABLE `child_config_proposal` (
  `child_cfg` int(10) unsigned NOT NULL,
  `prio` smallint(5) unsigned NOT NULL,
  `prop` int(10) unsigned NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;


DROP TABLE IF EXISTS `ike_configs`;
CREATE TABLE `ike_configs` (
  `id` int(10) unsigned NOT NULL auto_increment,
  `certreq` tinyint(3) unsigned NOT NULL default '1',
  `force_encap` tinyint(1) NOT NULL default '0',
  `local` varchar(128) collate utf8_unicode_ci NOT NULL,
  `remote` varchar(128) collate utf8_unicode_ci NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;


DROP TABLE IF EXISTS `ike_config_proposal`;
CREATE TABLE `ike_config_proposal` (
  `ike_cfg` int(10) unsigned NOT NULL,
  `prio` smallint(5) unsigned NOT NULL,
  `prop` int(10) unsigned NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;


DROP TABLE IF EXISTS `peer_configs`;
CREATE TABLE `peer_configs` (
  `id` int(10) unsigned NOT NULL auto_increment,
  `name` varchar(32) collate utf8_unicode_ci NOT NULL,
  `ike_version` tinyint(3) unsigned NOT NULL default '2',
  `ike_cfg` int(10) unsigned NOT NULL,
  `local_id` varchar(64) collate utf8_unicode_ci NOT NULL,
  `remote_id` varchar(64) collate utf8_unicode_ci NOT NULL,
  `cert_policy` tinyint(3) unsigned NOT NULL default '1',
  `uniqueid` tinyint(3) unsigned NOT NULL default '0',
  `auth_method` tinyint(3) unsigned NOT NULL default '1',
  `eap_type` tinyint(3) unsigned NOT NULL default '0',
  `eap_vendor` smallint(5) unsigned NOT NULL default '0',
  `keyingtries` tinyint(3) unsigned NOT NULL default '3',
  `rekeytime` mediumint(8) unsigned NOT NULL default '7200',
  `reauthtime` mediumint(8) unsigned NOT NULL default '0',
  `jitter` mediumint(8) unsigned NOT NULL default '180',
  `overtime` mediumint(8) unsigned NOT NULL default '300',
  `mobike` tinyint(1) NOT NULL default '1',
  `dpd_delay` mediumint(8) unsigned NOT NULL default '120',
  `virtual` varchar(40) default NULL,
  `pool` varchar(32) default NULL,
  `mediation` tinyint(1) NOT NULL default '0',
  `mediated_by` int(10) unsigned NOT NULL default '0',
  `peer_id` int(10) unsigned NOT NULL default '0',
  PRIMARY KEY (`id`),
  INDEX (`name`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;


DROP TABLE IF EXISTS `peer_config_child_config`;
CREATE TABLE `peer_config_child_config` (
  `peer_cfg` int(10) unsigned NOT NULL,
  `child_cfg` int(10) unsigned NOT NULL,
  PRIMARY KEY (`peer_cfg`, `child_cfg`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;


DROP TABLE IF EXISTS `traffic_selectors`;
CREATE TABLE `traffic_selectors` (
  `id` int(10) unsigned NOT NULL auto_increment,
  `type` tinyint(3) unsigned NOT NULL default '7',
  `protocol` smallint(5) unsigned NOT NULL default '0',
  `start_addr` varbinary(16) default NULL,
  `end_addr` varbinary(16) default NULL,
  `start_port` smallint(5) unsigned NOT NULL default '0',
  `end_port` smallint(5) unsigned NOT NULL default '65535',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;


DROP TABLE IF EXISTS certificates;
CREATE TABLE certificates (
  `id` int(10) unsigned NOT NULL auto_increment,
  `type` tinyint(3) unsigned NOT NULL,
  `keytype` tinyint(3) unsigned NOT NULL,
  `data` BLOB NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;


DROP TABLE IF EXISTS certificate_identity;
CREATE TABLE certificate_identity (
  `certificate` int(10) unsigned NOT NULL,
  `identity` int(10) unsigned NOT NULL,
  PRIMARY KEY (`certificate`, `identity`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;


DROP TABLE IF EXISTS private_keys;
CREATE TABLE private_keys (
  `id` int(10) unsigned NOT NULL auto_increment,
  `type` tinyint(3) unsigned NOT NULL,
  `data` BLOB NOT NULL,
  PRIMARY KEY  (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;


DROP TABLE IF EXISTS private_key_identity;
CREATE TABLE private_key_identity (
  `private_key` int(10) unsigned NOT NULL,
  `identity` int(10) unsigned NOT NULL,
  PRIMARY KEY (`private_key`, `identity`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;


DROP TABLE IF EXISTS shared_secrets;
CREATE TABLE shared_secrets (
  `id` int(10) unsigned NOT NULL auto_increment,
  `type` tinyint(3) unsigned NOT NULL,
  `data` varbinary(256) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;


DROP TABLE IF EXISTS shared_secret_identity;
CREATE TABLE shared_secret_identity (
  `shared_secret` int(10) unsigned NOT NULL,
  `identity` int(10) unsigned NOT NULL,
  PRIMARY KEY (`shared_secret`, `identity`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;


DROP TABLE IF EXISTS certificate_authorities;
CREATE TABLE certificate_authorities (
  `id` int(10) unsigned NOT NULL auto_increment,
  `certificate` int(10) unsigned NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;


DROP TABLE IF EXISTS certificate_distribution_points;
CREATE TABLE certificate_distribution_points (
  `id` int(10) unsigned NOT NULL auto_increment,
  `ca` int(10) unsigned NOT NULL,
  `type` tinyint(3) unsigned NOT NULL,
  `uri` varchar(256) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;


DROP TABLE IF EXISTS pools;
CREATE TABLE pools (
  `id` int(10) unsigned NOT NULL auto_increment,
  `name` varchar(32) NOT NULL,
  `start` varbinary(16) NOT NULL,
  `end` varbinary(16) NOT NULL,
  `timeout` int(10) unsigned NOT NULL,
  PRIMARY KEY (`id`),
  UNIQUE (`name`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;


DROP TABLE IF EXISTS addresses;
CREATE TABLE addresses (
  `id` int(10) unsigned NOT NULL auto_increment,
  `pool` int(10) unsigned NOT NULL,
  `address` varbinary(16) NOT NULL,
  `identity` int(10) unsigned NOT NULL DEFAULT 0,
  `acquired` int(10) unsigned NOT NULL DEFAULT 0,
  `released` int(10) unsigned NOT NULL DEFAULT 1,
  PRIMARY KEY (`id`),
  INDEX (`pool`),
  INDEX (`identity`),
  INDEX (`address`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

DROP TABLE IF EXISTS leases;
CREATE TABLE leases (
  `id` int(10) unsigned NOT NULL auto_increment,
  `address` int(10) unsigned NOT NULL,
  `identity` int(10) unsigned NOT NULL,
  `acquired` int(10) unsigned NOT NULL,
  `released` int(10) unsigned DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

DROP TABLE IF EXISTS attribute_pools;
CREATE TABLE attribute_pools (
  `id` int(10) unsigned NOT NULL auto_increment,
  `name` varchar(32) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

DROP TABLE IF EXISTS attributes;
CREATE TABLE attributes (
  `id` int(10) unsigned NOT NULL auto_increment,
  `identity` int(10) unsigned NOT NULL default '0',
  `pool` int(10) unsigned NOT NULL default '0',
  `type` int(10) unsigned NOT NULL,
  `value` varbinary(16) NOT NULL,
  PRIMARY KEY (`id`),
  INDEX (`identity`),
  INDEX (`pool`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

DROP TABLE IF EXISTS ike_sas;
CREATE TABLE ike_sas (
  `local_spi` varbinary(8) NOT NULL,
  `remote_spi` varbinary(8) NOT NULL,
  `id` int(10) unsigned NOT NULL,
  `initiator` tinyint(1) NOT NULL,
  `local_id_type` tinyint(3) NOT NULL,
  `local_id_data` varbinary(64) DEFAULT NULL,
  `remote_id_type` tinyint(3) NOT NULL,
  `remote_id_data` varbinary(64) DEFAULT NULL,
  `host_family` tinyint(3) NOT NULL,
  `local_host_data` varbinary(16) NOT NULL,
  `remote_host_data` varbinary(16) NOT NULL,
  `lastuse` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`local_spi`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;


DROP TABLE IF EXISTS logs;
CREATE TABLE logs (
  `id` int(10) unsigned NOT NULL auto_increment,
  `local_spi` varbinary(8) NOT NULL,
  `signal` tinyint(3) NOT NULL,
  `level` tinyint(3) NOT NULL,
  `msg` varchar(256) NOT NULL,
  `time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;