

CREATE TABLE identities (
  id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
  type INTEGER NOT NULL,
  data BLOB NOT NULL,
  UNIQUE (type, data)
);


CREATE TABLE child_configs (
  id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
  name TEXT NOT NULL,
  lifetime INTEGER NOT NULL DEFAULT '1500',
  rekeytime INTEGER NOT NULL DEFAULT '1200',
  jitter INTEGER NOT NULL DEFAULT '60',
  updown TEXT DEFAULT NULL,
  hostaccess INTEGER NOT NULL DEFAULT '0',
  mode INTEGER NOT NULL DEFAULT '2',
  start_action INTEGER NOT NULL DEFAULT '0',
  dpd_action INTEGER NOT NULL DEFAULT '0',
  close_action INTEGER NOT NULL DEFAULT '0',
  ipcomp INTEGER NOT NULL DEFAULT '0',
  reqid INTEGER NOT NULL DEFAULT '0'
);
DROP INDEX IF EXISTS child_configs_name;
CREATE INDEX child_configs_name ON child_configs (
  name
);


CREATE TABLE child_config_traffic_selector (
  child_cfg INTEGER NOT NULL,
  traffic_selector INTEGER NOT NULL,
  kind INTEGER NOT NULL
);
DROP INDEX IF EXISTS child_config_traffic_selector_all;
CREATE INDEX child_config_traffic_selector_all ON child_config_traffic_selector (
  child_cfg, traffic_selector
);

CREATE TABLE proposals (
  id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
  proposal TEXT NOT NULL
);


CREATE TABLE child_config_proposal (
  child_cfg INTEGER NOT NULL,
  prio INTEGER NOT NULL,
  prop INTEGER NOT NULL
);


CREATE TABLE ike_configs (
  id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
  certreq INTEGER NOT NULL DEFAULT '1',
  force_encap INTEGER NOT NULL DEFAULT '0',
  local TEXT NOT NULL,
  remote TEXT NOT NULL
);


CREATE TABLE ike_config_proposal (
  ike_cfg INTEGER NOT NULL,
  prio INTEGER NOT NULL,
  prop INTEGER NOT NULL
);


CREATE TABLE peer_configs (
  id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
  name TEXT NOT NULL,
  ike_version INTEGER NOT NULL DEFAULT '2',
  ike_cfg INTEGER NOT NULL,
  local_id TEXT NOT NULL,
  remote_id TEXT NOT NULL,
  cert_policy INTEGER NOT NULL DEFAULT '1',
  uniqueid INTEGER NOT NULL DEFAULT '0',
  auth_method INTEGER NOT NULL DEFAULT '1',
  eap_type INTEGER NOT NULL DEFAULT '0',
  eap_vendor INTEGER NOT NULL DEFAULT '0',
  keyingtries INTEGER NOT NULL DEFAULT '3',
  rekeytime INTEGER NOT NULL DEFAULT '7200',
  reauthtime INTEGER NOT NULL DEFAULT '0',
  jitter INTEGER NOT NULL DEFAULT '180',
  overtime INTEGER NOT NULL DEFAULT '300',
  mobike INTEGER NOT NULL DEFAULT '1',
  dpd_delay INTEGER NOT NULL DEFAULT '120',
  virtual TEXT DEFAULT NULL,
  pool TEXT DEFAULT NULL,
  mediation INTEGER NOT NULL DEFAULT '0',
  mediated_by INTEGER NOT NULL DEFAULT '0',
  peer_id INTEGER NOT NULL DEFAULT '0'
);
DROP INDEX IF EXISTS peer_configs_name;
CREATE INDEX peer_configs_name ON peer_configs (
  name
);


CREATE TABLE peer_config_child_config (
  peer_cfg INTEGER NOT NULL,
  child_cfg INTEGER NOT NULL,
  PRIMARY KEY (peer_cfg, child_cfg)
);


CREATE TABLE traffic_selectors (
  id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
  type INTEGER NOT NULL DEFAULT '7',
  protocol INTEGER NOT NULL DEFAULT '0',
  start_addr BLOB DEFAULT NULL,
  end_addr BLOB DEFAULT NULL,
  start_port INTEGER NOT NULL DEFAULT '0',
  end_port INTEGER NOT NULL DEFAULT '65535'
);


