diff options
author | networkException <git@nwex.de> | 2023-10-03 17:31:40 +0200 |
---|---|---|
committer | networkException <git@nwex.de> | 2023-10-03 17:31:40 +0200 |
commit | 7907a09acc812f857f283d64c988c69d08acd041 (patch) | |
tree | b90797527648ff0d73bd7087b4b95b27938a1fec /src/api/generic_server.rs | |
parent | 8ec6a53b35e5bb742640a77ff282f2474c63af54 (diff) | |
download | garage-7907a09acc812f857f283d64c988c69d08acd041.tar.gz garage-7907a09acc812f857f283d64c988c69d08acd041.zip |
api: allow custom unix bind mode and use 0o220 for admin server
Diffstat (limited to 'src/api/generic_server.rs')
-rw-r--r-- | src/api/generic_server.rs | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/api/generic_server.rs b/src/api/generic_server.rs index 42c65ab7..fa346f48 100644 --- a/src/api/generic_server.rs +++ b/src/api/generic_server.rs @@ -98,6 +98,7 @@ impl<A: ApiHandler> ApiServer<A> { pub async fn run_server( self: Arc<Self>, bind_addr: UnixOrTCPSocketAddress, + unix_bind_addr_mode: Option<u32>, shutdown_signal: impl Future<Output = ()>, ) -> Result<(), GarageError> { let tcp_service = make_service_fn(|conn: &AddrStream| { @@ -146,7 +147,10 @@ impl<A: ApiHandler> ApiServer<A> { let bound = Server::bind_unix(path)?; - fs::set_permissions(path, Permissions::from_mode(0o222))?; + fs::set_permissions( + path, + Permissions::from_mode(unix_bind_addr_mode.unwrap_or(0o222)), + )?; bound .serve(unix_service) |