mirror of
https://github.com/house-of-vanity/khm.git
synced 2025-07-07 23:34:07 +00:00
Compare commits
2 Commits
Author | SHA1 | Date | |
---|---|---|---|
3ca8e27ded | |||
2b7b3b9a22 |
@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "khm"
|
name = "khm"
|
||||||
version = "0.2.0"
|
version = "0.2.1"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
authors = ["AB <ab@hexor.cy>", "ChatGPT-4o"]
|
authors = ["AB <ab@hexor.cy>", "ChatGPT-4o"]
|
||||||
|
|
||||||
@ -15,4 +15,4 @@ tokio = { version = "1", features = ["full"] }
|
|||||||
tokio-postgres = { version = "0.7", features = ["with-chrono-0_4"] }
|
tokio-postgres = { version = "0.7", features = ["with-chrono-0_4"] }
|
||||||
clap = { version = "4", features = ["derive"] }
|
clap = { version = "4", features = ["derive"] }
|
||||||
chrono = "0.4.38"
|
chrono = "0.4.38"
|
||||||
reqwest = { version = "0.12", features = ["json"] }
|
reqwest = { version = "0.12", features = ["json"] }
|
||||||
|
11
shell.nix
Normal file
11
shell.nix
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
{ pkgs ? import <nixpkgs> {} }:
|
||||||
|
|
||||||
|
pkgs.mkShell {
|
||||||
|
buildInputs = [
|
||||||
|
pkgs.openssl
|
||||||
|
pkgs.pkg-config
|
||||||
|
];
|
||||||
|
shellHook = ''
|
||||||
|
unset OPENSSL_DIR
|
||||||
|
'';
|
||||||
|
}
|
34
src/main.rs
34
src/main.rs
@ -20,11 +20,26 @@ use log::{error, info};
|
|||||||
khm --server --ip 0.0.0.0 --port 1337 --db-host psql.psql.svc --db-name khm --db-user admin --db-password <SECRET> --flows work,home\n\
|
khm --server --ip 0.0.0.0 --port 1337 --db-host psql.psql.svc --db-name khm --db-user admin --db-password <SECRET> --flows work,home\n\
|
||||||
\n\
|
\n\
|
||||||
Running in client mode to send diff and sync ~/.ssh/known_hosts with remote flow in place:\n\
|
Running in client mode to send diff and sync ~/.ssh/known_hosts with remote flow in place:\n\
|
||||||
khm --host http://kh.example.com:8080 --known-hosts ~/.ssh/known_hosts --in-place\n\
|
khm --host https://khm.example.com/default/keys --known-hosts ~/.ssh/known_hosts --in-place\n\
|
||||||
\n\
|
\n\
|
||||||
"
|
"
|
||||||
)]
|
)]
|
||||||
struct Args {
|
struct Args {
|
||||||
|
/// Run in server mode (default: false)
|
||||||
|
#[arg(long, help = "Run in server mode")]
|
||||||
|
server: bool,
|
||||||
|
|
||||||
|
/// Update the known_hosts file with keys from the server after sending keys (default: false)
|
||||||
|
#[arg(
|
||||||
|
long,
|
||||||
|
help = "Server mode: Sync the known_hosts file with keys from the server"
|
||||||
|
)]
|
||||||
|
in_place: bool,
|
||||||
|
|
||||||
|
/// Comma-separated list of flows to manage (default: default)
|
||||||
|
#[arg(long, default_value = "default", value_parser, num_args = 1.., value_delimiter = ',', help = "Server mode: Comma-separated list of flows to manage")]
|
||||||
|
flows: Vec<String>,
|
||||||
|
|
||||||
/// IP address to bind the server or client to (default: 127.0.0.1)
|
/// IP address to bind the server or client to (default: 127.0.0.1)
|
||||||
#[arg(
|
#[arg(
|
||||||
short,
|
short,
|
||||||
@ -79,14 +94,10 @@ struct Args {
|
|||||||
#[arg(
|
#[arg(
|
||||||
long,
|
long,
|
||||||
required_if_eq("server", "false"),
|
required_if_eq("server", "false"),
|
||||||
help = "Client mode: Host address of the server to connect to"
|
help = "Client mode: Full host address of the server to connect to. Like https://khm.example.com/flow_name/keys"
|
||||||
)]
|
)]
|
||||||
host: Option<String>,
|
host: Option<String>,
|
||||||
|
|
||||||
/// Run in server mode (default: false)
|
|
||||||
#[arg(long, help = "Run in server mode")]
|
|
||||||
server: bool,
|
|
||||||
|
|
||||||
/// Path to the known_hosts file (default: ~/.ssh/known_hosts)
|
/// Path to the known_hosts file (default: ~/.ssh/known_hosts)
|
||||||
#[arg(
|
#[arg(
|
||||||
long,
|
long,
|
||||||
@ -94,17 +105,6 @@ struct Args {
|
|||||||
help = "Client mode: Path to the known_hosts file"
|
help = "Client mode: Path to the known_hosts file"
|
||||||
)]
|
)]
|
||||||
known_hosts: String,
|
known_hosts: String,
|
||||||
|
|
||||||
/// Update the known_hosts file with keys from the server after sending keys (default: false)
|
|
||||||
#[arg(
|
|
||||||
long,
|
|
||||||
help = "Server mode: Sync the known_hosts file with keys from the server"
|
|
||||||
)]
|
|
||||||
in_place: bool,
|
|
||||||
|
|
||||||
/// Comma-separated list of flows to manage (default: default)
|
|
||||||
#[arg(long, default_value = "default", value_parser, num_args = 1.., value_delimiter = ',', help = "Comma-separated list of flows to manage")]
|
|
||||||
flows: Vec<String>,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[actix_web::main]
|
#[actix_web::main]
|
||||||
|
Reference in New Issue
Block a user