CREATE TABLE certificates (
  id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
  type INTEGER NOT NULL,
  keytype INTEGER NOT NULL,
  data BLOB NOT NULL
);


CREATE TABLE certificate_identity (
  certificate INTEGER NOT NULL,
  identity INTEGER NOT NULL,
  PRIMARY KEY (certificate, identity)
);


CREATE TABLE private_keys (
  id INTEGER NOT NULL  PRIMARY KEY AUTOINCREMENT,
  type INTEGER NOT NULL,
  data BLOB NOT NULL
);


CREATE TABLE private_key_identity (
  private_key INTEGER NOT NULL,
  identity INTEGER NOT NULL,
  PRIMARY KEY (private_key, identity)
);


CREATE TABLE shared_secrets (
  id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
  type INTEGER NOT NULL,
  data BLOB NOT NULL
);


CREATE TABLE shared_secret_identity (
  shared_secret INTEGER NOT NULL,
  identity INTEGER NOT NULL,
  PRIMARY KEY (shared_secret, identity)
);


CREATE TABLE certificate_authorities (
  id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
  certificate INTEGER NOT NULL
);


CREATE TABLE certificate_distribution_points (
  id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
  ca INTEGER NOT NULL,
  type INTEGER NOT NULL,
  uri TEXT NOT NULL
);


CREATE TABLE pools (
  id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
  name TEXT NOT NULL UNIQUE,
  start BLOB NOT NULL,
  end BLOB NOT NULL,
  timeout INTEGER NOT NULL
);

CREATE TABLE addresses (
  id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
  pool INTEGER NOT NULL,
  address BLOB NOT NULL,
  identity INTEGER NOT NULL DEFAULT 0,
  acquired INTEGER NOT NULL DEFAULT 0,
  released INTEGER NOT NULL DEFAULT 1
);
DROP INDEX IF EXISTS addresses_pool;
CREATE INDEX addresses_pool ON addresses (
  pool
);
DROP INDEX IF EXISTS addresses_address;
CREATE INDEX addresses_address ON addresses (
  address
);
DROP INDEX IF EXISTS addresses_identity;
CREATE INDEX addresses_identity ON addresses (
  identity
);

CREATE TABLE leases (
  id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
  address INTEGER NOT NULL,
  identity INTEGER NOT NULL,
  acquired INTEGER NOT NULL,
  released INTEGER NOT NULL
);

CREATE TABLE attribute_pools (
  id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
  name TEXT NOT NULL
);

CREATE TABLE attributes (
  id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
  identity INTEGER NOT NULL DEFAULT 0,
  pool INTEGER NOT NULL DEFAULT 0,
  type INTEGER NOT NULL,
  value BLOB NOT NULL
);
DROP INDEX IF EXISTS attributes_identity;
CREATE INDEX attributes_identity ON attributes (
  identity
);
DROP INDEX IF EXISTS attributes_pool;
CREATE INDEX attributes_pool ON attributes (
  pool
);

CREATE TABLE ike_sas (
  local_spi BLOB NOT NULL PRIMARY KEY,
  remote_spi BLOB NOT NULL,
  id INTEGER NOT NULL,
  initiator INTEGER NOT NULL,
  local_id_type INTEGER NOT NULL,
  local_id_data BLOB DEFAULT NULL,
  remote_id_type INTEGER NOT NULL,
  remote_id_data BLOB DEFAULT NULL,
  host_family INTEGER NOT NULL,
  local_host_data BLOB NOT NULL,
  remote_host_data BLOB NOT NULL,
  created INTEGER NOT NULL DEFAULT CURRENT_TIMESTAMP
);

CREATE TABLE logs (
  id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
  local_spi BLOB NOT NULL,
  signal INTEGER NOT NULL,
  level INTEGER NOT NULL,
  msg TEXT NOT NULL,
  time INTEGER NOT NULL DEFAULT CURRENT_TIMESTAMP
);

/* Identities */

INSERT INTO identities (
  type, data
) VALUES ( /* C=CH, O=strongSwan Project, CN=strongSwan Root CA */
  9, X'3047310b3009060355040613024348311b3019060355040a13127374726f6e675377616e2050726f6a656374311b3019060355040313127374726f6e675377616e20526f6f74204341'
);

