Merge branch 'dev' of https://github.com/C0ffeeCode/rvault into dev
This commit is contained in:
commit
7b686498c4
15 changed files with 107 additions and 104 deletions
97
Cargo.lock
generated
97
Cargo.lock
generated
|
|
@ -82,7 +82,7 @@ checksum = "a507401cad91ec6a857ed5513a2073c82a9b9048762b885bb98655b306964681"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
"syn 2.0.58",
|
"syn",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
|
@ -259,12 +259,6 @@ dependencies = [
|
||||||
"log",
|
"log",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "equivalent"
|
|
||||||
version = "1.0.1"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5"
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "fnv"
|
name = "fnv"
|
||||||
version = "1.0.7"
|
version = "1.0.7"
|
||||||
|
|
@ -338,12 +332,6 @@ version = "0.28.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "4271d37baee1b8c7e4b708028c57d816cf9d2434acb33a549475f78c181f6253"
|
checksum = "4271d37baee1b8c7e4b708028c57d816cf9d2434acb33a549475f78c181f6253"
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "hashbrown"
|
|
||||||
version = "0.14.3"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "290f1a1d9242c78d09ce40a5e87e7554ee637af1351968159f4952f028f75604"
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "hermit-abi"
|
name = "hermit-abi"
|
||||||
version = "0.3.9"
|
version = "0.3.9"
|
||||||
|
|
@ -437,17 +425,6 @@ dependencies = [
|
||||||
"tokio",
|
"tokio",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "indexmap"
|
|
||||||
version = "2.2.6"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "168fb715dda47215e360912c096649d23d58bf392ac62f73919e831745e40f26"
|
|
||||||
dependencies = [
|
|
||||||
"equivalent",
|
|
||||||
"hashbrown",
|
|
||||||
"serde",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "instant"
|
name = "instant"
|
||||||
version = "0.1.12"
|
version = "0.1.12"
|
||||||
|
|
@ -619,7 +596,7 @@ checksum = "2f38a4412a78282e09a2cf38d195ea5420d15ba0602cb375210efbc877243965"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
"syn 2.0.58",
|
"syn",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
|
@ -634,30 +611,6 @@ version = "0.1.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184"
|
checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184"
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "proc-macro-error"
|
|
||||||
version = "1.0.4"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "da25490ff9892aab3fcf7c36f08cfb902dd3e71ca0f9f9517bea02a73a5ce38c"
|
|
||||||
dependencies = [
|
|
||||||
"proc-macro-error-attr",
|
|
||||||
"proc-macro2",
|
|
||||||
"quote",
|
|
||||||
"syn 1.0.109",
|
|
||||||
"version_check",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "proc-macro-error-attr"
|
|
||||||
version = "1.0.4"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "a1be40180e52ecc98ad80b184934baf3d0d29f979574e439af5a55274b35f869"
|
|
||||||
dependencies = [
|
|
||||||
"proc-macro2",
|
|
||||||
"quote",
|
|
||||||
"version_check",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "proc-macro2"
|
name = "proc-macro2"
|
||||||
version = "1.0.79"
|
version = "1.0.79"
|
||||||
|
|
@ -764,7 +717,7 @@ checksum = "7eb0b34b42edc17f6b7cac84a52a1c5f0e1bb2227e997ca9011ea3dd34e8610b"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
"syn 2.0.58",
|
"syn",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
|
@ -808,7 +761,6 @@ dependencies = [
|
||||||
"env_logger",
|
"env_logger",
|
||||||
"log",
|
"log",
|
||||||
"tokio",
|
"tokio",
|
||||||
"utoipa",
|
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
|
@ -860,16 +812,6 @@ dependencies = [
|
||||||
"sled",
|
"sled",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "syn"
|
|
||||||
version = "1.0.109"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237"
|
|
||||||
dependencies = [
|
|
||||||
"proc-macro2",
|
|
||||||
"unicode-ident",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "syn"
|
name = "syn"
|
||||||
version = "2.0.58"
|
version = "2.0.58"
|
||||||
|
|
@ -920,7 +862,7 @@ checksum = "5b8a1e28f2deaa14e508979454cb3a223b10b938b45af148bc0986de36f1923b"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
"syn 2.0.58",
|
"syn",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
|
@ -983,37 +925,6 @@ version = "0.2.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "711b9620af191e0cdc7468a8d14e709c3dcdb115b36f838e601583af800a370a"
|
checksum = "711b9620af191e0cdc7468a8d14e709c3dcdb115b36f838e601583af800a370a"
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "utoipa"
|
|
||||||
version = "4.2.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "272ebdfbc99111033031d2f10e018836056e4d2c8e2acda76450ec7974269fa7"
|
|
||||||
dependencies = [
|
|
||||||
"indexmap",
|
|
||||||
"serde",
|
|
||||||
"serde_json",
|
|
||||||
"utoipa-gen",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "utoipa-gen"
|
|
||||||
version = "4.2.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "d3c9f4d08338c1bfa70dde39412a040a884c6f318b3d09aaaf3437a1e52027fc"
|
|
||||||
dependencies = [
|
|
||||||
"proc-macro-error",
|
|
||||||
"proc-macro2",
|
|
||||||
"quote",
|
|
||||||
"regex",
|
|
||||||
"syn 2.0.58",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "version_check"
|
|
||||||
version = "0.9.4"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f"
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "wasi"
|
name = "wasi"
|
||||||
version = "0.11.0+wasi-snapshot-preview1"
|
version = "0.11.0+wasi-snapshot-preview1"
|
||||||
|
|
|
||||||
10
Cargo.toml
10
Cargo.toml
|
|
@ -1,6 +1,6 @@
|
||||||
|
|
||||||
[workspace]
|
[workspace]
|
||||||
workspace.resolver = "2"
|
resolver = "2"
|
||||||
members = ["crates/*"]
|
members = ["crates/*"]
|
||||||
default-members = ["crates/server"]
|
default-members = ["crates/server"]
|
||||||
|
|
||||||
|
|
@ -9,3 +9,11 @@ log = "0.4.21"
|
||||||
env_logger = "0.11.3"
|
env_logger = "0.11.3"
|
||||||
tokio = "1.37.0"
|
tokio = "1.37.0"
|
||||||
axum = "0.7.5"
|
axum = "0.7.5"
|
||||||
|
|
||||||
|
[workspace.lints.clippy]
|
||||||
|
uninlined_format_args = "warn"
|
||||||
|
correctness = "warn"
|
||||||
|
suspicious = "warn"
|
||||||
|
complexity = "warn"
|
||||||
|
perf = "warn"
|
||||||
|
style = "warn"
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,7 @@ name = "auth-token"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
|
|
||||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
[lints]
|
||||||
|
workspace = true
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,8 @@ name = "backend-kv"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
|
|
||||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
[lints]
|
||||||
|
workspace = true
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
base = { path = "../base" }
|
base = { path = "../base" }
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,7 @@ name = "base"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
|
|
||||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
[lints]
|
||||||
|
workspace = true
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
|
|
|
||||||
|
|
@ -3,9 +3,14 @@ name = "server"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
|
|
||||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
# [target.x86_64-unknown-linux-gnu]
|
||||||
|
# rustflags = ["-C", "linker=clang", "-C", "link-arg=-fuse-ld=lld"]
|
||||||
|
|
||||||
|
[lints]
|
||||||
|
workspace = true
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
|
log = { workspace = true }
|
||||||
env_logger = { workspace = true }
|
env_logger = { workspace = true }
|
||||||
tokio = { workspace = true, features=["full"] }
|
tokio = { workspace = true, features=["full"] }
|
||||||
axum = { workspace = true }
|
axum = { workspace = true }
|
||||||
|
|
|
||||||
10
crates/server/src/auth.rs
Normal file
10
crates/server/src/auth.rs
Normal file
|
|
@ -0,0 +1,10 @@
|
||||||
|
use axum::Router;
|
||||||
|
|
||||||
|
use self::token::token_auth_router;
|
||||||
|
|
||||||
|
// route prefix: `/auth/token/`
|
||||||
|
mod token;
|
||||||
|
|
||||||
|
pub fn auth_router() -> Router {
|
||||||
|
Router::new().nest("/token", token_auth_router())
|
||||||
|
}
|
||||||
45
crates/server/src/auth/token.rs
Normal file
45
crates/server/src/auth/token.rs
Normal file
|
|
@ -0,0 +1,45 @@
|
||||||
|
use axum::Router;
|
||||||
|
|
||||||
|
pub fn token_auth_router() -> Router {
|
||||||
|
Router::new()
|
||||||
|
}
|
||||||
|
|
||||||
|
async fn get_accessors() {}
|
||||||
|
|
||||||
|
async fn post_create() {}
|
||||||
|
|
||||||
|
async fn post_create_orphan() {}
|
||||||
|
|
||||||
|
async fn post_create_role() {}
|
||||||
|
|
||||||
|
async fn get_lookup() {}
|
||||||
|
|
||||||
|
async fn post_lookup() {}
|
||||||
|
|
||||||
|
async fn get_lookup_self() {}
|
||||||
|
|
||||||
|
async fn post_lookup_self() {}
|
||||||
|
|
||||||
|
async fn post_renew() {}
|
||||||
|
|
||||||
|
async fn post_renew_accessor() {}
|
||||||
|
|
||||||
|
async fn post_renew_self() {}
|
||||||
|
|
||||||
|
async fn post_revoke() {}
|
||||||
|
|
||||||
|
async fn post_revoke_accessor() {}
|
||||||
|
|
||||||
|
async fn post_revoke_orphan() {}
|
||||||
|
|
||||||
|
async fn post_revoke_self() {}
|
||||||
|
|
||||||
|
async fn get_roles() {}
|
||||||
|
|
||||||
|
async fn get_role_by_name() {}
|
||||||
|
|
||||||
|
async fn post_role_by_name() {}
|
||||||
|
|
||||||
|
async fn delete_role_by_name() {}
|
||||||
|
|
||||||
|
async fn post_tidy() {}
|
||||||
1
crates/server/src/identity.rs
Normal file
1
crates/server/src/identity.rs
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
|
||||||
|
|
@ -28,5 +28,6 @@ async fn foo( req: Request) -> String {
|
||||||
|
|
||||||
// basic handler that responds with a static string
|
// basic handler that responds with a static string
|
||||||
async fn root() -> &'static str {
|
async fn root() -> &'static str {
|
||||||
|
log::info!("Hello world");
|
||||||
"Hello, World!"
|
"Hello, World!"
|
||||||
}
|
}
|
||||||
|
|
|
||||||
1
crates/server/src/secrets.rs
Normal file
1
crates/server/src/secrets.rs
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
|
||||||
1
crates/server/src/sys.rs
Normal file
1
crates/server/src/sys.rs
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
|
||||||
|
|
@ -3,7 +3,8 @@ name = "storage-sled"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
|
|
||||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
[lints]
|
||||||
|
workspace = true
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
base = { path = "../base" }
|
base = { path = "../base" }
|
||||||
|
|
|
||||||
14
go_client/Containerfile
Normal file
14
go_client/Containerfile
Normal file
|
|
@ -0,0 +1,14 @@
|
||||||
|
|
||||||
|
FROM docker.io/library/golang:1.22-alpine3.19 AS builder
|
||||||
|
|
||||||
|
WORKDIR /src
|
||||||
|
COPY go.mod go.sum ./
|
||||||
|
RUN go mod download
|
||||||
|
|
||||||
|
COPY *.go ./
|
||||||
|
RUN go build -o /app
|
||||||
|
|
||||||
|
FROM docker.io/library/alpine:3.19
|
||||||
|
|
||||||
|
COPY --from=builder /app /app
|
||||||
|
CMD ["/app"]
|
||||||
|
|
@ -16,7 +16,7 @@ func main() {
|
||||||
|
|
||||||
// prepare a client with the given base address
|
// prepare a client with the given base address
|
||||||
client, err := vault.New(
|
client, err := vault.New(
|
||||||
vault.WithAddress("http://127.0.0.1:8200"),
|
vault.WithAddress("http://localhost:8200"),
|
||||||
vault.WithRequestTimeout(30*time.Second),
|
vault.WithRequestTimeout(30*time.Second),
|
||||||
)
|
)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
@ -36,17 +36,19 @@ func main() {
|
||||||
"password1": "abc123",
|
"password1": "abc123",
|
||||||
"password2": "correct horse battery staple",
|
"password2": "correct horse battery staple",
|
||||||
}},
|
}},
|
||||||
vault.WithMountPath("secret"),
|
vault.WithMountPath("kw_mount_path"),
|
||||||
)
|
)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal("kv2: Failed to write secret:\n\t", err)
|
||||||
|
} else {
|
||||||
|
log.Println("kv2: Secret written (apparently)")
|
||||||
}
|
}
|
||||||
log.Println("secret written successfully")
|
|
||||||
|
|
||||||
// read the secret
|
// read the secret
|
||||||
s, err := client.Secrets.KvV2Read(ctx, "foo", vault.WithMountPath("secret"))
|
s, err := client.Secrets.KvV2Read(ctx, "foo", vault.WithMountPath("secret"))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
} else {
|
||||||
log.Println("secret retrieved:", s.Data.Data)
|
log.Println("secret retrieved:", s.Data.Data)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue