From c98fc77ca0d8b7a5b1ca44e5e389bd89e60043ae Mon Sep 17 00:00:00 2001 From: Quentin Dufour Date: Mon, 30 May 2022 11:50:07 +0200 Subject: Add some doc --- Cargo.toml | 4 ++++ README.md | 51 +++++++++++++++++++++++++++++++++++++++++++++++++++ src/server.rs | 2 +- 3 files changed, 56 insertions(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index df484d9..912c10d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -37,3 +37,7 @@ k2v-client = { git = "https://git.deuxfleurs.fr/Deuxfleurs/garage.git", branch = [[bin]] name = "test" path = "src/test.rs" + +[[bin]] +name = "main" +path = "src/main.rs" diff --git a/README.md b/README.md index 48d1088..bf5e3d2 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,56 @@ # Mailrage - Encrypted e-mail storage over Garage +## Usage + +Start by running: + +``` +$ cargo run --bin main -- first-login --region garage --k2v-endpoint http://127.0.0.1:3904 --s3-endpoint http://127.0.0.1:3900 --aws-access-key-id GK... --aws-secret-access-key c0ffee... --bucket mailrage-quentin --user-secret poupou +Please enter your password for key decryption. +If you are using LDAP login, this must be your LDAP password. +If you are using the static login provider, enter any password, and this will also become your password for local IMAP access. +Enter password: +Confirm password: + +Cryptographic key setup is complete. + +If you are using the static login provider, add the following section to your .toml configuration file: + +[login_static.users.] +password = "$argon2id$v=19$m=4096,t=3,p=1$..." +aws_access_key_id = "GK..." +aws_secret_access_key = "c0ffee..." +``` + +Next create the config file `mailrage.toml`: + +``` +s3_endpoint = "http://127.0.0.1:3900" +k2v_endpoint = "http://127.0.0.1:3904" +aws_region = "garage" + +[login_static] +default_bucket = "mailrage" +[login_static.users.quentin] +bucket = "mailrage-quentin" +user_secret = "poupou" +alternate_user_secrets = [] +password = "$argon2id$v=19$m=4096,t=3,p=1$..." +aws_access_key_id = "GK..." +aws_secret_access_key = "c0ffee..." +``` + +You can dump your keys with: + +``` +$ cargo run --bin main -- show-keys --region garage --k2v-endpoint http://127.0.0.1:3904 --s3-endpoint http://127.0.0.1:3900 --aws-access-key-id GK... --aws-secret-access-key c0ffee... --bucket mailrage-quentin --user-secret poupou +Enter key decryption password: +master_key = "..." +secret_key = "..." +``` + + + ## Bayou storage module Checkpoints are stored in S3 at `/checkpoint/`. Example: diff --git a/src/server.rs b/src/server.rs index e1ab599..ed751de 100644 --- a/src/server.rs +++ b/src/server.rs @@ -32,7 +32,7 @@ impl Server { } pub async fn run(self: &Arc) -> Result<()> { - let creds = self.login_provider.login("lx", "plop").await?; + let creds = self.login_provider.login("quentin", "poupou").await?; let mut mailbox = Mailbox::new(&creds, "TestMailbox".to_string()).await?; -- cgit v1.2.3