Fixes sql schemas
parent
7e67b2907b
commit
89076d3aeb
|
@ -1,5 +0,0 @@
|
|||
INSERT OR IGNORE INTO jilo_agent_types VALUES(1,'jvb','/jvb');
|
||||
INSERT OR IGNORE INTO jilo_agent_types VALUES(2,'jicofo','/jicofo');
|
||||
INSERT OR IGNORE INTO jilo_agent_types VALUES(3,'prosody','/prosody');
|
||||
INSERT OR IGNORE INTO jilo_agent_types VALUES(4,'nginx','/nginx');
|
||||
INSERT OR IGNORE INTO jilo_agent_types VALUES(5,'jibri','/jibri');
|
|
@ -1,16 +0,0 @@
|
|||
INSERT OR IGNORE INTO rights (`id`, `name`) VALUES(1,'superuser');
|
||||
INSERT OR IGNORE INTO rights (`name`) VALUES('edit users');
|
||||
INSERT OR IGNORE INTO rights (`name`) VALUES('view config file');
|
||||
INSERT OR IGNORE INTO rights (`name`) VALUES('edit config file');
|
||||
INSERT OR IGNORE INTO rights (`name`) VALUES('view own profile');
|
||||
INSERT OR IGNORE INTO rights (`name`) VALUES('edit own profile');
|
||||
INSERT OR IGNORE INTO rights (`name`) VALUES('view all profiles');
|
||||
INSERT OR IGNORE INTO rights (`name`) VALUES('edit all profiles');
|
||||
INSERT OR IGNORE INTO rights (`name`) VALUES('view app logs');
|
||||
INSERT OR IGNORE INTO rights (`name`) VALUES('view all platforms');
|
||||
INSERT OR IGNORE INTO rights (`name`) VALUES('edit all platforms');
|
||||
INSERT OR IGNORE INTO rights (`name`) VALUES('view all agents');
|
||||
INSERT OR IGNORE INTO rights (`name`) VALUES('edit all agents');
|
||||
INSERT OR IGNORE INTO rights (`name`) VALUES('edit whitelist');
|
||||
INSERT OR IGNORE INTO rights (`name`) VALUES('edit blacklist');
|
||||
INSERT OR IGNORE INTO rights (`name`) VALUES('edit ratelimiting');
|
|
@ -14,7 +14,6 @@ CREATE TABLE users_meta (
|
|||
bio TEXT,
|
||||
FOREIGN KEY (user_id) REFERENCES users(id)
|
||||
);
|
||||
|
||||
CREATE TABLE users_rights (
|
||||
user_id INTEGER,
|
||||
right_id INTEGER,
|
||||
|
@ -26,47 +25,25 @@ CREATE TABLE rights (
|
|||
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
name TEXT NOT NULL UNIQUE
|
||||
);
|
||||
|
||||
CREATE TABLE login_attempts (
|
||||
INSERT INTO rights VALUES(1,'superuser');
|
||||
INSERT INTO rights VALUES(2,'edit users');
|
||||
INSERT INTO rights VALUES(3,'view config file');
|
||||
INSERT INTO rights VALUES(4,'edit config file');
|
||||
INSERT INTO rights VALUES(5,'view own profile');
|
||||
INSERT INTO rights VALUES(6,'edit own profile');
|
||||
INSERT INTO rights VALUES(7,'view all profiles');
|
||||
INSERT INTO rights VALUES(8,'edit all profiles');
|
||||
INSERT INTO rights VALUES(9,'view app logs');
|
||||
INSERT INTO rights VALUES(10,'view all platforms');
|
||||
INSERT INTO rights VALUES(11,'edit all platforms');
|
||||
INSERT INTO rights VALUES(12,'view all agents');
|
||||
INSERT INTO rights VALUES(13,'edit all agents');
|
||||
CREATE TABLE platforms (
|
||||
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
ip_address TEXT NOT NULL,
|
||||
username TEXT NOT NULL,
|
||||
attempted_at TEXT DEFAULT (DATETIME('now')),
|
||||
name TEXT NOT NULL UNIQUE,
|
||||
jitsi_url TEXT NOT NULL,
|
||||
jilo_database TEXT NOT NULL
|
||||
);
|
||||
|
||||
CREATE TABLE ip_whitelist (
|
||||
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
ip_address TEXT NOT NULL UNIQUE,
|
||||
is_network BOOLEAN DEFAULT 0 CHECK(is_network IN (0, 1)),
|
||||
description TEXT,
|
||||
created_at TEXT DEFAULT (DATETIME('now')),
|
||||
created_by TEXT,
|
||||
);
|
||||
|
||||
INSERT OR IGNORE INTO ip_whitelist (ip_address, is_network, description, created_by) VALUES
|
||||
('127.0.0.1', 0, 'localhost IPv4', 'system'),
|
||||
('::1', 0, 'localhost IPv6', 'system'),
|
||||
('10.0.0.0/8', 1, 'Private network', 'system'),
|
||||
('172.16.0.0/12', 1, 'Private network', 'system'),
|
||||
('192.168.0.0/16', 1, 'Private network', 'system');
|
||||
|
||||
CREATE TABLE ip_blacklist (
|
||||
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
ip_address TEXT NOT NULL UNIQUE,
|
||||
is_network BOOLEAN DEFAULT 0 CHECK(IS_NETWORK IN (0,1)),
|
||||
reason TEXT,
|
||||
expiry_time TEXT,
|
||||
created_at TEXT DEFAULT (DATETIME('now')),
|
||||
created_by TEXT,
|
||||
);
|
||||
|
||||
INSERT OR IGNORE INTO ip_blacklist (ip_address, is_network, reason, created_by) VALUES
|
||||
('0.0.0.0/8', 1, 'Reserved address space - RFC 1122', 'system'),
|
||||
('100.64.0.0/10', 1, 'Carrier-grade NAT space - RFC 6598', 'system'),
|
||||
('192.0.2.0/24', 1, 'TEST-NET-1 Documentation space - RFC 5737', 'system'),
|
||||
('198.51.100.0/24', 1, 'TEST-NET-2 Documentation space - RFC 5737', 'system'),
|
||||
('203.0.113.0/24', 1, 'TEST-NET-3 Documentation space - RFC 5737', 'system');
|
||||
|
||||
CREATE TABLE logs (
|
||||
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
user_id INTEGET NOT NULL,
|
||||
|
@ -75,44 +52,76 @@ CREATE TABLE logs (
|
|||
message TEXT NOT NULL,
|
||||
FOREIGN KEY (user_id) REFERENCES users(id)
|
||||
);
|
||||
|
||||
CREATE TABLE platforms (
|
||||
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
name TEXT NOT NULL UNIQUE,
|
||||
jitsi_url TEXT NOT NULL,
|
||||
jilo_database TEXT NOT NULL
|
||||
);
|
||||
|
||||
CREATE TABLE hosts (
|
||||
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
address TEXT NOT NULL,
|
||||
port INTEGER NOT NULL,
|
||||
platform_id INTEGER NOT NULL,
|
||||
name TEXT,
|
||||
FOREIGN KEY(platform_id) REFERENCES platforms(id)
|
||||
);
|
||||
|
||||
CREATE TABLE jilo_agents (
|
||||
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
platform_id INTEGER NOT NULL,
|
||||
agent_type_id INTEGER NOT NULL,
|
||||
url TEXT NOT NULL,
|
||||
secret_key TEXT,
|
||||
check_period INTEGER DEFAULT 0,
|
||||
FOREIGN KEY (platform_id) REFERENCES platforms(id),
|
||||
FOREIGN KEY (agent_type_id) REFERENCES jilo_agent_types(id)
|
||||
);
|
||||
CREATE TABLE jilo_agent_types (
|
||||
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
description TEXT,
|
||||
endpoint TEXT
|
||||
CREATE TABLE IF NOT EXISTS "jilo_agent_types" (
|
||||
"id" INTEGER,
|
||||
"description" TEXT,
|
||||
"endpoint" TEXT,
|
||||
PRIMARY KEY("id" AUTOINCREMENT)
|
||||
);
|
||||
INSERT INTO jilo_agent_types VALUES(1,'jvb','/jvb');
|
||||
INSERT INTO jilo_agent_types VALUES(2,'jicofo','/jicofo');
|
||||
INSERT INTO jilo_agent_types VALUES(3,'prosody','/prosody');
|
||||
INSERT INTO jilo_agent_types VALUES(4,'nginx','/nginx');
|
||||
INSERT INTO jilo_agent_types VALUES(5,'jibri','/jibri');
|
||||
CREATE TABLE jilo_agent_checks (
|
||||
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
agent_id INTEGER,
|
||||
timestamp DATETIME DEFAULT CURRENT_TIMESTAMP,
|
||||
status_code INTEGER,
|
||||
response_time_ms INTEGER,
|
||||
response_content TEXT,
|
||||
FOREIGN KEY (agent_id) REFERENCES jilo_agents(id)
|
||||
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
agent_id INTEGER,
|
||||
timestamp DATETIME DEFAULT CURRENT_TIMESTAMP,
|
||||
status_code INTEGER,
|
||||
response_time_ms INTEGER,
|
||||
response_content TEXT,
|
||||
FOREIGN KEY(agent_id) REFERENCES jilo_agents(id)
|
||||
);
|
||||
CREATE TABLE IF NOT EXISTS "jilo_agents" (
|
||||
"id" INTEGER,
|
||||
"platform_id" INTEGER NOT NULL,
|
||||
"agent_type_id" INTEGER NOT NULL,
|
||||
"url" TEXT NOT NULL,
|
||||
"secret_key" TEXT,
|
||||
"check_period" INTEGER DEFAULT 0,
|
||||
PRIMARY KEY("id" AUTOINCREMENT),
|
||||
FOREIGN KEY("agent_type_id") REFERENCES "jilo_agent_types"("id"),
|
||||
FOREIGN KEY("platform_id") REFERENCES "platforms"("id")
|
||||
);
|
||||
CREATE TABLE IF NOT EXISTS "hosts" (
|
||||
"id" INTEGER NOT NULL,
|
||||
"address" TEXT NOT NULL,
|
||||
"port" INTEGER NOT NULL,
|
||||
"platform_id" INTEGER NOT NULL,
|
||||
"name" TEXT,
|
||||
PRIMARY KEY("id" AUTOINCREMENT),
|
||||
FOREIGN KEY("platform_id") REFERENCES "platforms"("id")
|
||||
);
|
||||
CREATE TABLE login_attempts (
|
||||
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
ip_address TEXT NOT NULL,
|
||||
username TEXT NOT NULL,
|
||||
attempted_at TEXT DEFAULT (DATETIME('now'))
|
||||
);
|
||||
CREATE TABLE ip_whitelist (
|
||||
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
ip_address TEXT NOT NULL UNIQUE,
|
||||
is_network BOOLEAN DEFAULT 0 CHECK(is_network IN (0,1)),
|
||||
description TEXT,
|
||||
created_at TEXT DEFAULT (DATETIME('now')),
|
||||
created_by TEXT
|
||||
);
|
||||
INSERT INTO ip_whitelist VALUES(1,'127.0.0.1',0,'localhost IPv4','2025-01-04 11:39:08','system');
|
||||
INSERT INTO ip_whitelist VALUES(2,'::1',0,'localhost IPv6','2025-01-04 11:39:08','system');
|
||||
INSERT INTO ip_whitelist VALUES(3,'10.0.0.0/8',1,'Private network (Class A)','2025-01-04 11:39:08','system');
|
||||
INSERT INTO ip_whitelist VALUES(4,'172.16.0.0/12',1,'Private network (Class B)','2025-01-04 11:39:08','system');
|
||||
INSERT INTO ip_whitelist VALUES(5,'192.168.0.0/16',1,'Private network (Class C)','2025-01-04 11:39:08','system');
|
||||
CREATE TABLE ip_blacklist (
|
||||
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
ip_address TEXT NOT NULL UNIQUE,
|
||||
is_network BOOLEAN DEFAULT 0 CHECK(is_network IN (0,1)),
|
||||
reason TEXT,
|
||||
expiry_time TEXT NULL,
|
||||
created_at TEXT DEFAULT (DATETIME('now')),
|
||||
created_by TEXT
|
||||
);
|
||||
INSERT INTO ip_blacklist VALUES(1,'0.0.0.0/8',1,'Reserved address space - RFC 1122',NULL,'2025-01-04 11:39:08','system');
|
||||
INSERT INTO ip_blacklist VALUES(2,'100.64.0.0/10',1,'Carrier-grade NAT space - RFC 6598',NULL,'2025-01-04 11:39:08','system');
|
||||
INSERT INTO ip_blacklist VALUES(3,'192.0.2.0/24',1,'TEST-NET-1 Documentation space - RFC 5737',NULL,'2025-01-04 11:39:08','system');
|
||||
INSERT INTO ip_blacklist VALUES(4,'198.51.100.0/24',1,'TEST-NET-2 Documentation space - RFC 5737',NULL,'2025-01-04 11:39:08','system');
|
||||
INSERT INTO ip_blacklist VALUES(5,'203.0.113.0/24',1,'TEST-NET-3 Documentation space - RFC 5737',NULL,'2025-01-04 11:39:08','system');
|
||||
|
|
|
@ -0,0 +1,27 @@
|
|||
|
||||
INSERT INTO users VALUES(1,'demo1','$2y$10$LtV9m.rMCJ.K/g45e6tzDexZ8C/9xxu3qFCkvz92pUYa7Jg06np0i');
|
||||
INSERT INTO users VALUES(2,'demo','$2y$10$tLCLvgYu91gf/zBoc58Am.iVls/SOMcIXO3ykGfgFFei9yneZTrb2');
|
||||
|
||||
INSERT INTO users_meta VALUES(1,1,'admin user','admin@example.com',NULL,NULL,'This is a demo user of the demo install of Jilo Web');
|
||||
INSERT INTO users_meta VALUES(2,2,'demo user','demo@example.com',NULL,NULL,'This is a demo user of the demo install of Jilo Web');
|
||||
|
||||
INSERT INTO platforms VALUES(1,'meet.lindeas.com','https://meet.lindeas.com','../jilo-meet.lindeas.db');
|
||||
INSERT INTO platforms VALUES(2,'example.com','https://meet.example.com','../jilo.db');
|
||||
|
||||
INSERT INTO logs VALUES(1,2,'2024-09-30 09:54:50','user','Logout: User "demo" logged out. IP: 151.237.101.43');
|
||||
INSERT INTO logs VALUES(2,2,'2024-09-30 09:54:54','user','Login: User "demo" logged in. IP: 151.237.101.43');
|
||||
INSERT INTO logs VALUES(3,2,'2024-10-03 16:34:49','user','Logout: User "demo" logged out. IP: 151.237.101.43');
|
||||
INSERT INTO logs VALUES(4,2,'2024-10-03 16:34:56','user','Login: User "demo" logged in. IP: 151.237.101.43');
|
||||
INSERT INTO logs VALUES(5,2,'2024-10-09 11:08:16','user','Logout: User "demo" logged out. IP: 151.237.101.43');
|
||||
INSERT INTO logs VALUES(6,2,'2024-10-09 11:08:20','user','Login: User "demo" logged in. IP: 151.237.101.43');
|
||||
INSERT INTO logs VALUES(7,2,'2024-10-17 16:22:57','user','Logout: User "demo" logged out. IP: 151.237.101.43');
|
||||
INSERT INTO logs VALUES(8,2,'2024-10-17 16:23:08','user','Login: User "demo" logged in. IP: 151.237.101.43');
|
||||
INSERT INTO logs VALUES(9,2,'2024-10-18 08:07:25','user','Login: User "demo" logged in. IP: 42.104.201.119');
|
||||
|
||||
INSERT INTO jilo_agents VALUES(1,1,1,'https://meet.lindeas.com:8081','mysecretkey',5);
|
||||
INSERT INTO jilo_agents VALUES(4,1,2,'https://meet.lindeas.com:8081','mysecretkey',5);
|
||||
INSERT INTO jilo_agents VALUES(7,1,3,'http://meet.lindeas.com:8081','mysecretkey',5);
|
||||
INSERT INTO jilo_agents VALUES(8,1,4,'http://meet.lindeas.com:8081','mysecretkey',5);
|
||||
|
||||
INSERT INTO hosts VALUES(1,'meet.lindeas.com',8888,2,'main machine');
|
||||
INSERT INTO hosts VALUES(2,'meet.example.com',9191,2,'test');
|
Loading…
Reference in New Issue