Uploaded image for project: 'Apache Whirr (retired)'
  1. Apache Whirr (retired)
  2. WHIRR-730

Use the InetAddress.getLocalHost() instead of URL("http://checkip.amazonaws.com/") to get the local address

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 0.8.2
    • 0.9.0
    • core
    • None
    • Unbuntu, Openstack

    Description

      Hi,all

      I have found the FirewallManager.getOriginatingIp() use the following method to get the ip address

      FirewallManager.java
        /**
         * @return the IP address of the client on which this code is running.
         * @throws IOException
         */
        private String getOriginatingIp() throws IOException {
          if ("stub".equals(clusterSpec.getProvider())) {
            return "62.217.232.123";
          }
      
          URL url = new URL("http://checkip.amazonaws.com/");
          HttpURLConnection connection = (HttpURLConnection) url.openConnection();
          connection.connect();
          return IOUtils.toString(connection.getInputStream()).trim() + "/32";
        }
      

      I think we should use the InetAddress.getLocalHost() to get the ipaddress, here's some of my reason:
      1). I think it is illegal for an application to get the client ip address throght the erternal website, what else if the amazon is broken and we can access the http://checkip.amazonaws.com/ or if the situation of the internet can't worked well, it will be failed to launch the cluster because we can't connect to the http://checkip.amazonaws.com/.

      2). If any of the private company want to reuse the whirr project to create the cluster, Some of the company need to use the proxy to access the external website, Although the whirr project support to config the proxy, but it is still complicated for us to apply for the IT Department to authorize the proxy for the VM we have created by the whirr.

      3). I think it is simple to use the InetAddress.getLocalHost() to get the local ip address

      Thanks

      -Jeremy Lv

      Attachments

        1. FirewallManager.java.patch
          1 kB
          Jeremy Lv

        Activity

          People

            Unassigned Unassigned
            jeremy_lv Jeremy Lv
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated: