

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=Sales, CN=Sales CA */
  9, X'304d310b3009060355040613024348311b3019060355040a13127374726f6e675377616e2050726f6a656374310e300c060355040b130553616c65733111300f0603550403130853616c6573204341'
);

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

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

INSERT INTO identities (
  type, data
) VALUES ( /* dave@strongswan.org */
  3, X'64617665407374726f6e677377616e2e6f7267'
);

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

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=Sales CN=Sales CA */
  1, 1, X'308204af30820317a00302010202010c300d06092a864886f70d01010b05003047310b3009060355040613024348311b3019060355040a13127374726f6e675377616e2050726f6a656374311b3019060355040313127374726f6e675377616e20526f6f74204341301e170d3235313130363030313332365a170d3334313130373030313332365a304d310b3009060355040613024348311b3019060355040a13127374726f6e675377616e2050726f6a656374310e300c060355040b130553616c65733111300f0603550403130853616c6573204341308201a2300d06092a864886f70d01010105000382018f003082018a0282018100a51b4f6659f58de737b81dc5a7a8e8b01a4fdc47f3b84cfbbabe2b0a9b446ba4d3b692f93dc8508f98510ac5d1b6b5c0c0e9c667c41e63f0b532984cfb8e9575e2d61f1abe532341bcff69e4dbaaa1b59e7b3c70c7698787efa39f9f43ae5246c6c4b31919c9309e8f0d3012a5f439c5e28e7985730d7ba37d5fff59ad4a953615389ccce0cdb99ead2b465ebf90eb612f83861f741bfb83206797709406065b6ffd0071f6c65a3dc976c01ab7656c3697969682309c0e459285454625c1ff406c62e04ef488697be34f78cb1974e2db4b996bea8fc6bae35f6ac60c746cf38f981724270be9c956139356398c6ef32ee2e660620b7b273cc45a29b782c8ea71d6b8c6ed73a6eaa078ab159c5802f69dd159e4b95f51e3b81d075262b9b94c29276fad60ffe8ff19f7b9b0589cb6d044f72024a2489a4a36ba1a46fae2d505374952caf7bfb4e8797f7af6ab46e81fff3c70f84971055baddf0e8feeccee646b834890b30b78016f039993f9a10753224543c7b612f5676985ff8cd9f6b7823f0203010001a3819f30819c300f0603551d130101ff040530030101ff300e0603551d0f0101ff040403020106301d0603551d0e04160414957f1909b7e433e4c49c36bf2fabd5c5c7b37271301f0603551d23041830168014288a0bd0d28511dae59ffa160ab021d708922d6730390603551d1f04323030302ea02ca02a8628687474703a2f2f63726c2e7374726f6e677377616e2e6f72672f7374726f6e677377616e2e63726c300d06092a864886f70d01010b050003820181007aeb28812e15631e1722110a6cc586bdf567c1a25bb192dc72d610137280b79b76f210b93d2984a2cfa7a0f53332f51b647d2b9983e9f945071ea62850a3f7c89e7bf4b7812f9baa1235d541a643f9975066cdd7c39af7cc2a465aab1b275b78dcf31224c1474016e92b03d7c63c10b8acd9e8e234550185f96691d349febb9fd73127f481f9d7d6283d7dd5e90c16064bb44ddcb0774264e1b46d718203427fdb5dd02938327247b8303b938e1bec7bc803ea1e9e2bcfea7cfd6e53aae132c8ad3eb6e7cd71d0b358987c735b2b8a1951f67fabd82afe8c9103d1857116c0d9340b59e00cb13ec39aa1ce2ded650bfdecc375f6f699f595aec12cc3c2655dc02d5fd38d5065df01082d1e09e69cb76afb3cebf01d67eef0d45b2c998c77cc905a4b3c87bc8c32aff2d8e46e8ce4000704394f2e170b44539932b874989251cfbdf64382ffd4afab76787d3fd2e96d8e90308d11322afb649399a314ac90adac2e1f7a90ce190c1c8902fec67d84da843690cdc78ddcb2848cacc17570df680e'
);