INSERT INTO identities (
  type, data
) VALUES ( /* subjkey of 'C=CH, O=strongSwan Project, CN=strongSwan Root CA' */
  11, X'288a0bd0d28511dae59ffa160ab021d708922d67'
);

INSERT INTO identities (
  type, data
) VALUES ( /* keyid of 'C=CH, O=strongSwan Project, CN=strongSwan Root CA' */
  11, X'91f8e4475f0bc75a388624bcf0a56fe6a45f0c2a'
);

INSERT INTO identities (
  type, data
) VALUES ( /* C=CH, O=strongSwan Project, OU=Research, CN=Research CA */
  9, X'3053310b3009060355040613024348311b3019060355040a13127374726f6e675377616e2050726f6a6563743111300f060355040b13085265736561726368311430120603550403130b5265736561726368204341'
);

INSERT INTO identities (
  type, data
) VALUES ( /* subjkey of 'C=CH, O=strongSwan Project, OU=Research, CN=Research CA' */
  11, X'95a87b22955d762576f53d93d5d98411b50d805c'
);

INSERT INTO identities (
  type, data
) VALUES ( /* keyid of 'C=CH, O=strongSwan Project, OU=Research, CN=Research CA' */
  11, X'2906223c6a73c1f1f7f597a15c6f297b59ce2267'
);

INSERT INTO identities (
  type, data
) VALUES ( /* carol@strongswan.org */
  3, X'6361726f6c407374726f6e677377616e2e6f7267'
);

INSERT INTO identities (
  type, data
) VALUES ( /* subjkey of 'C=CH, O=strongSwan Project, OU=Research, CN=carol@strongswan.org' */
  11, X'747990dd82c10b35b01fe73179aa101a938cab09'
);

INSERT INTO identities (
  type, data
) VALUES ( /* moon.strongswan.org */
  2, X'6d6f6f6e2e7374726f6e677377616e2e6f7267'
);

/* Certificates */

INSERT INTO certificates (
   type, keytype, data
) VALUES ( /* C=CH, O=strongSwan Project, CN=strongSwan Root CA */
  1, 1, X'30820455308202bda00302010202083e9346d3b12d6782300d06092a864886f70d01010b05003047310b3009060355040613024348311b3019060355040a13127374726f6e675377616e2050726f6a656374311b3019060355040313127374726f6e675377616e20526f6f74204341301e170d3235313130363030313332365a170d3335313130373030313332365a3047310b3009060355040613024348311b3019060355040a13127374726f6e675377616e2050726f6a656374311b3019060355040313127374726f6e675377616e20526f6f74204341308201a2300d06092a864886f70d01010105000382018f003082018a0282018100997a7e790296b1dfe697090d480043ab51d6deb0a4415223a2dcdd7cfee9f2aba271ed293f12691ba6fd3bf3b477e7dfa4e57778dca316075725056c0a35cc273aed5411b04663998f04eccb8066082d615f15e0588469a595acadfa8fcfeaa5bacc09192c4a4c45792672e291a4da45708561ac6b8c5ed5aaf5a25761c6357d18875b0391cbd4c6265351c814bea4fcc9fbd3e606794f02d89326162ab86e9194f30840e920c192c2d97129e8e93e08543ba8c4cb2c057b9e64215b5ec93a5cd8ef040b3e4df77e617cb4c79afa94385e2c90de44910d4fa112db3deef80589851ba090405c70a061ac752391963eb68c837bfbb8a5ead5f30b54c797591c4ab42904c4930994452b9b776f983c7e3debe5b1ce5b029e5daab6e720e7bc54d4dac75a702cbd809e695b6d9916cac2279a5c04ba6eaab70646274efb99600604604b836542140b43020ad6b2c33c2f8326fd4a34391e2011092d321e84820425bb6562428138ad630cf12ce66de2d85b33151ec43e4504c722f1384e80accbb10203010001a345304330120603551d130101ff040830060101ff020101300e0603551d0f0101ff040403020106301d0603551d0e04160414288a0bd0d28511dae59ffa160ab021d708922d67300d06092a864886f70d01010b050003820181007ccad9c8210802532b184e5fbd23a15cf6830ca783c5cefd1485ea7dd9e5a339074c6e089193d41d4402f31f260be503ab54aa5fc710261ca72455c3aec5f66224ccac23c57b901aaf8df4d878151082765ae6ed854204ec6342dcf6c091852d094ceb528beb7699a1e58d13f3072aa432e74a72ceee4ef57d6deb5963ddaeef15cbec267247a05c1cf2824a5a774bcf31e75f480e17b24568ba547d04ca9a905797cffee0fa309044389b5e23c2c2cb08c18f42a049b5f613f9c75c9cb42d57dc2181877dc8f7351a6d2c1ad81eba12d56b52f96609b696bb6e01ddec0efd893cca413f6b99216930ac4f0e152ac1773f18016323b408b8fc5e0b0acb46a515647cfe6678268ee85637381c8a0497559261e03205e057fcc3303fd0c9cb9183cb1de89c6ea5e7cd95aeb8b5a4413420035ff233d876d4480c0202462184a9a462afcd6502dd1b1badfd590609281fd68e0daf5ad62e2789c92763e843f0cb8cf5fdca9e847533c791a54ae574373e1f4fbc966d90f7fcc994859c7971050f7f'
);

