diff --git a/Cargo.toml b/Cargo.toml index de2a621..ce26a6c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -11,12 +11,12 @@ name = "libcommand" path = "src/lib.rs" [[bin]] -name = "daemon" +name = "gtwyd" path = "src/daemon/main.rs" [[bin]] -name = "client" -path = "src/client/main.rs" +name = "gtwy_interpreter" +path = "src/interpreter/main.rs" [dependencies] serde = { version = "1.0", features = ["derive"] } diff --git a/Dockerfile b/Dockerfile index 3b04912..f14035b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -5,21 +5,21 @@ RUN apt update && apt install openssh-server curl build-essential protobuf-compi RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y ENV PATH="/root/.cargo/bin:${PATH}" -RUN useradd -rm -d /home/test -s /opt/gateway/target/release/client test +RUN useradd -rm -d /home/test -s /opt/gateway/target/release/gtwy_interpreter test RUN echo 'test:test' | chpasswd # Build project binaries COPY . /opt/gateway WORKDIR /opt/gateway -RUN cargo build --release --bin daemon -RUN cargo build --release --bin client +RUN cargo build --release --bin gtwyd +RUN cargo build --release --bin gtwy_interpreter RUN mkdir -p /var/run RUN chmod ugo+rx /var RUN chmod ugo+rwx /var/run RUN echo '#!/bin/sh\n\ /usr/sbin/sshd -D&\n\ -su - test -s /bin/sh -c "/opt/gateway/target/release/daemon"' > /opt/startup.sh +su - test -s /bin/sh -c "/opt/gateway/target/release/gtwyd"' > /opt/startup.sh RUN chmod +x /opt/startup.sh diff --git a/build.rs b/build.rs index 66c5a14..fab47af 100644 --- a/build.rs +++ b/build.rs @@ -1,4 +1,4 @@ fn main() -> Result<(), Box> { - tonic_build::compile_protos("proto/internal.proto")?; + tonic_build::compile_protos("proto/interpreter.proto")?; Ok(()) } \ No newline at end of file diff --git a/proto/internal.proto b/proto/interpreter.proto similarity index 97% rename from proto/internal.proto rename to proto/interpreter.proto index 41dbbb5..f5ea845 100644 --- a/proto/internal.proto +++ b/proto/interpreter.proto @@ -1,5 +1,5 @@ syntax = "proto3"; -package internal; +package interpreter; service Unix { // Message send by the command gateway to the daemon diff --git a/src/daemon/main.rs b/src/daemon/main.rs index 15b93f3..8b69158 100644 --- a/src/daemon/main.rs +++ b/src/daemon/main.rs @@ -9,7 +9,7 @@ use tokio::net::UnixListener; use tokio_stream::wrappers::UnixListenerStream; use tonic::transport::Server; -use libcommand::internal::unix_server::UnixServer; +use libcommand::interpreter::unix_server::UnixServer; #[cfg(unix)] #[tokio::main] diff --git a/src/daemon/server.rs b/src/daemon/server.rs index bdd51ae..7684caf 100644 --- a/src/daemon/server.rs +++ b/src/daemon/server.rs @@ -2,7 +2,7 @@ use tonic::{Request, Response, Status}; -use libcommand::internal::{ +use libcommand::interpreter::{ unix_server::Unix, AuthorizeRequest, AuthorizeResponse, AuthorizationStatus, TerminateRequest, TerminateResponse, TerminateStatus diff --git a/src/client/client.rs b/src/interpreter/client.rs similarity index 88% rename from src/client/client.rs rename to src/interpreter/client.rs index 880d666..c49435b 100644 --- a/src/client/client.rs +++ b/src/interpreter/client.rs @@ -1,4 +1,4 @@ -use libcommand::internal::unix_client::UnixClient; +use libcommand::interpreter::unix_client::UnixClient; #[cfg(unix)] use tokio::net::UnixStream; diff --git a/src/client/main.rs b/src/interpreter/main.rs similarity index 92% rename from src/client/main.rs rename to src/interpreter/main.rs index f23bc99..4c64669 100644 --- a/src/client/main.rs +++ b/src/interpreter/main.rs @@ -2,7 +2,7 @@ pub mod client; -use libcommand::internal::{AuthorizationStatus, AuthorizeRequest, AuthorizeResponse}; +use libcommand::interpreter::{AuthorizationStatus, AuthorizeRequest, AuthorizeResponse}; use tonic::Response; #[cfg(unix)] diff --git a/src/lib.rs b/src/lib.rs index 07590f7..323eb02 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -3,8 +3,8 @@ use serde::{Serialize, Deserialize}; pub const SOCK_FILE : &'static str = "/var/run/command_gateway.sock"; -pub mod internal { - tonic::include_proto!("internal"); +pub mod interpreter { + tonic::include_proto!("interpreter"); } #[derive(Serialize, Deserialize, Debug)]