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