INSERT INTO certificates (
   type, keytype, data
) VALUES ( /* C=CH, O=strongSwan Project, OU=Research, CN=Research CA */
  1, 1, X'308204b53082031da00302010202010b300d06092a864886f70d01010b05003047310b3009060355040613024348311b3019060355040a13127374726f6e675377616e2050726f6a656374311b3019060355040313127374726f6e675377616e20526f6f74204341301e170d3235313130363030313332365a170d3334313130373030313332365a3053310b3009060355040613024348311b3019060355040a13127374726f6e675377616e2050726f6a6563743111300f060355040b13085265736561726368311430120603550403130b5265736561726368204341308201a2300d06092a864886f70d01010105000382018f003082018a0282018100d392ee64697ceecce498d9ed16d254183fcea98c4776465d4ad9ccbf51335b0997478a8dbd9f8069ae6ec60c5a0852c8d12c6b15c00b3c785a3cd61c33364215920b766dc9d9f3f82b248b00a1e37807de6291a844d05ae2a0bd03c65e8b8d6c356ca7407b82fccc13d56752ceeaef73339b52ae390df71910f3c6bc96eac016e65496d15943d67bb846ce50fd81b0eb7672ae8d83090e142e121d2e1bf703acb7cf7985dd3d1c15a495b9060bb721be22184eaad0e9ea40bc31d5d4858610a92a89cbacc0e89a233e1a8c677a151df9fbabed7abfcf93ae2461c0bdafcd39bdfa265646b7355102ec5b13766f6964893c17f0feae5609a273e5bef5161d6f1527f719754465f32e6fa73e9f696ec3e29109b0b7d6051c6564dedd6facbe6015ca52c92833a03258d7d30169203d3db32323083168b13fe884801f021628640214e046e0e777ca5f1cdf07a621ba1b583ef25eda9c26c0f6c8e53aa082d86b6e304dfce62a8555f7e83e8c0a3aa88b4a313ae4d7a31813e862aaf1f43a9045790203010001a3819f30819c300f0603551d130101ff040530030101ff300e0603551d0f0101ff040403020106301d0603551d0e0416041495a87b22955d762576f53d93d5d98411b50d805c301f0603551d23041830168014288a0bd0d28511dae59ffa160ab021d708922d6730390603551d1f04323030302ea02ca02a8628687474703a2f2f63726c2e7374726f6e677377616e2e6f72672f7374726f6e677377616e2e63726c300d06092a864886f70d01010b05000382018100909e0f714743dfbf7739c8e730d526decdba1be7bcd304d9aebb98548b38a7eae25900e688e9f1927614eb288e94a5545d2b1d3b9f2100f4fdba8bdd4e06d8d4ed0f7bf4ad44597f74e291f4e0f23d6276d4becc34c802a6fca3f5448ac4fed11490bdf2f9065c0beedb23432985636b142a39405d542ca897df02034ba8ee32a6e62fed103d9950fb678e5ba2bd0362f8b4491371bdf85770852ac3bad4482c97c7c7a38577648c420e75f2eee3b9c421105a2c92780acc47e26eecef1e411e26c76f35ef4acf6f7fec10527d2fcce6a8667379c5f3e9b96e877e3dc428b8058405d9626e53450850dc23d29c1adf7115563bde15a4a5255a4ec549b965a569af88e0a838635f8aa3121aabeffa45de37a1198edfd557eea9e007092883d4bed366ff579a0c646fd35920dfa8ed3d7150489cd7662998c8bce6bd1ee6b5376657a0d91fdf64be3be60048189d5a9969f8b10a134f0215786677e35d8b123c1bef79825e70f37136acb69b457ee835f1d5078c2ce0859ab21060fd525b674591'
);

