Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ssh: enable empty password login for all users #16

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@ fn generate_shadow() -> io::Result<()> {

for line in reader.lines() {
if let Some((username, _)) = line?.split_once(':') {
writeln!(writer, "{}:!:::::::", username)?;
writeln!(writer, "{}::::::::", username)?;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just to be sure: is it OK to do that with "system" users? e.g. the ones having nologin or false for the shell.

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You raised a valid point... even with localhost only another user might be able to ssh into the guest, potentially having access to data that was only visible to the user that started the vng instance.

So this change seems to have security implications and it's probably safer to stick with the public key authentication.

I'll think more about this, but I'm more inclined to drop this change.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

even with localhost only another user might be able to ssh into the guest, potentially having access to data that was only visible to the user that started the vng instance.

Good point. But then, do we not have the same issue with the VSOCK option? :-/

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In any cases, we should restrict the SSH connection to localhost only by default I think.

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we have any kind of permission restriction with vsock? If not we should mention it in the README or the help.

Maybe we should consider vsock a quick (but potentially unsafe) way to connect to the vng instance and if you need better security use ssh.

And yes, we definitely need to restrict access to localhost only.

Copy link
Collaborator

@matttbe matttbe Dec 31, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we have any kind of permission restriction with vsock? If not we should mention it in the README or the help.

It looks like we have some restrictions with the current code "by accident": when starting the VM, an empty script file will be created (by default /tmp/virtme-console/2222.sh) and only the current user can modify it. So we can connect to the vsock, but nothing will happen apart from executing an empty script. Looks enough, no?

If we want something more secure, it looks like QEmu can take a Unix socket in argument in order not to have the CID accessible to everybody on the machine (via /dev/vhost-vsock), but I didn't really find a lot of documentation about that, except this Rust VMM project that seems to be using a Unix socket. Do you think it is worth investigating? It feels like what we have for the moment is enough.

Now regarding SSH, maybe warning the user in the README/help menu is enough for the moment?

}
}
utils::do_mount(
Expand Down
Loading