Search code examples
javafreebsdkernelbsd

Building a custom BSD version that supports only Java


What is the process I should use to accomplish the goal of building a version of FreeBSD that is capable of running a Java VM but not capable of any other functionality including, but not limited to:

  1. Running any process other than the Java VM
  2. Disabling any/all shell access
  3. When the Java VM exits, the OS shuts down

I need to support JDK 1.6, so approaches such as SANOS do not work.


Solution

    1. Configure the init script to run the JVM after user authentication.
    2. Remove the line in one of the init scripts that spawns the shell, typically after user authentication.
    3. There should be a listener for Java processes, if it doesn't find any, fire "init 0" or "shutdown" or "poweroff"