···11+-- don't allow table to be modified until we're done...
22+LOCK TABLE users;
33+44+-- delete funcs that belong to users
55+DELETE FROM funcs USING dbs, users
66+WHERE dbs.id=funcs.db_id
77+ AND users.id=dbs.user_id
88+ AND users.cred_id IS NOT NULL;
99+1010+-- delete dbs that belong to users
1111+DELETE FROM dbs USING users WHERE dbs.user_id=users.id AND users.cred_id IS NOT NULL;
1212+1313+-- delete all users with creds...
1414+DELETE FROM users WHERE cred_id is NOT NULL;
1515+DROP TABLE creds CASCADE;
1616+1717+CREATE UNIQUE INDEX IF NOT EXISTS user_rec ON users(lic_id,lic_data,hostname);
1818+CREATE UNIQUE INDEX IF NOT EXISTS user_hn_null ON users (lic_id,lic_data, (hostname IS NULL)) WHERE hostname is NULL;
1919+DROP INDEX user_cred_idx;
2020+2121+ALTER TABLE users DROP COLUMN cred_id;
+22
common/migrations/2024-01-20-215809_users/up.sql
···11+CREATE TABLE creds (
22+ id SERIAL PRIMARY KEY,
33+44+ username VARCHAR(256) UNIQUE NOT NULL,
55+ email VARCHAR(256) UNIQUE NOT NULL,
66+77+ passwd_salt bytea,
88+ passwd_iters INTEGER NOT NULL DEFAULT 10000,
99+ passwd_hash bytea,
1010+1111+ last_active TIMESTAMPTZ,
1212+ creation_dt TIMESTAMPTZ DEFAULT CURRENT_TIMESTAMP NOT NULL,
1313+1414+ is_admin BOOLEAN NOT NULL DEFAULT FALSE,
1515+ is_enabled BOOLEAN NOT NULL DEFAULT TRUE
1616+);
1717+1818+ALTER TABLE users ADD COLUMN cred_id INTEGER REFERENCES creds(id) ON DELETE CASCADE;
1919+2020+CREATE UNIQUE INDEX user_cred_idx ON users(lic_id,lic_data,hostname,cred_id) NULLS NOT DISTINCT;
2121+DROP INDEX user_hn_null;
2222+DROP INDEX user_rec;
···111111 in_files: &'a [Md5],
112112 }
113113114114- let funcs = [crate::rpc::PullMetadataFunc { unk0: 1, mb_hash: &md5.0 }];
114114+ let funcs = [crate::rpc::PatternId { ty: 1, data: &md5.0 }];
115115116116 let files_with = state.db.get_files_with_func(&md5.0[..]);
117117 let files_info = state.db.get_funcs(&funcs);
+8-2
config-example.toml
···77server_name = "lumen"
8899# Allow clients to delete metadata from the database?
1010-allow_deletes = false
1010+allow_deletes = true
1111# How many function histories should we return? 0=Disabled.
1212get_history_limit = 50
13131414+[users]
1515+# Enable guest accounts? disabling this will only allow IDA 8.1+ to connect.
1616+allow_guests = true
1717+# sets the amount of PBKDF2 iterations for storing passwords.
1818+pbkdf2_iterations = 120000
1919+1420# only required when `use_tls` is set to true.
1521[lumina.tls]
1616-# Specify the server's certificate.
2222+# Specify the server's certificate.
1723# Clients connecting to the server must match this certificate.
1824# If the certificate is password protected, the password can be specified in the `PKCSPASSWD` environment variable.
1925server_cert = "path/to/server_crt"
+4-3
lumen/Cargo.toml
···8899[dependencies]
1010common = { path = "../common" }
1111-tokio = { version = "1.39", features = ["full"] }
1111+tokio = { version = "1.32", features = ["full"] }
1212log = { version = "0.4", features = ["release_max_level_debug"] }
1313pretty_env_logger = "0.5"
1414-clap = "4.5"
1414+clap = "4.3"
1515tokio-native-tls = "0.3"
1616native-tls = { version = "0.2" }
1717warp = "0.3"
1818-prometheus-client = "0.22"
1818+prometheus-client = "0.22.0"
1919+rpassword = "7.3.1"