INSERT INTO certificates (
   type, keytype, data
) VALUES ( /* C=CH, O=strongSwan Project, OU=Research, CN=carol@strongswan.org */
  1, 1, X'308204a73082030fa003020102020101300d06092a864886f70d01010b05003053310b3009060355040613024348311b3019060355040a13127374726f6e675377616e2050726f6a6563743111300f060355040b13085265736561726368311430120603550403130b5265736561726368204341301e170d3235313130363030313332365a170d3333313130363030313332365a305c310b3009060355040613024348311b3019060355040a13127374726f6e675377616e2050726f6a6563743111300f060355040b13085265736561726368311d301b06035504030c146361726f6c407374726f6e677377616e2e6f7267308201a2300d06092a864886f70d01010105000382018f003082018a0282018100afcd173bf1243a1c0af834a4d4110a22bf60b4335432438c2b3c573a486530152cdc1830228a3fa7e5fbca7da5d5b2a1b6435645f3f99f04706a0f53094eeb82c8b8950b08b030f59f98c63fa71d669c934cca5e5e6b004f46febb8fc60f69ec2c70c09a1d07ae9f58ed5d5a667e04dd952948521463910debd9de83c0285f5938e91a0c8a6a8278811c499f33101edc35dde4f29647728a3f19bcf6a6cbdba79228c6d791d61f9b9d4ba84d0b8bdf7c1f2d39028d2400ed0b56fd9009d0fb4e5d3326a8500bd5b95d62fdc5c4e05e2aa5b195a01d8420ddd9751b2ec1cfa7179a6dbc984f504ef00be0870287b4d2cf4dd18c43ca5857239fc533b6d215a97fdc3fd9b88725d82e213fa4508aaa91cbe82a2960210cae2849500dfd257519f603387aaf4c2f86dce5d8e859b681b5aae460e6b6484fc06cf0eaf15d322e16c2c01cafb76aa711772e2b1b710c5516b56ad7becbeb747a0d0e8bf41f6ca21e67b4e15a4c57a174ecbb359f6ce91031e232a8cc51aa780ae539b1aaf867aeb1870203010001a37d307b301f0603551d2304183016801495a87b22955d762576f53d93d5d98411b50d805c301f0603551d110418301681146361726f6c407374726f6e677377616e2e6f726730370603551d1f0430302e302ca02aa0288626687474703a2f2f63726c2e7374726f6e677377616e2e6f72672f72657365617263682e63726c300d06092a864886f70d01010b0500038201810076b2ccbbb025185a08e67a4fb89bf233cf888168a67ef8aba62f653bb5f92e5b56712db69e404267785dfbfe2c9fafcd83bc569ff2fc3dab907ab21f34643321e7fc403a37ce51f41eae060b9379a0e4b9e867287771f44f7cd665596858144140b99abbcecc56a25fd79dd32cc8cc5ff8f2dca3a43b3c2ccfbb6b2e8287c9abc9850dc5681857195214a4c8e65797e728afb125bc0a308c52c281a0dc35bef5bdbecfcea31c21946548e8f6e6e20f39b5aee889b55957fa2199ed8f8f4895413872a4b2aa0a5eaf23c03e52f38ee5e8de409122da5208a79a6e4ce3178544f0430511039b88e9372aabe1a1af2c2cbfd1116fb2ea8e7fbcf8f0ec242498d64a0694918ed92a8f5d524e830fb4f953cf261a58d858dbc097a13d60caa08656c923fc9067e1f26d2571c308fd53d1ebbc2b277304f2625cd18cb7c470d67ae41e5ba32caedf8e404828d09a21d0b87dd106ca0e39b3dbccb3962b37e7856809f10982f5e66c3983774d81147b1563c385c7e0e3579c7973d8284a9f4ed65b1e39'
);

