ioi / isolate

Sandbox for securely executing untrusted programs
Other
1.04k stars 154 forks source link

java.lang.SecurityException: Can not initialize cryptographic mechanism #127

Closed win10Device closed 1 year ago

win10Device commented 1 year ago

When trying to run a minecraft server jar file in isolate, it throws java.lang.SecurityException: Can not initialize cryptographic mechanism I verified it works when not trying to run with isolate, After quick search, it most likely caused because it can't find [Java path]/conf/security/, How would i include both the path to the jar file and [Java path]/conf/security/ at the same time? Current command: sudo isolate --cg -p --share-net --dir=[mc path]=[mc path]:rw --run -- [Java path]/java -jar [mc path]/paper-1.19.4-549.jar nogui -Xmx1024M -Xms1024M

Edit: After messing around a bit, i was able to get somewhere, now this time the error is java.nio.file.AccessDeniedException: libraries/io/papermc/paper/paper-api/1.19.4-R0.1-SNAPSHOT/paper-api-1.19.4-R0.1-SNAPSHOT.jar, Then i tried with :rw, which had no effect, i put the chmod command where the files are, and tried to run chmod within the container to set the files to a+w before starting the server, as i expected, it didn't work, /boxes/boxed/chmod: changing permissions of '/boxes/[whatever]': Operation not permitted I even tried to put su and sudo in, but they errored out too complaining about no root user,

Current command: (Note, Documents has a folder called boxed, and /boxes is at root) sudo isolate --verbose -p -cg --share-net --dir=/boxes=[documents]:rw --chdir /boxes/[mc] --run -- /boxes/boxed/chmod -R a+w /boxes/[mc] && /boxes/boxed/jdk-17.0.7/bin/java -jar /boxes/[mc]/paper-1.19.4-545.jar

When i run ls -l within the container, all files permissions for [mc] are drwxrwxr-x (chmod, ls, sudo, su commands where copied to boxed, that's how i'm running them in the container)

Another Edit, i overcame that error by chmod on the actual machine, not in the container Now current error is Exception in thread "ServerMain" java.lang.NoClassDefFoundError: com/lmax/disruptor/EventTranslatorVararg

I got it working; I copied boxed folder inside the mc path, I installed cdtool using apt on the actual machine, then copied cdir to the path of the coninater, i run cdir /boxes/ ; boxed/jdk-17.0.7/bin/java -jar paper-1.19.4-545.jar The working command is; sudo isolate --verbose -p -cg --share-net --dir=/boxes=[Documents]/[mc]:rw --chdir /boxes/ -e --run -- cdir /boxes/ ; boxed/jdk-17.0.7/bin/java -Xmx1024M -Xms1024M -jar paper-1.19.4-549.jar nogui