2009-04-27 20:46:05 +02:00
|
|
|
-- DROP DATABASE ykval;
|
|
|
|
CREATE DATABASE ykval;
|
|
|
|
USE ykval;
|
2009-02-25 13:20:53 +01:00
|
|
|
|
|
|
|
CREATE TABLE clients (
|
2009-04-27 20:46:05 +02:00
|
|
|
id INT NOT NULL AUTO_INCREMENT,
|
|
|
|
active BOOLEAN DEFAULT TRUE,
|
|
|
|
created DATETIME NOT NULL,
|
|
|
|
secret VARCHAR(60) NOT NULL DEFAULT '',
|
2009-05-06 16:16:43 +02:00
|
|
|
email VARCHAR(255),
|
2009-08-28 14:07:35 +02:00
|
|
|
notes VARCHAR(100) DEFAULT '',
|
2009-08-28 14:08:20 +02:00
|
|
|
otp VARCHAR(100) DEFAULT '',
|
2009-04-27 20:46:05 +02:00
|
|
|
PRIMARY KEY (id)
|
2009-02-25 13:20:53 +01:00
|
|
|
);
|
|
|
|
|
|
|
|
CREATE TABLE yubikeys (
|
2009-04-27 20:46:05 +02:00
|
|
|
id INT NOT NULL UNIQUE AUTO_INCREMENT,
|
|
|
|
active BOOLEAN DEFAULT TRUE,
|
|
|
|
created DATETIME NOT NULL,
|
|
|
|
accessed DATETIME,
|
2009-08-31 20:00:05 +02:00
|
|
|
publicName VARCHAR(16) UNIQUE NOT NULL COLLATE ascii_bin,
|
|
|
|
internalName VARCHAR(12) NOT NULL COLLATE ascii_bin,
|
2009-04-27 20:46:05 +02:00
|
|
|
counter INT,
|
|
|
|
low INT,
|
|
|
|
high INT,
|
|
|
|
sessionUse INT,
|
2009-08-28 14:07:35 +02:00
|
|
|
notes VARCHAR(100) DEFAULT '',
|
2009-04-27 20:46:05 +02:00
|
|
|
PRIMARY KEY (id)
|
2009-02-25 13:20:53 +01:00
|
|
|
);
|
2009-04-27 20:52:05 +02:00
|
|
|
|
2009-05-06 16:28:42 +02:00
|
|
|
-- DROP USER 'ykval_verifier'@'localhost';
|
|
|
|
CREATE USER 'ykval_verifier'@'localhost';
|
2009-04-27 20:52:05 +02:00
|
|
|
GRANT SELECT,INSERT,UPDATE(accessed, counter, low, high, sessionUse)
|
|
|
|
ON ykval.yubikeys to 'ykval_verifier'@'localhost';
|
2009-05-06 15:20:40 +02:00
|
|
|
GRANT SELECT(id, secret, active)
|
2009-04-27 21:10:27 +02:00
|
|
|
ON ykval.clients to 'ykval_verifier'@'localhost';
|
2009-08-28 12:55:56 +02:00
|
|
|
|
2009-08-28 13:27:30 +02:00
|
|
|
-- DROP USER 'ykval_getapikey'@'localhost';
|
2009-08-28 12:55:56 +02:00
|
|
|
CREATE USER 'ykval_getapikey'@'localhost';
|
|
|
|
GRANT SELECT(id),INSERT
|
|
|
|
ON ykval.clients to 'ykval_getapikey'@'localhost';
|
|
|
|
|
2009-08-31 10:25:01 +02:00
|
|
|
-- DROP USER 'ykval_revoke'@'localhost';
|
|
|
|
CREATE USER 'ykval_revoke'@'localhost';
|
|
|
|
GRANT UPDATE(active)
|
|
|
|
ON ykval.yubikeys to 'ykval_revoke'@'localhost';
|
|
|
|
GRANT SELECT(publicName)
|
|
|
|
ON ykval.yubikeys to 'ykval_revoke'@'localhost';
|
|
|
|
|
2009-04-27 20:52:05 +02:00
|
|
|
FLUSH PRIVILEGES;
|