4

I want to build a dedicated machine I can use for testing candidates in our company. The machine should run Linux with SSH server listening for connections.

I would like to send each candidate a user and password(the same one).

Upon connection, he will be presented with a message on how to proceed with the test and submit his work. If he disconnect, all the changes will reverted, files, history, everything needs to be erased.

I will also like to support multiple users connecting with the same credentials. so I guess I need to implement some kind of virtualized environement that is created on the fly for each SSH connection.

There is actually an implementation of this in Internet war games ( such as this http://overthewire.org/wargames/bandit/bandit0.html)

Any idea on how to achieve that ?

stdcall
  • 187
  • 1
  • 8
  • 1
    They should all connect to the same server? Per-user VM (created automatically) is not an option? – mzhaase Dec 08 '16 at 15:53

1 Answers1

1

Per-user messages could be an echo statement in $HOME/.bashrc or similar. Even if the user alters that file, they need to login first to do that and even then they would have already seen the message. A better way may be something in /etc/motd. That's what that file is used for.

Have a look at Patrick's answer here for executing something on logout. You could simply reboot the VM and have the hypervisor automatically boot from a clean snapshot/frozen image/whatever. Personally, I would not use .bash_logout for this as it takes a bit of fiddling to make sure the user cannot modify/delete/rename/symlink the file. PAM would be more foolproof.

If you don't want to reboot the VM, maybe a r/o partition with a copy of the original system files could be rsync'd (# rsync -av /mnt/ro/home/ /home/ --delete) to $HOME/ after logout.

Server Fault
  • 3,714
  • 12
  • 54
  • 89