···11# Changelog
2233## [Unreleased] - _TBD_
44+55+## [v0.4.0] - 2024-03-19
66+77+### Added
88+99+- Implemented the function histories command.
1010+- Configurable time limits.
1111+1212+### Fixed
1313+1414+- RPC HelloResult will now report if deletes are enabled.
1515+1616+### Changes
1717+1818+- Applied code formatting using `cargo fmt`
1919+2020+## [v0.3.0] - 2023-08-22
2121+422### Added
2323+524- This changelog.
625- Support for IDA 8.1+ delete command.
726- Pooling for connections to database.
827- Attempt to cancel immutable database queries if client leaves.
928- Database migrations via Diesel ORM.
2929+- Support for IDA 8.3+ hello response.
3030+- Add Metrics for prometheus.
10311132### Fixed
3333+1234- 8K stack size is too small for debug builds.
13351436## [v0.2.0] - 2022-10-12
3737+1538### Added
3939+1640- Protocol: support for IDA 8.1+ user authentication.
1741- Client connection duration limitations.
4242+1843### Changed
4444+1945- Tokio's thread size is reduced from 4M to 8K.
20462121-## [v0.1.0] - 2021-01-21
4747+## [v0.1.0] - 2021-01-21
4848+2249This is Lumen's first tagged release. It contains a few fixes and dependency updates since the initial commit (2020-12-17).
23502424-2525-[Unreleased]: https://github.com/naim94a/lumen/compare/8b78d0a7d5b3ef4e0f221b07903fa5252174b57b...HEAD
2626-[v0.2.0]: https://github.com/naim94a/lumen/compare/v0.1.0...8b78d0a7d5b3ef4e0f221b07903fa5252174b57b
5151+[Unreleased]: https://github.com/naim94a/lumen/compare/v0.4.0...HEAD
5252+[v0.4.0]: https://github.com/naim94a/lumen/compare/v0.3.0...v0.4.0
5353+[v0.3.0]: https://github.com/naim94a/lumen/compare/v0.2.0...v0.3.0
5454+[v0.2.0]: https://github.com/naim94a/lumen/compare/v0.1.0...v0.2.0
2755[v0.1.0]: https://github.com/naim94a/lumen/releases/tag/v0.1.0
···11-# Lumen
22-A private Lumina server that can be used with IDA Pro 7.2+.
33-44-[lumen.abda.nl](https://lumen.abda.nl/) runs this server.
55-66-You can read about the protocol research [here](https://abda.nl/posts/introducing-lumen/).
77-88-## Features
99-- Stores function signatures so you (and your team) can quickly identify functions that you found in the past using IDA's built-in Lumina features.
1010-- Backed by PostgreSQL
1111-- Experimental HTTP API that allows querying the database for comments by file or function hash.
1212-1313-## Getting Started
1414-1515-### Docker Method (Recommended)
1616-In this method precompiled docker images will be downloaded, All you need is [docker-compose.yml](./docker-compose.yml).
1717-1818-1. Install `docker-engine` and `docker-compose`.
1919-2. If using a custom TLS certificate, copy the private key (`.p12`/`.pfx` extension) to `./dockershare` and set the key password in `.env` as `PKCSPASSWD`.
2020-3. If using a custom Lumen config, copy it to `./dockershare/config.toml`.
2121-4. Otherwise, or if you have finished these steps, just run `docker-compose up`.
2222-5. Regardless, if TLS is enabled in the `config.toml`, a `hexrays.crt` will be generated in `./dockershare` to be copied to the IDA install directory.
2323-2424-### Building from source with Rust
2525-1. `git clone https://github.com/naim94a/lumen.git`
2626-2. Get a rust toolchain: https://rustup.rs/
2727-3. `cd lumen`
2828-4. Setup a Postgres database and execute src/schema.sql on it
2929-5. `cargo build --release`
3030-3131-### Usage
3232-```
3333-./lumen -c config.toml
3434-```
3535-3636-### Configuring IDA
3737-3838-#### IDA Pro >= 8.1
3939-If you used LUMEN in the past, remove the LUMINA settings in the ida.cfg or idauser.cfg files, otherwise you will get a warning about
4040-bad config parameters.
4141-4242-##### Setup under Linux :
4343-```
4444-#!/bin/sh
4545-export LUMINA_TLS=false
4646-$1
4747-```
4848-- save as ida_lumen.sh, "chmod +x ida_lumen.sh", now you can run IDA using "./ida_lumen.sh ./ida" or "./ida_lumen ./ida64"
4949-5050-##### Setup under Windows :
5151-```
5252-set LUMINA_TLS=false
5353-%1
5454-```
5555-- save as ida_lumen.bat, now you can run IDA using "./ida_lumen.bat ida.exe" or "./ida_lumen.bat ida64.exe"
5656-5757-##### Setup IDA
5858-- Go to Options, General, Lumina. Select "Use a private server", then set your host and port and "guest" as username and password. Click on ok.
5959-6060-#### IDA Pro < 8.1
6161-You will need IDA Pro 7.2 or above in order to use _lumen_.
6262-6363-> The following information may get sent to _lumen_ server: IDA key, Hostname, IDB path, original file path, file MD5, function signature, stack frames & comments.
6464-6565-- In your IDA's installation directory open "cfg\ida.cfg" with your favorite text editor _(Example: C:\Program Files\IDA Pro 7.5\cfg\ida.cfg)_
6666-- Locate the commented out `LUMINA_HOST`, `LUMINA_PORT`, and change their values to the address of your _lumen_ server.
6767-- If you didn't configure TLS, Add "LUMINA_TLS = NO" after the line with `LUMINA_PORT`.
6868-6969-Example:
7070-```C
7171-LUMINA_HOST = "192.168.1.1";
7272-LUMINA_PORT = 1234
7373-7474-// Only if TLS isn't used:
7575-LUMINA_TLS = NO
7676-```
7777-7878-### Configuring TLS
7979-IDA Pro uses a pinned certificate for Lumina's communcation, so adding a self-signed certificate to your root certificates won't work.
8080-Luckily, we can override the hard-coded public key by writing a DER-base64 encoded certificate to "hexrays.crt" in IDA's install directory.
8181-8282-You may find the following commands useful:
8383-```bash
8484-# create a certificate
8585-openssl req -x509 -newkey rsa:4096 -keyout lumen_key.pem -out lumen_crt.pem -days 365 -nodes
8686-8787-# convert to pkcs12 for lumen; used for `lumen.tls` in config
8888-openssl pkcs12 -export -out lumen.p12 -inkey lumen_key.pem -in lumen_crt.pem
8989-9090-# export public-key for IDA; Copy hexrays.crt to IDA installation folder
9191-openssl x509 -in lumen_crt.pem -out hexrays.crt
9292-```
9393-9494-No attempt is made to merge function data - this may casuse a situation where metadata is inconsistent.
9595-Instead, the metadata with the highest calculated score is returned to the user.
9696-9797-9898----
9999-100100-Developed by [Naim A.](https://github.com/naim94a); License: MIT.
11+# Lumen
22+33+A private Lumina server that can be used with IDA Pro 7.2+.
44+55+[lumen.abda.nl](https://lumen.abda.nl/) runs this server.
66+77+You can read about the protocol research [here](https://abda.nl/posts/introducing-lumen/).
88+99+## Features
1010+1111+- Stores function signatures so you (and your team) can quickly identify functions that you found in the past using IDA's built-in Lumina features.
1212+- Backed by PostgreSQL
1313+- Experimental HTTP API that allows querying the database for comments by file or function hash.
1414+1515+## Getting Started
1616+1717+### Docker Method (Recommended)
1818+1919+In this method precompiled docker images will be downloaded, All you need is [docker-compose.yml](./docker-compose.yml).
2020+2121+1. Install `docker-engine` and `docker-compose`.
2222+2. If using a custom TLS certificate, copy the private key (`.p12`/`.pfx` extension) to `./dockershare` and set the key password in `.env` as `PKCSPASSWD`.
2323+3. If using a custom Lumen config, copy it to `./dockershare/config.toml`.
2424+4. Otherwise, or if you have finished these steps, just run `docker-compose up`.
2525+5. Regardless, if TLS is enabled in the `config.toml`, a `hexrays.crt` will be generated in `./dockershare` to be copied to the IDA install directory.
2626+2727+### Building from source with Rust
2828+2929+1. `git clone https://github.com/naim94a/lumen.git`
3030+2. Get a rust toolchain: https://rustup.rs/
3131+3. `cd lumen`
3232+4. Setup a the database
3333+3434+ - install postgres
3535+ - install diesel-cli and run migrations:
3636+3737+ ```bash
3838+ cargo install diesel_cli --no-default-features -Fpostgres
3939+ diesel --config-file common/diesel.toml \
4040+ --database-url postgres://postgres:password@localhost/lumen \
4141+ migration run
4242+ ```
4343+4444+5. `cargo build --release`
4545+4646+### Usage
4747+4848+```bash
4949+./lumen -c config.toml
5050+```
5151+5252+### Configuring IDA
5353+5454+#### IDA Pro >= 8.1
5555+5656+If you used LUMEN in the past, remove the LUMINA settings in the ida.cfg or idauser.cfg files, otherwise you will get a warning about
5757+bad config parameters.
5858+5959+##### Setup under Linux :
6060+6161+```bash
6262+#!/bin/sh
6363+export LUMINA_TLS=false
6464+$1
6565+```
6666+6767+- save as ida_lumen.sh, "chmod +x ida_lumen.sh", now you can run IDA using "./ida_lumen.sh ./ida" or "./ida_lumen ./ida64"
6868+6969+##### Setup under Windows :
7070+7171+```batch
7272+set LUMINA_TLS=false
7373+%1
7474+```
7575+7676+- save as ida_lumen.bat, now you can run IDA using "./ida_lumen.bat ida.exe" or "./ida_lumen.bat ida64.exe"
7777+7878+##### Setup IDA
7979+8080+- Go to Options, General, Lumina. Select "Use a private server", then set your host and port and "guest" as username and password. Click on ok.
8181+8282+#### IDA Pro < 8.1
8383+8484+You will need IDA Pro 7.2 or above in order to use _lumen_.
8585+8686+> The following information may get sent to _lumen_ server: IDA key, Hostname, IDB path, original file path, file MD5, function signature, stack frames & comments.
8787+8888+- In your IDA's installation directory open "cfg\ida.cfg" with your favorite text editor _(Example: C:\Program Files\IDA Pro 7.5\cfg\ida.cfg)_
8989+- Locate the commented out `LUMINA_HOST`, `LUMINA_PORT`, and change their values to the address of your _lumen_ server.
9090+- If you didn't configure TLS, Add "LUMINA_TLS = NO" after the line with `LUMINA_PORT`.
9191+9292+Example:
9393+9494+```C
9595+LUMINA_HOST = "192.168.1.1";
9696+LUMINA_PORT = 1234
9797+9898+// Only if TLS isn't used:
9999+LUMINA_TLS = NO
100100+```
101101+102102+### Configuring TLS
103103+104104+IDA Pro uses a pinned certificate for Lumina's communcation, so adding a self-signed certificate to your root certificates won't work.
105105+Luckily, we can override the hard-coded public key by writing a DER-base64 encoded certificate to "hexrays.crt" in IDA's install directory.
106106+107107+You may find the following commands useful:
108108+109109+```bash
110110+# create a certificate
111111+openssl req -x509 -newkey rsa:4096 -keyout lumen_key.pem -out lumen_crt.pem -days 365 -nodes
112112+113113+# convert to pkcs12 for lumen; used for `lumen.tls` in config
114114+openssl pkcs12 -export -out lumen.p12 -inkey lumen_key.pem -in lumen_crt.pem
115115+116116+# export public-key for IDA; Copy hexrays.crt to IDA installation folder
117117+openssl x509 -in lumen_crt.pem -out hexrays.crt
118118+```
119119+120120+No attempt is made to merge function data - this may cause a situation where metadata is inconsistent.
121121+Instead, the metadata with the highest calculated score is returned to the user.
122122+123123+---
124124+125125+Developed by [Naim A.](https://github.com/naim94a); License: MIT.
···3344use std::fmt::Write;
5566+pub mod async_drop;
77+pub mod config;
68pub mod db;
77-pub mod config;
89pub mod md;
1010+pub mod metrics;
911pub mod rpc;
1012pub mod web;
1111-pub mod async_drop;
1212-pub mod metrics;
13131414pub struct SharedState_ {
1515 pub db: db::Database,
···3333 }
34343535 let _ = write!(&mut output, " | ");
3636- for ch in chunk.iter().chain(std::iter::repeat(&b' ').take(padding)).map(|&v| std::char::from_u32(v as u32).unwrap_or('.')) {
3636+ for ch in chunk
3737+ .iter()
3838+ .chain(std::iter::repeat(&b' ').take(padding))
3939+ .map(|&v| std::char::from_u32(v as u32).unwrap_or('.'))
4040+ {
3741 if !ch.is_ascii_graphic() {
3842 output.push('.');
3943 } else {
···8899# Allow clients to delete metadata from the database?
1010allow_deletes = false
1111+# How many function histories should we return? 0=Disabled.
1212+get_history_limit = 50
11131214# only required when `use_tls` is set to true.
1315[lumina.tls]