c0re: chmod 0666 mcp.sock after bind so in-container agent user can connect (#658 fixup)
This commit is contained in:
parent
b8647cf7dc
commit
8571e3243a
2 changed files with 14 additions and 0 deletions
|
|
@ -29,6 +29,15 @@ pub fn start(agent: &str, socket_path: &Path, coord: Arc<Coordinator>) -> Result
|
|||
}
|
||||
let listener = UnixListener::bind(socket_path)
|
||||
.with_context(|| format!("bind agent socket {}", socket_path.display()))?;
|
||||
// The socket is bind-mounted into exactly one container as
|
||||
// `/run/hive/mcp.sock` (`lifecycle::set_nspawn_flags`); post-#658
|
||||
// the in-container harness connects as the per-agent unix user,
|
||||
// not root, so the default `tokio::net::UnixListener::bind` perms
|
||||
// (0755) lock it out. 0666 lets the agent user connect; the bind
|
||||
// source dir is per-agent on host so blast radius is unchanged.
|
||||
use std::os::unix::fs::PermissionsExt as _;
|
||||
std::fs::set_permissions(socket_path, std::fs::Permissions::from_mode(0o666))
|
||||
.with_context(|| format!("chmod agent socket {}", socket_path.display()))?;
|
||||
tracing::info!(%agent, socket = %socket_path.display(), "agent socket listening");
|
||||
|
||||
let path = socket_path.to_path_buf();
|
||||
|
|
|
|||
|
|
@ -23,6 +23,11 @@ pub fn start(coord: Arc<Coordinator>) -> Result<()> {
|
|||
}
|
||||
let listener = UnixListener::bind(&socket)
|
||||
.with_context(|| format!("bind manager socket {}", socket.display()))?;
|
||||
// 0666 so the in-container hm1nd user (post-#658) can connect;
|
||||
// the bind source dir is manager-only on host. See agent_server.rs.
|
||||
use std::os::unix::fs::PermissionsExt as _;
|
||||
std::fs::set_permissions(&socket, std::fs::Permissions::from_mode(0o666))
|
||||
.with_context(|| format!("chmod manager socket {}", socket.display()))?;
|
||||
tracing::info!(socket = %socket.display(), "manager socket listening");
|
||||
|
||||
tokio::spawn(async move {
|
||||
|
|
|
|||
Loading…
Reference in a new issue