598 try { 599 if (fs.supportsFileSecurity(file)) { 600 if (!fs.isAccessUserOnly(file)) { 601 final String msg = Agent.getText( 602 "jmxremote.ConnectorBootstrap.file.readonly", 603 restrictedFileName); 604 log.config("startRemoteConnectorServer", msg); 605 throw new AgentConfigurationError( 606 FILE_ACCESS_NOT_RESTRICTED, restrictedFileName); 607 } 608 } 609 } catch (IOException e) { 610 throw new AgentConfigurationError( 611 FILE_READ_FAILED, e, restrictedFileName); 612 } 613 } 614 615 /** 616 * Compute the full path name for a default file. 617 * @param basename basename (with extension) of the default file. 618 * @return ${JRE}/lib/management/${basename} 619 **/ 620 private static String getDefaultFileName(String basename) { 621 final String fileSeparator = File.separator; 622 return System.getProperty("java.home") + fileSeparator + "lib" + 623 fileSeparator + "management" + fileSeparator + 624 basename; 625 } 626 627 private static SslRMIServerSocketFactory createSslRMIServerSocketFactory( 628 String sslConfigFileName, 629 String[] enabledCipherSuites, 630 String[] enabledProtocols, 631 boolean sslNeedClientAuth) { 632 if (sslConfigFileName == null) { 633 return new SslRMIServerSocketFactory( 634 enabledCipherSuites, 635 enabledProtocols, 636 sslNeedClientAuth); 637 } else { 638 checkRestrictedFile(sslConfigFileName); 639 try { 640 // Load the SSL keystore properties from the config file 641 Properties p = new Properties(); 642 try (InputStream in = new FileInputStream(sslConfigFileName)) { | 598 try { 599 if (fs.supportsFileSecurity(file)) { 600 if (!fs.isAccessUserOnly(file)) { 601 final String msg = Agent.getText( 602 "jmxremote.ConnectorBootstrap.file.readonly", 603 restrictedFileName); 604 log.config("startRemoteConnectorServer", msg); 605 throw new AgentConfigurationError( 606 FILE_ACCESS_NOT_RESTRICTED, restrictedFileName); 607 } 608 } 609 } catch (IOException e) { 610 throw new AgentConfigurationError( 611 FILE_READ_FAILED, e, restrictedFileName); 612 } 613 } 614 615 /** 616 * Compute the full path name for a default file. 617 * @param basename basename (with extension) of the default file. 618 * @return ${JRE}/conf/management/${basename} 619 **/ 620 private static String getDefaultFileName(String basename) { 621 final String fileSeparator = File.separator; 622 return System.getProperty("java.home") + fileSeparator + "conf" + 623 fileSeparator + "management" + fileSeparator + 624 basename; 625 } 626 627 private static SslRMIServerSocketFactory createSslRMIServerSocketFactory( 628 String sslConfigFileName, 629 String[] enabledCipherSuites, 630 String[] enabledProtocols, 631 boolean sslNeedClientAuth) { 632 if (sslConfigFileName == null) { 633 return new SslRMIServerSocketFactory( 634 enabledCipherSuites, 635 enabledProtocols, 636 sslNeedClientAuth); 637 } else { 638 checkRestrictedFile(sslConfigFileName); 639 try { 640 // Load the SSL keystore properties from the config file 641 Properties p = new Properties(); 642 try (InputStream in = new FileInputStream(sslConfigFileName)) { |