INSERT INTO certificate_identity (
  certificate, identity
) VALUES (
  1, 1
);

INSERT INTO certificate_identity (
  certificate, identity
) VALUES (
  1, 2
);

INSERT INTO certificate_identity (
  certificate, identity
) VALUES (
  1, 3
);

INSERT INTO certificate_identity (
  certificate, identity
) VALUES (
  2, 4
);

INSERT INTO certificate_identity (
  certificate, identity
) VALUES (
  2, 5
);

INSERT INTO certificate_identity (
  certificate, identity
) VALUES (
  2, 6
);

INSERT INTO certificate_identity (
  certificate, identity
) VALUES (
  3, 7
);

INSERT INTO certificate_identity (
  certificate, identity
) VALUES (
  3, 8
);

/* Private Keys */

INSERT INTO private_keys (
   type, data
) VALUES ( /* key of 'C=CH, O=strongSwan Project, OU=Research, CN=carol@strongswan.org' */
  1, X'308206e30201000282018100afcd173bf1243a1c0af834a4d4110a22bf60b4335432438c2b3c573a486530152cdc1830228a3fa7e5fbca7da5d5b2a1b6435645f3f99f04706a0f53094eeb82c8b8950b08b030f59f98c63fa71d669c934cca5e5e6b004f46febb8fc60f69ec2c70c09a1d07ae9f58ed5d5a667e04dd952948521463910debd9de83c0285f5938e91a0c8a6a8278811c499f33101edc35dde4f29647728a3f19bcf6a6cbdba79228c6d791d61f9b9d4ba84d0b8bdf7c1f2d39028d2400ed0b56fd9009d0fb4e5d3326a8500bd5b95d62fdc5c4e05e2aa5b195a01d8420ddd9751b2ec1cfa7179a6dbc984f504ef00be0870287b4d2cf4dd18c43ca5857239fc533b6d215a97fdc3fd9b88725d82e213fa4508aaa91cbe82a2960210cae2849500dfd257519f603387aaf4c2f86dce5d8e859b681b5aae460e6b6484fc06cf0eaf15d322e16c2c01cafb76aa711772e2b1b710c5516b56ad7becbeb747a0d0e8bf41f6ca21e67b4e15a4c57a174ecbb359f6ce91031e232a8cc51aa780ae539b1aaf867aeb187020301000102820180070bfe896d92192e34965c6ddafe4fdcb2b52aa40014ffb627a98489968b4fd1197a3d11f8e077cac02246aca0b01f37f23962c4ed11ad791d147346cdd1b7090808b618ba216de4fa9fc21a9d15459eb31cd9e3cc7f1785160071fe425f2dccc4bf4449292ebca630875b3d9b6c23bfca11dc8f45b7f4018dd9aedcb3202b2a4568ba9d9412cee60baed998a3105b5c526071a3f3b82b7435314fecc724d6ca31c6a6a9cf73b8d2a10c7e539049ec0c6aa7826882c5d5afaacbb2e04a34714e52d3cbc59ab988ab08a1e87b26b3b38ce44fa1163508740ff160374346bff8007be01585cbb393ca703032b28cb84d780693dc0feabb795dd01b79c6bbcea2f4a123900b96d39301c72ec1a94cc8c02c3db3698c000d20bca0e58ebe699465cae4f0f1fc0a7ef61723a7669e4ba14069d3c28b613d6e6b16f48cf8a60bf64bc802b2ee1f5466216f4d212eeef3d93d88d17305e28febeceb64df2ae46536eb753460ba62624dfa612109cc0a57262bf2e471d7baec8d89204a7bc72fef5905390281c100db392921fbc24a9f30f58540a4016745b3fbeefc66f07e5dfca33609a2a8225a986f24e8fcc7e8cab307f970e6e97891953d28f367819c2b13af5631ec3e1485da6ef4bb4ae4773a7e9b4661899f46db5760873c537771705ef0872cddd27fd15d4ce218f0454e070b182c5279c6bd2d10e1b0463f078d6e4bdf6e12f3b87d077076930d1b287c5ac3258e48ed975797a654a3ab5102ae208f60d5eedf9feb25e450d0613b34393019343334b9e5d1d662963e28b1011f8dde660dc9c8625b050281c100cd4b1b800b48b9b9ab5007aaebc67ae173126257e2c122698101c72e15f8608a5892627d36237da1351e0bb1741452e67fc718c9703fac8537dc61a3ed68385fa3456d1c877874365eaae947ee9f07cc3aad0e76aca1ed2038e63ca84b426214ca2fea594f0d263673b2301ecbbba60a9fb709a1c101fc181d351ab991becf65823b21385757d051791aca0ca919cc8f016effafdf7d1dc01480fe76b44003e26d7707b7017ece187cb0882c91bc0d800821bd8b141ef420eb9c877a94ae381b0281c00f795f6fe8a77440fc61b84031d36f88ba05a47ee87d3d4e4110fc357de7c45504c183a776805dec40eae52e94fe11e6a4d42659d80a8c0d765c40075217a7b7330df5f46a7ae9f7950c3cd191b74e771919d531eaea5975871e0f4c9973cc55e8f20e5b984a2c11cf34ab9c3ec04a862dd4e06e74f08189318dd9e53892e3306d3dd16f71655031cfe88cbc9518c3b40ea796cdf6efeb7e9ce046f98f8b683bca7bf1d98b264a8b1c9c54a8fa1e40cb9335ebb94f9536b6fae5d53f5307ae490281c1008fd3ee19604e7c685b607f6ebd2eda4a774f4afd1dcd87e978cba11b65a31527f7f3def2b06a5f0b0166e27459ca1f6683e11e398adde16598045b97f8ad4ac99e5ef699c5439bcfb7b57028c8423cb955e686ba9829fe32d40a6236da3b50f215d14a1375f1d572d2cde52ebe37e29590de30ee5585a973cf8ab4058cd9acfe06269d189700dbdf28c49f080db5187e9c5782e559e393634e3a2d8d46ad8ecb253bfe78b5a07c8de555dca1b51c962cbc05bf80e000ebb2e0bf529f8be91f3f0281c030ca26fac1bf868d06231381b8d4f54b83cf9fe20e8495bd4952685c695a1c4942e447b0904b60a2da2d7f785341003834d55da46afee98272f5b7c1cf95dee1ace129c6bd1f986224413889707a0d58bd8aa138dc655f08e76697f75e0018eda2eed9d86d8f3b0188b7b70eafa9dfb1ae6c85a052da900ecc220bb8fb8a57c0179ec1cdfd51f0e9ef20c3890b7b9b8be9dd50576d9bc374317eb871eb67833f936cc7057617434187a00ad02ced383ab0b445ae989d2ae8c8bfb6c119979d9a'
);

