From d267916445b3609df2151e3cfb134a9994e5e748 Mon Sep 17 00:00:00 2001 From: Paul Spooren Date: Fri, 8 Nov 2024 13:19:53 +0100 Subject: [PATCH 1/9] docs(cli): Improve help text This commit does multiple things at once to improve the user experience: * Always start with an upper case letter, no mixing * Hide deprecated `keygen` command, it still works if called * Extend and rework some documentation textx * Drop false `log_level` text, it contains a logic error * Wrap all documentation at 80 chars Signed-off-by: Paul Spooren --- rosenpass/src/cli.rs | 83 ++++++++++++++++++++++++++------------------ 1 file changed, 49 insertions(+), 34 deletions(-) diff --git a/rosenpass/src/cli.rs b/rosenpass/src/cli.rs index 65c270f..46ac473 100644 --- a/rosenpass/src/cli.rs +++ b/rosenpass/src/cli.rs @@ -43,15 +43,15 @@ pub enum BrokerInterface { #[derive(Parser, Debug)] #[command(author, version, about, long_about, arg_required_else_help = true)] pub struct CliArgs { - /// lowest log level to show – log messages at higher levels will be omitted + /// Lowest log level to show #[arg(long = "log-level", value_name = "LOG_LEVEL", group = "log-level")] log_level: Option, - /// show verbose log output – sets log level to "debug" + /// Show verbose log output – sets log level to "debug" #[arg(short, long, group = "log-level")] verbose: bool, - /// show no log output – sets log level to "error" + /// Show no log output – sets log level to "error" #[arg(short, long, group = "log-level")] quiet: bool, @@ -59,22 +59,23 @@ pub struct CliArgs { #[cfg(feature = "experiment_api")] api: crate::api::cli::ApiCli, - /// path of the wireguard_psk broker socket to connect to + /// Path of the `wireguard_psk` broker socket to connect to #[cfg(feature = "experiment_api")] #[arg(long, group = "psk-broker-specs")] psk_broker_path: Option, - /// fd of the wireguard_spk broker socket to connect to + /// File descriptor of the `wireguard_psk` broker socket to connect to /// - /// when this command is called from another process, the other process can open and bind the - /// Unix socket for the psk broker connection to use themselves, passing it to this process -- - /// in Rust this can be achieved using the - /// [command-fds](https://docs.rs/command-fds/latest/command_fds/) crate + /// When this command is called from another process, the other process can + /// open and bind the Unix socket for the PSK broker connection to use + /// themselves, passing it to this process - in Rust this can be achieved + /// using the [command-fds](https://docs.rs/command-fds/latest/command_fds/) + /// crate #[cfg(feature = "experiment_api")] #[arg(long, group = "psk-broker-specs")] psk_broker_fd: Option, - /// spawn a psk broker locally using a socket pair + /// Spawn a PSK broker locally using a socket pair #[cfg(feature = "experiment_api")] #[arg(short, long, group = "psk-broker-specs")] psk_broker_spawn: bool, @@ -82,11 +83,16 @@ pub struct CliArgs { #[command(subcommand)] pub command: Option, - /// Generate man page + /// Generate man pages for the CLI + /// + /// This option is used to generate man pages for Rosenpass in the specified + /// directory and exit. #[clap(long, value_name = "out_dir")] pub generate_manpage: Option, /// Generate completion file for a shell + /// + /// This option is used to generate completion files for the specified shell #[clap(long, value_name = "shell")] pub print_completions: Option, } @@ -143,20 +149,20 @@ impl CliArgs { /// represents a command specified via CLI #[derive(Subcommand, Debug)] pub enum CliCommand { - /// Start Rosenpass in server mode and carry on with the key exchange + /// Start Rosenpass key exchanges based on a configuration file /// - /// This will parse the configuration file and perform the key exchange - /// with the specified peers. If a peer's endpoint is specified, this - /// Rosenpass instance will try to initiate a key exchange with the peer, - /// otherwise only initiation attempts from the peer will be responded to. + /// This will parse the configuration file and perform key exchanges with + /// the specified peers. If a peer's endpoint is specified, this Rosenpass + /// instance will try to initiate a key exchange with the peer; otherwise, + /// only initiation attempts from other peers will be responded to. ExchangeConfig { config_file: PathBuf }, - /// Start in daemon mode, performing key exchanges + /// Start Rosenpass key exchanges based on command line arguments /// - /// The configuration is read from the command line. The `peer` token - /// always separates multiple peers, e. g. if the token `peer` appears - /// in the WIREGUARD_EXTRA_ARGS it is not put into the WireGuard arguments - /// but instead a new peer is created. + /// The configuration is read from the command line. The `peer` token always + /// separates multiple peers, e.g., if the token `peer` appears in the + /// WIREGUARD_EXTRA_ARGS, it is not put into the WireGuard arguments but + /// instead a new peer is created. /* Explanation: `first_arg` and `rest_of_args` are combined into one * `Vec`. They are only used to trick clap into displaying some * guidance on the CLI usage. @@ -185,7 +191,10 @@ pub enum CliCommand { config_file: Option, }, - /// Generate a demo config file + /// Generate a demo config file for Rosenpass + /// + /// The generated config file will contain a single peer and all common + /// options. GenConfig { config_file: PathBuf, @@ -194,19 +203,19 @@ pub enum CliCommand { force: bool, }, - /// Generate the keys mentioned in a configFile + /// Generate secret & public key for Rosenpass /// - /// Generates secret- & public-key to their destination. If a config file - /// is provided then the key file destination is taken from there. - /// Otherwise the + /// Generates secret & public key to their destination. If a config file is + /// provided then the key file destination is taken from there, otherwise + /// the destination is taken from the CLI arguments. GenKeys { config_file: Option, - /// where to write public-key to + /// Where to write public key to #[clap(short, long)] public_key: Option, - /// where to write secret-key to + /// Where to write secret key to #[clap(short, long)] secret_key: Option, @@ -215,21 +224,27 @@ pub enum CliCommand { force: bool, }, - /// Deprecated - use gen-keys instead + /// Validate a configuration file + /// + /// This command will validate the configuration file and print any errors + /// it finds. If the configuration file is valid, it will print a success. + /// Defined secret & public keys are checked for existence and validity. + Validate { config_files: Vec }, + + /// DEPRECATED - use the gen-keys command instead #[allow(rustdoc::broken_intra_doc_links)] #[allow(rustdoc::invalid_html_tags)] + #[command(hide = true)] Keygen { - // NOTE yes, the legacy keygen argument initially really accepted "privet-key", not "secret-key"! + // NOTE yes, the legacy keygen argument initially really accepted + // "private-key", not "secret-key"! /// public-key private-key args: Vec, }, - - /// Validate a configuration - Validate { config_files: Vec }, } impl CliArgs { - /// runs the command specified via CLI + /// Runs the command specified via CLI /// /// ## TODO /// - This method consumes the [`CliCommand`] value. It might be wise to use a reference... From cc7757a0db8551089bf9165d256a2fb835297f86 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sat, 9 Nov 2024 00:06:10 +0000 Subject: [PATCH 2/9] build(deps): bump serial_test from 3.1.1 to 3.2.0 Bumps [serial_test](https://github.com/palfrey/serial_test) from 3.1.1 to 3.2.0. - [Release notes](https://github.com/palfrey/serial_test/releases) - [Commits](https://github.com/palfrey/serial_test/compare/v3.1.1...v3.2.0) --- updated-dependencies: - dependency-name: serial_test dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- Cargo.lock | 8 ++++---- Cargo.toml | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 63e37d3..1c59e7a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2154,9 +2154,9 @@ dependencies = [ [[package]] name = "serial_test" -version = "3.1.1" +version = "3.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4b4b487fe2acf240a021cf57c6b2b4903b1e78ca0ecd862a71b71d2a51fed77d" +checksum = "1b258109f244e1d6891bf1053a55d63a5cd4f8f4c30cf9a1280989f80e7a1fa9" dependencies = [ "futures", "log", @@ -2168,9 +2168,9 @@ dependencies = [ [[package]] name = "serial_test_derive" -version = "3.1.1" +version = "3.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "82fe9db325bcef1fbcde82e078a5cc4efdf787e96b3b9cf45b50b529f2083d67" +checksum = "5d69265a08751de7844521fd15003ae0a888e035773ba05695c5c759a6f89eef" dependencies = [ "proc-macro2", "quote", diff --git a/Cargo.toml b/Cargo.toml index bbe7448..f23b5be 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -76,7 +76,7 @@ libc = { version = "0.2" } uds = { git = "https://github.com/rosenpass/uds" } #Dev dependencies -serial_test = "3.1.1" +serial_test = "3.2.0" tempfile = "3" stacker = "0.1.17" libfuzzer-sys = "0.4" From c13badb697600c2826c4efc3ff27e01a2aaf7004 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 11 Nov 2024 23:26:23 +0000 Subject: [PATCH 3/9] build(deps): bump thiserror from 1.0.68 to 1.0.69 Bumps [thiserror](https://github.com/dtolnay/thiserror) from 1.0.68 to 1.0.69. - [Release notes](https://github.com/dtolnay/thiserror/releases) - [Commits](https://github.com/dtolnay/thiserror/compare/1.0.68...1.0.69) --- updated-dependencies: - dependency-name: thiserror dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- Cargo.lock | 8 ++++---- Cargo.toml | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 1c59e7a..d88ca5a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2339,18 +2339,18 @@ checksum = "23d434d3f8967a09480fb04132ebe0a3e088c173e6d0ee7897abbdf4eab0f8b9" [[package]] name = "thiserror" -version = "1.0.68" +version = "1.0.69" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "02dd99dc800bbb97186339685293e1cc5d9df1f8fae2d0aecd9ff1c77efea892" +checksum = "b6aaf5339b578ea85b50e080feb250a3e8ae8cfcdff9a461c9ec2904bc923f52" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.68" +version = "1.0.69" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a7c61ec9a6f64d2793d8a45faba21efbe3ced62a886d44c36a009b2b519b4c7e" +checksum = "4fee6c4efc90059e10f81e6d42c60a18f76588c3d74cb83a0b242a2b6c7504c1" dependencies = [ "proc-macro2", "quote", diff --git a/Cargo.toml b/Cargo.toml index f23b5be..a7359f0 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -35,7 +35,7 @@ doc-comment = "0.3.3" base64ct = { version = "1.6.0", default-features = false } zeroize = "1.8.1" memoffset = "0.9.1" -thiserror = "1.0.68" +thiserror = "1.0.69" paste = "1.0.15" env_logger = "0.10.2" toml = "0.7.8" From 5b3f4da23edf7ce5ab9473af8fc15ad04cf51a00 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 11 Nov 2024 23:25:44 +0000 Subject: [PATCH 4/9] build(deps): bump serde from 1.0.214 to 1.0.215 Bumps [serde](https://github.com/serde-rs/serde) from 1.0.214 to 1.0.215. - [Release notes](https://github.com/serde-rs/serde/releases) - [Commits](https://github.com/serde-rs/serde/compare/v1.0.214...v1.0.215) --- updated-dependencies: - dependency-name: serde dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- Cargo.lock | 8 ++++---- Cargo.toml | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index d88ca5a..ad48440 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2113,18 +2113,18 @@ checksum = "61697e0a1c7e512e84a621326239844a24d8207b4669b41bc18b32ea5cbf988b" [[package]] name = "serde" -version = "1.0.214" +version = "1.0.215" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f55c3193aca71c12ad7890f1785d2b73e1b9f63a0bbc353c08ef26fe03fc56b5" +checksum = "6513c1ad0b11a9376da888e3e0baa0077f1aed55c17f50e7b2397136129fb88f" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.214" +version = "1.0.215" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "de523f781f095e28fa605cdce0f8307e451cc0fd14e2eb4cd2e98a355b147766" +checksum = "ad1e866f866923f252f05c889987993144fb74e722403468a4ebd70c3cd756c0" dependencies = [ "proc-macro2", "quote", diff --git a/Cargo.toml b/Cargo.toml index a7359f0..19b7204 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -50,7 +50,7 @@ log = { version = "0.4.22" } clap = { version = "4.5.20", features = ["derive"] } clap_mangen = "0.2.24" clap_complete = "4.5.37" -serde = { version = "1.0.214", features = ["derive"] } +serde = { version = "1.0.215", features = ["derive"] } arbitrary = { version = "1.4.1", features = ["derive"] } anyhow = { version = "1.0.93", features = ["backtrace", "std"] } mio = { version = "1.0.2", features = ["net", "os-poll"] } From 0cea8c5eff7c6cfa3d970d744509bcbfe8fe8626 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 11 Nov 2024 23:25:59 +0000 Subject: [PATCH 5/9] build(deps): bump rustix from 0.38.39 to 0.38.40 Bumps [rustix](https://github.com/bytecodealliance/rustix) from 0.38.39 to 0.38.40. - [Release notes](https://github.com/bytecodealliance/rustix/releases) - [Changelog](https://github.com/bytecodealliance/rustix/blob/main/CHANGELOG.md) - [Commits](https://github.com/bytecodealliance/rustix/compare/v0.38.39...v0.38.40) --- updated-dependencies: - dependency-name: rustix dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- Cargo.lock | 4 ++-- Cargo.toml | 2 +- wireguard-broker/Cargo.toml | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index ad48440..b8d80f6 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2058,9 +2058,9 @@ dependencies = [ [[package]] name = "rustix" -version = "0.38.39" +version = "0.38.40" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "375116bee2be9ed569afe2154ea6a99dfdffd257f533f187498c2a8f5feaf4ee" +checksum = "99e4ea3e1cdc4b559b8e5650f9c8e5998e3e5c1343b4eaf034565f32318d63c0" dependencies = [ "bitflags 2.6.0", "errno", diff --git a/Cargo.toml b/Cargo.toml index 19b7204..df98f3e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -89,4 +89,4 @@ procspawn = { version = "1.0.1", features = ["test-support"] } #Broker dependencies (might need cleanup or changes) wireguard-uapi = { version = "3.0.0", features = ["xplatform"] } command-fds = "0.2.3" -rustix = { version = "0.38.39", features = ["net", "fs"] } +rustix = { version = "0.38.40", features = ["net", "fs"] } diff --git a/wireguard-broker/Cargo.toml b/wireguard-broker/Cargo.toml index 11e0b4b..203afe7 100644 --- a/wireguard-broker/Cargo.toml +++ b/wireguard-broker/Cargo.toml @@ -28,7 +28,7 @@ derive_builder = { workspace = true } postcard = { workspace = true } # Problem in CI, unknown reasons: dependency (libc) specified without providing a local path, Git repository, version, or workspace dependency to use # Maybe something about the combination of features and optional crates? -rustix = { version = "0.38.39", optional = true } +rustix = { version = "0.38.40", optional = true } libc = { version = "0.2", optional = true } # Mio broker client From f3399907b993644a00eee16651099163458ade22 Mon Sep 17 00:00:00 2001 From: Philipp Dresselmann Date: Fri, 22 Nov 2024 09:28:40 +0100 Subject: [PATCH 6/9] chore(API): Rename mio.connection.shoud_close Technically a breaking change... Hopefully that's not a problem here? --- rosenpass/src/api/mio/connection.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/rosenpass/src/api/mio/connection.rs b/rosenpass/src/api/mio/connection.rs index a3c7a4e..10e4cc2 100644 --- a/rosenpass/src/api/mio/connection.rs +++ b/rosenpass/src/api/mio/connection.rs @@ -88,7 +88,7 @@ impl MioConnection { }) } - pub fn shoud_close(&self) -> bool { + pub fn should_close(&self) -> bool { let exhausted = self .buffers .as_ref() @@ -262,7 +262,7 @@ pub trait MioConnectionContext { } fn should_close(&self) -> bool { - self.mio_connection().shoud_close() + self.mio_connection().should_close() } } From 94362813503e7068d95f64e8c1d6a7526ef5eb0b Mon Sep 17 00:00:00 2001 From: Philipp Dresselmann Date: Mon, 25 Nov 2024 14:52:51 +0100 Subject: [PATCH 7/9] Docs: Add cargo test arguments in CONTRIBUTING.md (#502) Presumably, this should match the command used in the CI workflow and not skip any features? --- CONTRIBUTING.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index d2d1a6b..a885854 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -8,7 +8,7 @@ If any other issue occurs 1. Make sure you locally checked out the head of the main branch - `git stash --include-untracked && git checkout main && git pull` 2. Make sure all tests pass - - `cargo test` + - `cargo test --workspace --all-features` 3. Make sure the current version in `rosenpass/Cargo.toml` matches that in the [last release on GitHub](https://github.com/rosenpass/rosenpass/releases) - Only normal releases count, release candidates and draft releases can be ignored 4. Pick the kind of release that you want to make (`major`, `minor`, `patch`, `rc`, ...) From 66017429038d3c27153800202e42bf7cb4874d53 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 26 Nov 2024 20:54:02 +0100 Subject: [PATCH 8/9] build(deps): bump libc from 0.2.162 to 0.2.165 (#503) Bumps [libc](https://github.com/rust-lang/libc) from 0.2.162 to 0.2.165. - [Release notes](https://github.com/rust-lang/libc/releases) - [Changelog](https://github.com/rust-lang/libc/blob/0.2.165/CHANGELOG.md) - [Commits](https://github.com/rust-lang/libc/compare/0.2.162...0.2.165) --- updated-dependencies: - dependency-name: libc dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- Cargo.lock | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index b8d80f6..968fdfb 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1210,9 +1210,9 @@ checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55" [[package]] name = "libc" -version = "0.2.162" +version = "0.2.165" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "18d287de67fe55fd7e1581fe933d965a5a9477b38e949cfa9f8574ef01506398" +checksum = "fcb4d3d38eab6c5239a362fa8bae48c03baf980a6e7079f063942d563ef3533e" [[package]] name = "libcrux" From af0db889392aa4e4833204dbe159b1e2367b0160 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 28 Nov 2024 19:00:49 +0100 Subject: [PATCH 9/9] build(deps): bump libc from 0.2.165 to 0.2.166 (#505) Bumps [libc](https://github.com/rust-lang/libc) from 0.2.165 to 0.2.166. - [Release notes](https://github.com/rust-lang/libc/releases) - [Changelog](https://github.com/rust-lang/libc/blob/0.2.166/CHANGELOG.md) - [Commits](https://github.com/rust-lang/libc/compare/0.2.165...0.2.166) --- updated-dependencies: - dependency-name: libc dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- Cargo.lock | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 968fdfb..5b0ce6c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1210,9 +1210,9 @@ checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55" [[package]] name = "libc" -version = "0.2.165" +version = "0.2.166" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fcb4d3d38eab6c5239a362fa8bae48c03baf980a6e7079f063942d563ef3533e" +checksum = "c2ccc108bbc0b1331bd061864e7cd823c0cab660bbe6970e66e2c0614decde36" [[package]] name = "libcrux"