I have Java code that depends on the system property super.secret.password . I need to set this property when I launch my application. The application will be launched by the shell script, and the password will be stored in a file with minimal read permissions.
I really don't want to write:
java -Dsuper.secret.password=letmein gov.fortknox.MyApp
Because then anyone who can go to the machine and run ps or top can see what a password is.
So, is there a good way to set system properties without exposing them on the command line?
The only general solution we came up with is to write a small C program that reads the system properties from a file, then runs the JVM using the JNI API calls . Needless to say, we are not striving to do this.
If there is no way to install them without using the command line, is there a way to hide the command line from prying eyes? We are using Red Hat Enterprise Linux Server 5.5.
For what it's worth, the application in question is actually JBoss EAP 4.3.0, and we use the system properties to populate the substitution constructs ( ${like.this} ) in the XML configuration files. There are specific JBoss solutions β either use the SystemPropertiesService (by default, configured through the properties-service.xml file in the deployment directory) or pass in - option P to run .sh. However, I am interested in the more general case when it can be any Java program.
source share