Skip to content

Commit 46fa6e7

Browse files
alexandruagalxiord
authored andcommitted
jailer: move api.socket one folder higher
The api.socket file create by the jailer is now in the <exec_file_name>/<id> folder, rather than <exec_file_name>/<id>/root, which should be used exclusively for chrooting into. This keeps more things out of reach for the guest, which increases security. Signed-off-by: Alexandru Agache <[email protected]>
1 parent 93f7320 commit 46fa6e7

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

jailer/src/lib.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,8 @@ pub fn run(args: JailerArgs) -> Result<()> {
154154

155155
let env = Env::new(args)?;
156156

157-
let listener = UnixListener::bind(env.chroot_dir().join(SOCKET_FILE_NAME))
157+
// The unwrap should not fail, since the end of chroot_dir looks like ..../<id>/root
158+
let listener = UnixListener::bind(env.chroot_dir().parent().unwrap().join(SOCKET_FILE_NAME))
158159
.map_err(|e| Error::UnixListener(e))?;
159160

160161
let listener_fd = listener.as_raw_fd();

0 commit comments

Comments
 (0)