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