···1+-- don't allow table to be modified until we're done...
2+LOCK TABLE users;
3+4+-- delete funcs that belong to users
5+DELETE FROM funcs USING dbs, users
6+WHERE dbs.id=funcs.db_id
7+ AND users.id=dbs.user_id
8+ AND users.cred_id IS NOT NULL;
9+10+-- delete dbs that belong to users
11+DELETE FROM dbs USING users WHERE dbs.user_id=users.id AND users.cred_id IS NOT NULL;
12+13+-- delete all users with creds...
14+DELETE FROM users WHERE cred_id is NOT NULL;
15+DROP TABLE creds CASCADE;
16+17+CREATE UNIQUE INDEX IF NOT EXISTS user_rec ON users(lic_id,lic_data,hostname);
18+CREATE UNIQUE INDEX IF NOT EXISTS user_hn_null ON users (lic_id,lic_data, (hostname IS NULL)) WHERE hostname is NULL;
19+DROP INDEX user_cred_idx;
20+21+ALTER TABLE users DROP COLUMN cred_id;
+22
common/migrations/2024-01-20-215809_users/up.sql
···0000000000000000000000
···1+CREATE TABLE creds (
2+ id SERIAL PRIMARY KEY,
3+4+ username VARCHAR(256) UNIQUE NOT NULL,
5+ email VARCHAR(256) UNIQUE NOT NULL,
6+7+ passwd_salt bytea,
8+ passwd_iters INTEGER NOT NULL DEFAULT 10000,
9+ passwd_hash bytea,
10+11+ last_active TIMESTAMPTZ,
12+ creation_dt TIMESTAMPTZ DEFAULT CURRENT_TIMESTAMP NOT NULL,
13+14+ is_admin BOOLEAN NOT NULL DEFAULT FALSE,
15+ is_enabled BOOLEAN NOT NULL DEFAULT TRUE
16+);
17+18+ALTER TABLE users ADD COLUMN cred_id INTEGER REFERENCES creds(id) ON DELETE CASCADE;
19+20+CREATE UNIQUE INDEX user_cred_idx ON users(lic_id,lic_data,hostname,cred_id) NULLS NOT DISTINCT;
21+DROP INDEX user_hn_null;
22+DROP INDEX user_rec;
+36-3
common/src/config.rs
···1use serde::Deserialize;
02use std::time::Duration;
3use std::{net::SocketAddr, path::PathBuf};
4use toml::from_str;
···9}
1011#[derive(Deserialize)]
012pub struct LuminaServer {
13 pub bind_addr: SocketAddr,
14- pub use_tls: Option<bool>,
15 pub tls: Option<TlsIdentity>,
16 pub server_name: Option<String>,
17- pub allow_deletes: Option<bool>,
1819 /// limit of function histories to return per function.
20 /// `None`, or `Some(0)` will disable the feature on the server.
21- pub get_history_limit: Option<u32>,
00000000000022}
2324#[derive(Deserialize)]
···63}
6465#[derive(Deserialize)]
000000000000000066pub struct Config {
67 pub lumina: LuminaServer,
68 pub api_server: Option<WebServer>,
···7071 #[serde(default)]
72 pub limits: Limits,
00073}
7475pub trait HasConfig {
···111 in_files: &'a [Md5],
112 }
113114- let funcs = [crate::rpc::PullMetadataFunc { unk0: 1, mb_hash: &md5.0 }];
115116 let files_with = state.db.get_files_with_func(&md5.0[..]);
117 let files_info = state.db.get_funcs(&funcs);
···111 in_files: &'a [Md5],
112 }
113114+ let funcs = [crate::rpc::PatternId { ty: 1, data: &md5.0 }];
115116 let files_with = state.db.get_files_with_func(&md5.0[..]);
117 let files_info = state.db.get_funcs(&funcs);
+8-2
config-example.toml
···7server_name = "lumen"
89# Allow clients to delete metadata from the database?
10-allow_deletes = false
11# How many function histories should we return? 0=Disabled.
12get_history_limit = 50
1300000014# only required when `use_tls` is set to true.
15[lumina.tls]
16-# Specify the server's certificate.
17# Clients connecting to the server must match this certificate.
18# If the certificate is password protected, the password can be specified in the `PKCSPASSWD` environment variable.
19server_cert = "path/to/server_crt"
···7server_name = "lumen"
89# Allow clients to delete metadata from the database?
10+allow_deletes = true
11# How many function histories should we return? 0=Disabled.
12get_history_limit = 50
1314+[users]
15+# Enable guest accounts? disabling this will only allow IDA 8.1+ to connect.
16+allow_guests = true
17+# sets the amount of PBKDF2 iterations for storing passwords.
18+pbkdf2_iterations = 120000
19+20# only required when `use_tls` is set to true.
21[lumina.tls]
22+# Specify the server's certificate.
23# Clients connecting to the server must match this certificate.
24# If the certificate is password protected, the password can be specified in the `PKCSPASSWD` environment variable.
25server_cert = "path/to/server_crt"