From a967a92fe211ca7026ae5edce9695183e5a1c6e6 Mon Sep 17 00:00:00 2001 From: Radu Marias Date: Mon, 22 Apr 2024 16:15:38 +0300 Subject: [PATCH] add docs for building from source add fuse3 deps for cargo aur --- Cargo.toml | 3 +++ Dockerfile | 2 +- README.md | 60 +++++++++++++++++++++++++++++++++------------- src/encryptedfs.rs | 2 +- src/main.rs | 3 +-- 5 files changed, 50 insertions(+), 20 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index c271c5fb..8a6a2ca8 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -37,3 +37,6 @@ strum = "0.26.2" strum_macros = "0.26.2" rpassword = "7.3.1" cryptostream = "0.3.2" + +[package.metadata.aur] +depends = ["fuse3"] diff --git a/Dockerfile b/Dockerfile index eebedd87..96f3adf8 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,7 +2,7 @@ ##### Builder FROM alpine:3.16.0 as builder -RUN apk add binutils build-base ca-certificates curl file g++ gcc libressl-dev make patch postgresql rust +RUN apk add binutils build-base ca-certificates curl file g++ gcc libressl-dev make patch rust RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y diff --git a/README.md b/README.md index d1a20c44..fb63284b 100644 --- a/README.md +++ b/README.md @@ -17,9 +17,20 @@ You can use it as a command line tool to mount an encrypted file system, or dire ## Command Line Tool +To use the encrypted file system, you need to have FUSE installed on your system. You can install it by running the following command (or based on your distribution) + +Arch +```bash +sudo pacman -Syu && sudo pacman -S fuse3 +``` +Ubuntu +```bash +sudo apt-get update && sudo apt-get -y install fuse3 +``` + ### Install from AUR -You can install the encrypted file system binary using the following command: +You can install the encrypted file system binary using the following command ```bash yay -Syu yay -S encryptedfs @@ -27,23 +38,12 @@ yay -S encryptedfs ### Install with cargo -You can install the encrypted file system binary using the following command: +You can install the encrypted file system binary using the following command ```bash cargo install encryptedfs ``` -To use the encrypted file system, you need to have FUSE installed on your system. You can install it by running the following command (or based on your distribution): - -Arch -```bash -sudo pacman -Syu && sudo pacman -S fuse3 -``` -Ubuntu -```bash -sudo apt-get update && sudo apt-get -y install fuse3 -``` - -A basic example of how to use the encrypted file system is shown below: +A basic example of how to use the encrypted file system is shown below ``` encryptedfs --mount-point MOUNT_POINT --data-dir DATA_DIR @@ -57,7 +57,7 @@ The encryption key is stored in a file and encrypted with a key derived from the This offers the possibility to change the password without needing to decrypt and re-encrypt the whole data. This is done by decrypting the key with the old password and re-encrypting it with the new password. -To change the password, you can run the following command: +To change the password, you can run the following command ```bash encryptedfs --change-password --data-dir DATA_DIR ``` @@ -66,7 +66,7 @@ It will prompt you to enter the old password and then the new password. ### Encryption info -You can specify the encryption algorithm and derive key hash rounds adding these arguments to the command line: +You can specify the encryption algorithm and derive key hash rounds adding these arguments to the command line ```bash --cipher CIPHER --derive-key-hash-rounds ROUNDS @@ -117,3 +117,31 @@ ls echo "test" > 1/test cat 1/test ``` + +# Building from source +You need to have openssl adn fuse3 packages installed + +Arch +```bash +sudo pacman -Syu && sudo pacman -S openssl lib32-openssl fuse3 +``` + +Ubuntu +```bash +sudo apg-get uupdate && sudo apt-get install libssl-dev openssl fuse3 +``` + +Build for debug +```bash +cargo build +``` + +Or for release +```bash +cargo build --release +``` + +Run +```bash +cargo run -- --mount-point MOUNT_POINT --data-dir DATA_DIR +``` \ No newline at end of file diff --git a/src/encryptedfs.rs b/src/encryptedfs.rs index e3b4b157..03e2b501 100644 --- a/src/encryptedfs.rs +++ b/src/encryptedfs.rs @@ -1,4 +1,4 @@ -use std::{fs, io, process}; +use std::{fs, io}; use std::cmp::{max, min}; use std::collections::HashMap; use std::fmt::Debug; diff --git a/src/main.rs b/src/main.rs index 3463e2bb..9f1f0d19 100644 --- a/src/main.rs +++ b/src/main.rs @@ -9,13 +9,12 @@ use clap::{Arg, ArgAction, ArgMatches, Command, crate_version}; use ctrlc::set_handler; use fuse3::MountOptions; use fuse3::raw::prelude::*; -use libc::system; use rpassword::read_password; use strum::IntoEnumIterator; use tokio::{fs, task}; use tracing::{error, info, Level}; -use encryptedfs::encryptedfs::{Cipher, EncryptedFs, FsError, FsResult}; +use encryptedfs::encryptedfs::{Cipher, EncryptedFs, FsError}; use encryptedfs::encryptedfs_fuse3::EncryptedFsFuse3; #[tokio::main]