From 9029978cc19c81747ac3174cb2798365d49a0492 Mon Sep 17 00:00:00 2001 From: h7x4 Date: Fri, 9 Aug 2024 00:19:49 +0200 Subject: [PATCH] WIP --- authenticated-unix-socket/lib.rs | 11 +++++++++++ src/client_server_protocol.rs | 13 +++++++++++++ src/main.rs | 3 +++ src/server.rs | 1 + src/server/entrypoint.rs | 0 5 files changed, 28 insertions(+) create mode 100644 authenticated-unix-socket/lib.rs create mode 100644 src/client_server_protocol.rs create mode 100644 src/server.rs create mode 100644 src/server/entrypoint.rs diff --git a/authenticated-unix-socket/lib.rs b/authenticated-unix-socket/lib.rs new file mode 100644 index 0000000..d997a8f --- /dev/null +++ b/authenticated-unix-socket/lib.rs @@ -0,0 +1,11 @@ + +// TODO: +// On responding to an incoming client request, the following should happen: +// 1. Before intializing it's request, the client should open an "authentication" socket with permissions 644. +// 2. Client opens a request to the server on the "normal" socket where the server is listening. +// 2. Server receives the request with auth socket address, a uid and a secret from the client. +// 3. Server validates that the owner of the auth socket address is the same as the uid. +// 4. Server connects to the auth socket address and receives the same secret. +// 5. Server validates that the secret is the same as the one it originally received. +// 6. Client closes the authentication socket. Normal socket is used for communication. +// (because the auth socket was readable globally) \ No newline at end of file diff --git a/src/client_server_protocol.rs b/src/client_server_protocol.rs new file mode 100644 index 0000000..0b5b001 --- /dev/null +++ b/src/client_server_protocol.rs @@ -0,0 +1,13 @@ +use serde::{Deserialize, Serialize}; + +#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] +pub enum Command { + CreateDatabase, + DropDatabase, + ListDatabases, +} + +#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] +pub enum Response { + +} \ No newline at end of file diff --git a/src/main.rs b/src/main.rs index d46d92f..e6869b3 100644 --- a/src/main.rs +++ b/src/main.rs @@ -10,6 +10,9 @@ use crate::cli::mysql_admutils_compatibility::{mysql_dbadm, mysql_useradm}; use clap::Parser; +mod client_server_protocol; +mod server; + mod cli; mod core; diff --git a/src/server.rs b/src/server.rs new file mode 100644 index 0000000..fb2a53e --- /dev/null +++ b/src/server.rs @@ -0,0 +1 @@ +mod entrypoint; \ No newline at end of file diff --git a/src/server/entrypoint.rs b/src/server/entrypoint.rs new file mode 100644 index 0000000..e69de29