INSERT INTO certificates (
   type, keytype, data
) VALUES ( /* C=CH, O=strongSwan Project, OU=Sales, CN=dave@strongswan.org */
  1, 1, X'3082049930820301a003020102020101300d06092a864886f70d01010b0500304d310b3009060355040613024348311b3019060355040a13127374726f6e675377616e2050726f6a656374310e300c060355040b130553616c65733111300f0603550403130853616c6573204341301e170d3235313130363030313332365a170d3333313130363030313332365a3058310b3009060355040613024348311b3019060355040a13127374726f6e675377616e2050726f6a656374310e300c060355040b130553616c6573311c301a06035504030c1364617665407374726f6e677377616e2e6f7267308201a2300d06092a864886f70d01010105000382018f003082018a0282018100b65c585e9adace4f7fa3b863c6ca1a1bb4ba9d34601492c2ad47b6ab90284200f23b7f0205fdc67d0166e2d2b87fbe4e2b133486e4e078762d39f01bd35a63903fdb081a05967e993ca5eda5b4a92744e7f4baa5423a4aeb3f11751c5a4c7b3229579ad6612e8de2c9f7c196b9014181b0d35fa6cd6c5ae60a215cb8005ed6f405e4810b53d0b97c32c62fe9ab34af628273cc1ae2139067ea00049babad75e01020249e6d9f223391a902252c4674d58c26f49ae54bdf09147134dd884d5637db531663dc77385a81030c13bc67cfa134b8367fb91ecc4870ce61cbbcef527f0fdd21245855ca8448332cd0d3a7ab5e5b40950ae2c255e661e8057da7fe7a6a64800722c2c09b1e4f31908175809f63bf1a1f810b94370e3c219a709fd142adb0af0fea5906b789d41558c5792b09fc94d4b043bed92f80fabb1f4401cf4088382049a699a23975daad33ce4dfe22cb8f23ddaed40c9df92ef88a8633f931038ec671d1c828dfe7f77e9e3aa23363507072265718adc0866fb806e7b5da2bf70203010001a3793077301f0603551d23041830168014957f1909b7e433e4c49c36bf2fabd5c5c7b37271301e0603551d1104173015811364617665407374726f6e677377616e2e6f726730340603551d1f042d302b3029a027a0258623687474703a2f2f63726c2e7374726f6e677377616e2e6f72672f73616c65732e63726c300d06092a864886f70d01010b0500038201810081dd646c54110016f0bd941150702f733fbfc256c441af9a98af6fef4404193cb90de873f1266dc483925f670f6f29b0a9b31a5e6e1cb72109fdd16595ebd24998ceabc16b65a3d2743b119da33b2c920ce415acf8291b127ac1f91aa01bb5866d3d3f9f146ad4d55d71e0e63b42419be92aa69f0f9c444300757e8794c726a34672277e3459565307e0b96f0c9a6bd87e5f317a91656747da307e0c6b606e983ce50e8dc683a146c27383ab142a3057ae428bb15e567bc755b4c60bc767bc4b7845e69215a9f60c5723aef1be5ea926d2ddad6234efc171ad483ebd16234514dc036562b5bbad3c06f3a959db70b518e553a9df84e821c30f94cd03f20263a5a8a11bca1e2bb996ceceff8ef79c166743cfc7a7e3f1566f2f58683c6c4f5399fcf8cc92b736ec10037fffee22d267c7f415de57133bd6921705e72717896c020e8ef119c3bb2bbd6b95e0130aecc4f85fda08a694e358cab196f8c16dd0bfef1efbde516550bc91a8092e145c665a31f0819b4343e3cc63e09505a281f2047a'
);

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=Sales, CN=dave@strongswan.org' */
  1, X'308206e30201000282018100b65c585e9adace4f7fa3b863c6ca1a1bb4ba9d34601492c2ad47b6ab90284200f23b7f0205fdc67d0166e2d2b87fbe4e2b133486e4e078762d39f01bd35a63903fdb081a05967e993ca5eda5b4a92744e7f4baa5423a4aeb3f11751c5a4c7b3229579ad6612e8de2c9f7c196b9014181b0d35fa6cd6c5ae60a215cb8005ed6f405e4810b53d0b97c32c62fe9ab34af628273cc1ae2139067ea00049babad75e01020249e6d9f223391a902252c4674d58c26f49ae54bdf09147134dd884d5637db531663dc77385a81030c13bc67cfa134b8367fb91ecc4870ce61cbbcef527f0fdd21245855ca8448332cd0d3a7ab5e5b40950ae2c255e661e8057da7fe7a6a64800722c2c09b1e4f31908175809f63bf1a1f810b94370e3c219a709fd142adb0af0fea5906b789d41558c5792b09fc94d4b043bed92f80fabb1f4401cf4088382049a699a23975daad33ce4dfe22cb8f23ddaed40c9df92ef88a8633f931038ec671d1c828dfe7f77e9e3aa23363507072265718adc0866fb806e7b5da2bf702030100010282018019830cc7db712df8b83a1ed3329dd68e36b7fec33387dd4a47f4a6ed1483554c8d96de3b59bc39970669aee4dcf3de1b507264e05447c5027f6c42179a7764436b73888c1f6900f80e2086812ea7957b51da0e7c8d29db8e52a9ee10d3df2c4305bea0464a9d3933579f0621c06b190f7c3dedfd4772d7baa4032bd60013448e29fee040c5ee86ec85abed4b0aed1976361ade1c8ab142fc0ea40701024107a31b8e6ba11063f9646e85ceeb8568abf2ae234b081a7905505f60410d97027ec3a03eda53f506119445796ee7beeedd5e50f6b841a15d6753872cff15626389d27440fe20742bcfe19bc28ef48e494295e23bfcf27a3d3145773789bff8ad02b73450cf6753d4de5562eee37911e179528d738fcff5a125244fa300cba883c35e2b021f9590ee67ca6ce2ed2278d60f95175a79181b1c4fac4416425038af224e2f03f7c5186d30226ff9bebed2276d2e46e4546632e0126a6e0c1212ac36aa093cdfde8058bd431b48fec6cb1ceb5daf3b26eff350a3f5a9d87c001cee2a40a50281c100dcb0219894f12e285eb9aa80de40358f08cc565478e84d9cca4af085d83b99dcd8fd3b4b2b031ef6dbc21aacc2382572287f0b1030958f8d741d8f20ee704ef80d79422ae2be735d171e50de45b0c1623b29baf2efb208b30b06c1bc0d3ba757393fdca0a26a87fead5945281032b7c3eb5c3e4b46df2dbd33762ad0d17f7d6c9bfe808ab6a16b6e9acf7439bddb07e6df58de8c83071a2288e106db469465672ceafd692940a57d7ea6235e4de3aed65f8da94d59a85cb3121d20ec2997c63b0281c100d38a3e54c519c5468ea18c17eb4d7f42d80072a2e7e5477c3620c28e6f478f887b7e5ee781aabbd1ac99df558d747807105fc08d9d5e55e36bb7b32ce5a4ea3ac2cdc2db3887564e9b661f6e5235d4dff2248b0b68bc2c0dcc90661180536861f220cb2d380392d2e7b4a288ee27d1785dfb7f42546baea032ebb4bbb38fbeb71c5bac590b3041896e681487bc5f44565e29323e709f0febe985d0cb67fd0b9c3075f67d63436cbabe7b082ce7c7c3edc399c0cf98c2bb7dc0ed43beddc589750281c00e3d9b5d623711f86eec623140a63a0e89cdcdc053b101d91d40aab6a856683e550e3a36468744073ff50d8d9a56cf2bc7ab33068f6c0740647ec7cea334421445a24e7fbff3f433cc9b1b32cca27448277330ea1e4789c22bf2faab6cdb2d98364c85ab23efe5e8ac3cf776775d1e78990671ca9fbf250f7173ad9d9df7311bc2113130424ab64903da61309cacb69cd24ac4c9a266e1ebda9352c2f191ffdd218be46055d62317af057f80c55becdb4e7d30b09a198029da0061307c1a9c230281c05e754c7fedc32423ed6c9571d8d0321357005c3001fc8f7f176c6973d09cd3aacdfa0fc6b04fdcae33b441d5a1e46ff4378b8a1fb2357d849f84d7ad249e0f394de3332f507e9e3b5b88ae6044b564e8dae7166f71c514a6d4c165d24acaf3c148acfc0ca5067379599d7f3645a1e2172d602fe31e6f36fab1c22e61e23c3d9ce63cc928b9a6429d6b7f6e2b6e21dc11f4d9d065b1445587b22ede9cf54238fcf566b73a2628e5543dda123c7b02e8aa32bd652b4dbb269d709881b7a8af9c410281c100cf1c9612b68355201cc13f4cfc9788370d24ae7b74500c030d187b6ba68aef3f84f2fbca2bf3da0c7614e83027eff73bda7e0a76761b22578d88b79e670d5f43e7c4b12915dd3b186f4ba24b4e10e41da34dda70a6dff280aa654f2c129599ddec397366f098d852482bdbe5a280ca0214956a647148b7ce6088075b54eb594ce30bd0787fee28c1a1455405880b17ff608ac4e5d73e264cfd2e73fcc59fe09619fc85433480a071c01b01bfa1b53d5b29ae5fd1ecc092499dea0ee56691072d'
);

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.200', '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
);

