ported IP pool to mysql
[strongswan.git] / src / charon / plugins / sql / sqlite.sql
1
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
12 DROP TABLE IF EXISTS child_configs;
13 CREATE TABLE child_configs (
14 id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
15 name TEXT NOT NULL,
16 lifetime INTEGER NOT NULL DEFAULT '1500',
17 rekeytime INTEGER NOT NULL DEFAULT '1200',
18 jitter INTEGER NOT NULL DEFAULT '60',
19 updown TEXT DEFAULT NULL,
20 hostaccess INTEGER NOT NULL DEFAULT '0',
21 mode INTEGER NOT NULL DEFAULT '1',
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
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
44 DROP TABLE IF EXISTS ike_configs;
45 CREATE TABLE ike_configs (
46 id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
47 certreq INTEGER NOT NULL DEFAULT '1',
48 force_encap INTEGER NOT NULL DEFAULT '0',
49 local TEXT NOT NULL,
50 remote TEXT NOT NULL
51 );
52
53
54 DROP TABLE IF EXISTS peer_configs;
55 CREATE TABLE peer_configs (
56 id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
57 name TEXT NOT NULL,
58 ike_version INTEGER NOT NULL DEFAULT '2',
59 ike_cfg INTEGER NOT NULL,
60 local_id TEXT NOT NULL,
61 remote_id TEXT NOT NULL,
62 cert_policy INTEGER NOT NULL DEFAULT '1',
63 uniqueid INTEGER NOT NULL DEFAULT '0',
64 auth_method INTEGER NOT NULL DEFAULT '1',
65 eap_type INTEGER NOT NULL DEFAULT '0',
66 eap_vendor INTEGER NOT NULL DEFAULT '0',
67 keyingtries INTEGER NOT NULL DEFAULT '3',
68 rekeytime INTEGER NOT NULL DEFAULT '7200',
69 reauthtime INTEGER NOT NULL DEFAULT '0',
70 jitter INTEGER NOT NULL DEFAULT '180',
71 overtime INTEGER NOT NULL DEFAULT '300',
72 mobike INTEGER NOT NULL DEFAULT '1',
73 dpd_delay INTEGER NOT NULL DEFAULT '120',
74 virtual TEXT DEFAULT NULL,
75 pool TEXT DEFAULT NULL,
76 mediation INTEGER NOT NULL DEFAULT '0',
77 mediated_by INTEGER NOT NULL DEFAULT '0',
78 peer_id INTEGER NOT NULL DEFAULT '0'
79 );
80 DROP INDEX IF EXISTS peer_configs_name;
81 CREATE INDEX peer_configs_name ON peer_configs (
82 name
83 );
84
85
86 DROP TABLE IF EXISTS peer_config_child_config;
87 CREATE TABLE peer_config_child_config (
88 peer_cfg INTEGER NOT NULL,
89 child_cfg INTEGER NOT NULL,
90 PRIMARY KEY (peer_cfg, child_cfg)
91 );
92
93
94 DROP TABLE IF EXISTS traffic_selectors;
95 CREATE TABLE traffic_selectors (
96 id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
97 type INTEGER NOT NULL DEFAULT '7',
98 protocol INTEGER NOT NULL DEFAULT '0',
99 start_addr BLOB DEFAULT NULL,
100 end_addr BLOB DEFAULT NULL,
101 start_port INTEGER NOT NULL DEFAULT '0',
102 end_port INTEGER NOT NULL DEFAULT '65535'
103 );
104
105
106 DROP TABLE IF EXISTS certificates;
107 CREATE TABLE certificates (
108 id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
109 type INTEGER NOT NULL,
110 keytype INTEGER NOT NULL,
111 data BLOB NOT NULL
112 );
113
114
115 DROP TABLE IF EXISTS certificate_identity;
116 CREATE TABLE certificate_identity (
117 certificate INTEGER NOT NULL,
118 identity INTEGER NOT NULL,
119 PRIMARY KEY (certificate, identity)
120 );
121
122
123 DROP TABLE IF EXISTS private_keys;
124 CREATE TABLE private_keys (
125 id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
126 type INTEGER NOT NULL,
127 data BLOB NOT NULL
128 );
129
130
131 DROP TABLE IF EXISTS private_key_identity;
132 CREATE TABLE private_key_identity (
133 private_key INTEGER NOT NULL,
134 identity INTEGER NOT NULL,
135 PRIMARY KEY (private_key, identity)
136 );
137
138
139 DROP TABLE IF EXISTS shared_secrets;
140 CREATE TABLE shared_secrets (
141 id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
142 type INTEGER NOT NULL,
143 data BLOB NOT NULL
144 );
145
146
147 DROP TABLE IF EXISTS shared_secret_identity;
148 CREATE TABLE shared_secret_identity (
149 shared_secret INTEGER NOT NULL,
150 identity INTEGER NOT NULL,
151 PRIMARY KEY (shared_secret, identity)
152 );
153
154
155 DROP TABLE IF EXISTS pools;
156 CREATE TABLE pools (
157 id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
158 name TEXT NOT NULL,
159 start BLOB NOT NULL,
160 end BLOB NOT NULL,
161 next BLOB NOT NULL,
162 timeout INTEGER DEFAULT NULL,
163 UNIQUE (name)
164 );
165 DROP INDEX IF EXISTS pools_name;
166 CREATE INDEX pools_name ON pools (
167 name
168 );
169
170
171 DROP TABLE IF EXISTS leases;
172 CREATE TABLE leases (
173 id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
174 pool INTEGER NOT NULL,
175 address BLOB NOT NULL,
176 identity INTEGER NOT NULL,
177 acquired INTEGER NOT NULL,
178 released INTEGER DEFAULT NULL
179 );
180 DROP INDEX IF EXISTS leases_pool;
181 CREATE INDEX leases_pool ON leases (
182 pool
183 );
184 DROP INDEX IF EXISTS leases_identity;
185 CREATE INDEX leases_identity ON leases (
186 identity
187 );
188 DROP INDEX IF EXISTS leases_released;
189 CREATE INDEX leases_released ON leases (
190 released
191 );
192
193
194 DROP TABLE IF EXISTS ike_sas;
195 CREATE TABLE ike_sas (
196 local_spi BLOB NOT NULL PRIMARY KEY,
197 remote_spi BLOB NOT NULL,
198 id INTEGER NOT NULL,
199 initiator INTEGER NOT NULL,
200 local_id_type INTEGER NOT NULL,
201 local_id_data BLOB NOT NULL,
202 remote_id_type INTEGER NOT NULL,
203 remote_id_data BLOB NOT NULL,
204 host_family INTEGER NOT NULL,
205 local_host_data BLOB NOT NULL,
206 remote_host_data BLOB NOT NULL,
207 created INTEGER NOT NULL DEFAULT CURRENT_TIMESTAMP
208 );
209
210 DROP TABLE IF EXISTS logs;
211 CREATE TABLE logs (
212 id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
213 local_spi BLOB NOT NULL,
214 signal INTEGER NOT NULL,
215 level INTEGER NOT NULL,
216 msg TEXT NOT NULL,
217 time INTEGER NOT NULL DEFAULT CURRENT_TIMESTAMP
218 );
219