1ac7f056c730b9802ee1b02326119887b88199d3
[strongswan.git] / testing / hosts / default / etc / ipsec.d / tables.sql
1 /* strongSwan SQLite database */
2
3 DROP TABLE IF EXISTS identities;
4 CREATE TABLE identities (
5 id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
6 type INTEGER NOT NULL,
7 data BLOB NOT NULL,
8 UNIQUE (type, data)
9 );
10
11 DROP TABLE IF EXISTS child_configs;
12 CREATE TABLE child_configs (
13 id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
14 name TEXT NOT NULL,
15 lifetime INTEGER NOT NULL DEFAULT '1200',
16 rekeytime INTEGER NOT NULL DEFAULT '1020',
17 jitter INTEGER NOT NULL DEFAULT '180',
18 updown TEXT DEFAULT NULL,
19 hostaccess INTEGER NOT NULL DEFAULT '0',
20 mode INTEGER NOT NULL DEFAULT '2',
21 start_action INTEGER NOT NULL DEFAULT '0',
22 dpd_action INTEGER NOT NULL DEFAULT '0',
23 close_action INTEGER NOT NULL DEFAULT '0',
24 ipcomp INTEGER NOT NULL DEFAULT '0'
25 );
26 DROP INDEX IF EXISTS child_configs_name;
27 CREATE INDEX child_configs_name ON child_configs (
28 name
29 );
30
31 DROP TABLE IF EXISTS child_config_traffic_selector;
32 CREATE TABLE child_config_traffic_selector (
33 child_cfg INTEGER NOT NULL,
34 traffic_selector INTEGER NOT NULL,
35 kind INTEGER NOT NULL
36 );
37 DROP INDEX IF EXISTS child_config_traffic_selector;
38 CREATE INDEX child_config_traffic_selector_all ON child_config_traffic_selector (
39 child_cfg, traffic_selector
40 );
41
42 DROP TABLE IF EXISTS algorithms;
43 CREATE TABLE algorithms (
44 id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
45 algorithm TEXT NOT NULL
46 );
47
48 DROP TABLE IF EXISTS child_config_algorithm;
49 CREATE TABLE child_config_algorithm (
50 child_cfg INTEGER NOT NULL,
51 prio INTEGER NOT NULL,
52 alg INTEGER NOT NULL
53 );
54
55 DROP TABLE IF EXISTS ike_configs;
56 CREATE TABLE ike_configs (
57 id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
58 certreq INTEGER NOT NULL DEFAULT '1',
59 force_encap INTEGER NOT NULL DEFAULT '0',
60 local TEXT NOT NULL,
61 remote TEXT NOT NULL
62 );
63
64 DROP TABLE IF EXISTS ike_config_algorithm;
65 CREATE TABLE ike_config_algorithm (
66 ike_cfg INTEGER NOT NULL,
67 prio INTEGER NOT NULL,
68 alg INTEGER NOT NULL
69 );
70
71 DROP TABLE IF EXISTS peer_configs;
72 CREATE TABLE peer_configs (
73 id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
74 name TEXT NOT NULL,
75 ike_version INTEGER NOT NULL DEFAULT '2',
76 ike_cfg INTEGER NOT NULL,
77 local_id TEXT NOT NULL,
78 remote_id TEXT NOT NULL,
79 cert_policy INTEGER NOT NULL DEFAULT '1',
80 uniqueid INTEGER NOT NULL DEFAULT '0',
81 auth_method INTEGER NOT NULL DEFAULT '1',
82 eap_type INTEGER NOT NULL DEFAULT '0',
83 eap_vendor INTEGER NOT NULL DEFAULT '0',
84 keyingtries INTEGER NOT NULL DEFAULT '1',
85 rekeytime INTEGER NOT NULL DEFAULT '0',
86 reauthtime INTEGER NOT NULL DEFAULT '3600',
87 jitter INTEGER NOT NULL DEFAULT '180',
88 overtime INTEGER NOT NULL DEFAULT '300',
89 mobike INTEGER NOT NULL DEFAULT '1',
90 dpd_delay INTEGER NOT NULL DEFAULT '120',
91 virtual TEXT DEFAULT NULL,
92 pool TEXT DEFAULT NULL,
93 mediation INTEGER NOT NULL DEFAULT '0',
94 mediated_by INTEGER NOT NULL DEFAULT '0',
95 peer_id INTEGER NOT NULL DEFAULT '0'
96 );
97 DROP INDEX IF EXISTS peer_configs_name;
98 CREATE INDEX peer_configs_name ON peer_configs (
99 name
100 );
101
102 DROP TABLE IF EXISTS peer_config_child_config;
103 CREATE TABLE peer_config_child_config (
104 peer_cfg INTEGER NOT NULL,
105 child_cfg INTEGER NOT NULL,
106 PRIMARY KEY (peer_cfg, child_cfg)
107 );
108
109 DROP TABLE IF EXISTS traffic_selectors;
110 CREATE TABLE traffic_selectors (
111 id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
112 type INTEGER NOT NULL DEFAULT '7',
113 protocol INTEGER NOT NULL DEFAULT '0',
114 start_addr BLOB DEFAULT NULL,
115 end_addr BLOB DEFAULT NULL,
116 start_port INTEGER NOT NULL DEFAULT '0',
117 end_port INTEGER NOT NULL DEFAULT '65535'
118 );
119
120 DROP TABLE IF EXISTS certificates;
121 CREATE TABLE certificates (
122 id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
123 type INTEGER NOT NULL,
124 keytype INTEGER NOT NULL,
125 data BLOB NOT NULL
126 );
127
128 DROP TABLE IF EXISTS certificate_identity;
129 CREATE TABLE certificate_identity (
130 certificate INTEGER NOT NULL,
131 identity INTEGER NOT NULL,
132 PRIMARY KEY (certificate, identity)
133 );
134
135 DROP TABLE IF EXISTS private_keys;
136 CREATE TABLE private_keys (
137 id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
138 type INTEGER NOT NULL,
139 data BLOB NOT NULL
140 );
141
142 DROP TABLE IF EXISTS private_key_identity;
143 CREATE TABLE private_key_identity (
144 private_key INTEGER NOT NULL,
145 identity INTEGER NOT NULL,
146 PRIMARY KEY (private_key, identity)
147 );
148
149 DROP TABLE IF EXISTS shared_secrets;
150 CREATE TABLE shared_secrets (
151 id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
152 type INTEGER NOT NULL,
153 data BLOB NOT NULL
154 );
155
156 DROP TABLE IF EXISTS shared_secret_identity;
157 CREATE TABLE shared_secret_identity (
158 shared_secret INTEGER NOT NULL,
159 identity INTEGER NOT NULL,
160 PRIMARY KEY (shared_secret, identity)
161 );
162
163 DROP TABLE IF EXISTS pools;
164 CREATE TABLE pools (
165 id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
166 name TEXT NOT NULL,
167 start BLOB NOT NULL,
168 end BLOB NOT NULL,
169 timeout INTEGER NOT NULL
170 );
171 DROP INDEX IF EXISTS pools_name;
172 CREATE INDEX pools_name ON pools (
173 name
174 );
175
176 DROP TABLE IF EXISTS addresses;
177 CREATE TABLE addresses (
178 id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
179 pool INTEGER NOT NULL,
180 address BLOB NOT NULL,
181 identity INTEGER NOT NULL DEFAULT 0,
182 acquired INTEGER NOT NULL DEFAULT 0,
183 released INTEGER NOT NULL DEFAULT 1
184 );
185 DROP INDEX IF EXISTS addresses_pool;
186 CREATE INDEX addresses_pool ON addresses (
187 pool
188 );
189 DROP INDEX IF EXISTS addresses_address;
190 CREATE INDEX addresses_address ON addresses (
191 address
192 );
193 DROP INDEX IF EXISTS addresses_identity;
194 CREATE INDEX addresses_identity ON addresses (
195 identity
196 );
197
198 DROP TABLE IF EXISTS leases;
199 CREATE TABLE leases (
200 id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
201 address INTEGER NOT NULL,
202 identity INTEGER NOT NULL,
203 acquired INTEGER NOT NULL,
204 released INTEGER NOT NULL
205 );
206
207 DROP TABLE IF EXISTS attribute_pools;
208 CREATE TABLE attribute_pools (
209 id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
210 name TEXT NOT NULL
211 );
212
213 DROP TABLE IF EXISTS attributes;
214 CREATE TABLE attributes (
215 id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
216 identity INTEGER NOT NULL DEFAULT 0,
217 pool INTEGER NOT NULL DEFAULT 0,
218 type INTEGER NOT NULL,
219 value BLOB NOT NULL
220 );
221 DROP INDEX IF EXISTS attributes_identity;
222 CREATE INDEX attributes_identity ON attributes (
223 identity
224 );
225 DROP INDEX IF EXISTS attributes_pool;
226 CREATE INDEX attributes_pool ON attributes (
227 pool
228 );
229
230 DROP TABLE IF EXISTS ike_sas;
231 CREATE TABLE ike_sas (
232 local_spi BLOB NOT NULL PRIMARY KEY,
233 remote_spi BLOB NOT NULL,
234 id INTEGER NOT NULL,
235 initiator INTEGER NOT NULL,
236 local_id_type INTEGER NOT NULL,
237 local_id_data BLOB DEFAULT NULL,
238 remote_id_type INTEGER NOT NULL,
239 remote_id_data BLOB DEFAULT NULL,
240 host_family INTEGER NOT NULL,
241 local_host_data BLOB NOT NULL,
242 remote_host_data BLOB NOT NULL,
243 created INTEGER NOT NULL DEFAULT CURRENT_TIMESTAMP
244 );
245
246 DROP TABLE IF EXISTS logs;
247 CREATE TABLE logs (
248 id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
249 local_spi BLOB NOT NULL,
250 signal INTEGER NOT NULL,
251 level INTEGER NOT NULL,
252 msg TEXT NOT NULL,
253 time INTEGER NOT NULL DEFAULT CURRENT_TIMESTAMP
254 );
255