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