INSERT INTO private_key_identity (
  private_key, identity
) VALUES (
  1, 7
);

INSERT INTO private_key_identity (
  private_key, identity
) VALUES (
  1, 8
);

/* Configurations */

INSERT INTO ike_configs (
  local, remote
) VALUES (
  '192.168.0.100', '192.168.0.1'
);

INSERT INTO peer_configs (
  name, ike_cfg, local_id, remote_id
) VALUES (
  'home', 1, 7, 9
);

INSERT INTO child_configs (
  name, updown
) VALUES (
  'home', '/usr/local/libexec/ipsec/_updown iptables'
);

INSERT INTO peer_config_child_config (
  peer_cfg, child_cfg
) VALUES (
  1, 1
);

INSERT INTO traffic_selectors (
  type, start_addr, end_addr
) VALUES ( /* 10.1.0.0/16 */
  7, X'0a010000', X'0a01ffff'
);

INSERT INTO traffic_selectors (
  type
) VALUES ( /* dynamic/32 */
  7
);

INSERT INTO child_config_traffic_selector (
  child_cfg, traffic_selector, kind
) VALUES (
  1, 1, 1
);

INSERT INTO child_config_traffic_selector (
	child_cfg, traffic_selector, kind
) VALUES (
  1, 2, 2
);

