← Back to team overview

dhis2-devs team mailing list archive

Re: [Branch ~dhis2-devs-core/dhis2/trunk] Rev 16983: Added java home to system info

 

Hi Bob,

On Tue, Oct 7, 2014 at 6:31 PM, Bob Jolliffe <bobjolliffe@xxxxxxxxx> wrote:

> Hi Lars
>
> This is a good idea but doesn't necessarily give you want to know.  The
> same with JAVA_OPTS.  The dhis2-tools for example follows the tomcat
> convention and sets CATALINA_OPTS rather than JAVA_OPTS.  Also we don't
> actually specify JAVA_HOME anywhere - we don't need to.
>
> So neither of these two are going to show up anything useful for me :-(.
>
> I guess re JAVA_HOME the important thing you are looking for is the java
> version and vendor?  Though vendor seems to show up as Oracle even for
> openjdk so maybe some other variable is available to query.  I can check
> that.
>
>
Yes agreed. Java version and vendor already there - in this case I simply
needed JAVA_HOME ;)


> For the OPTS, again, I wonder if there is some other way of more
> accurately reading the options which the jvm was actually started with,
> rather than displaying the environment variable which may or may not be
> used or overridden?  I am sure there is - again I can check.
>
> [As a side note, Dumping env variables out to the screen might also be
> something of a security concern.  Quite besides exposing directories (like
> java temp directory) which can be used to inform an attack, I worry about
> the effect for example of having some interesting javascript as part of the
> JAVA_HOME string :-)  Though I know much of the About block is restricted
> to superuser access which is a good thing].
>
>


Yes the server info is only sent to the client for users with the ALL auth.
Might be a slight concern but this info is invaluable for trouble-shooting.

cheers

Lars


> Bob
>
>
>
> On 7 October 2014 14:57, <noreply@xxxxxxxxxxxxx> wrote:
>
>> ------------------------------------------------------------
>> revno: 16983
>> committer: Lars Helge Overland <larshelge@xxxxxxxxx>
>> branch nick: dhis2
>> timestamp: Tue 2014-10-07 15:56:16 +0200
>> message:
>>   Added java home to system info
>> modified:
>>
>> dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/system/DefaultSystemService.java
>>
>> dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/system/SystemInfo.java
>>
>> dhis-2/dhis-services/dhis-service-core/src/main/resources/i18n_global.properties
>>
>> dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/about/about.vm
>>
>>
>> --
>> lp:dhis2
>> https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk
>>
>> Your team DHIS 2 developers is subscribed to branch lp:dhis2.
>> To unsubscribe from this branch go to
>> https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription
>>
>> === modified file
>> 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/system/DefaultSystemService.java'
>> ---
>> dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/system/DefaultSystemService.java
>> 2014-05-23 11:11:47 +0000
>> +++
>> dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/system/DefaultSystemService.java
>> 2014-10-07 13:56:16 +0000
>> @@ -164,6 +164,7 @@
>>
>>          Properties props = System.getProperties();
>>
>> +        systemInfo.setJavaHome( props.getProperty( "java.home" ) );
>>          systemInfo.setJavaIoTmpDir( props.getProperty( "java.io.tmpdir"
>> ) );
>>          systemInfo.setJavaVersion( props.getProperty( "java.version" ) );
>>          systemInfo.setJavaVendor( props.getProperty( "java.vendor" ) );
>>
>> === modified file
>> 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/system/SystemInfo.java'
>> ---
>> dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/system/SystemInfo.java
>>  2014-05-23 11:11:47 +0000
>> +++
>> dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/system/SystemInfo.java
>>  2014-10-07 13:56:16 +0000
>> @@ -64,6 +64,8 @@
>>
>>      private String javaVendor;
>>
>> +    private String javaHome;
>> +
>>      private String javaIoTmpDir;
>>
>>      private String javaOpts;
>> @@ -93,6 +95,7 @@
>>          this.revision = null;
>>          this.javaVersion = null;
>>          this.javaVendor = null;
>> +        this.javaHome = null;
>>          this.javaIoTmpDir = null;
>>          this.javaOpts = null;
>>          this.osName = null;
>> @@ -243,6 +246,18 @@
>>
>>      @JsonProperty
>>      @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 )
>> +    public String getJavaHome()
>> +    {
>> +        return javaHome;
>> +    }
>> +
>> +    public void setJavaHome( String javaHome )
>> +    {
>> +        this.javaHome = javaHome;
>> +    }
>> +
>> +    @JsonProperty
>> +    @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 )
>>      public String getJavaIoTmpDir()
>>      {
>>          return javaIoTmpDir;
>>
>> === modified file
>> 'dhis-2/dhis-services/dhis-service-core/src/main/resources/i18n_global.properties'
>> ---
>> dhis-2/dhis-services/dhis-service-core/src/main/resources/i18n_global.properties
>>   2014-10-06 13:02:52 +0000
>> +++
>> dhis-2/dhis-services/dhis-service-core/src/main/resources/i18n_global.properties
>>   2014-10-07 13:56:16 +0000
>> @@ -398,7 +398,8 @@
>>  user_account=User account
>>  last_name=Last name
>>  unknown=Unknown
>> -java_opts=Java Opts
>> +java_opts=Java opts
>> +java_home=Java home
>>  java_tmp_dir=Java temporary directory
>>  java_version=Java version
>>  java_vendor=Java vendor
>>
>> === modified file
>> 'dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/about/about.vm'
>> ---
>> dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/about/about.vm
>> 2013-10-22 18:10:32 +0000
>> +++
>> dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/about/about.vm
>> 2014-10-07 13:56:16 +0000
>> @@ -15,6 +15,7 @@
>>    <dt>$i18n.getString( "database_name" ):</dt><dd>$!
>> info.databaseInfo.name</dd>
>>    <dt>$i18n.getString( "database_user"
>> ):</dt><dd>$!info.databaseInfo.user</dd>
>>    <dt>$i18n.getString( "java_opts" ):</dt><dd>$!info.javaOpts</dd>
>> +  <dt>$i18n.getString( "java_home" ):</dt><dd>$!info.javaHome</dd>
>>    <dt>$i18n.getString( "java_tmp_dir" ):</dt><dd>$!info.javaIoTmpDir</dd>
>>    <dt>$i18n.getString( "java_version" ):</dt><dd>$!info.javaVersion</dd>
>>    <dt>$i18n.getString( "java_vendor" ):</dt><dd>$!info.javaVendor</dd>
>>
>>
>> _______________________________________________
>> Mailing list: https://launchpad.net/~dhis2-devs
>> Post to     : dhis2-devs@xxxxxxxxxxxxxxxxxxx
>> Unsubscribe : https://launchpad.net/~dhis2-devs
>> More help   : https://help.launchpad.net/ListHelp
>>
>>
>

References