hadoop-common-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Chris Nauroth (JIRA)" <j...@apache.org>
Subject [jira] [Updated] (HADOOP-11699) _HOST not consistently resolving to lowercase fully qualified hostname on Windows
Date Tue, 10 Mar 2015 20:14:38 GMT

     [ https://issues.apache.org/jira/browse/HADOOP-11699?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel

Chris Nauroth updated HADOOP-11699:
    Summary: _HOST not consistently resolving to lowercase fully qualified hostname on Windows
 (was: _HOST not consistently resolving to lowercase fully qualified hostname)

Hi [~kminder].  Thanks for filing this issue.

Just to confirm, is DNS otherwise working correctly in your environment?  For example, does
{{nslookup}} return the expected result?  I expect {{InetAddress.getLocalHost().getCanonicalHostName()}}
to be basically equivalent to a reverse DNS lookup.  If DNS works fine in this environment,
then I suppose we're dealing with some quirk of Java on Windows.

I think {{USERDNSDOMAIN}} is only defined if the logged in user is a domain user.  It won't
be defined if logged in as a local account or a built-in account like administrator.  That's
probably fine though.

Is the {{toLowerCase}} necessary?  I have seen environments where using all caps for Windows
host names was considered a standard practice.  Kerberos is case-sensitive.  DNS is case-insensitive,
but case-preserving on outputs.  Because of that, I'd expect upper case to work fine as long
as both DNS and Kerberos records are consistent in their use of upper case, so that everything

The last line has a {{null}} check.  Did you actually see a {{null}} value in your testing?
 I didn't think {{InetAddress.getLocalHost().getCanonicalHostName()}} could ever return {{null}}.

Just a minor nit-pick: you can use {{org.apache.hadoop.util.Shell#WINDOWS}} as a helper to
check if the runtime environment is Windows.  I recommend completely special-casing all unique
handling on Windows, so that non-Windows continues to use the straight-up {{return InetAddress.getLocalHost().getCanonicalHostName()}}.

> _HOST not consistently resolving to lowercase fully qualified hostname on Windows
> ---------------------------------------------------------------------------------
>                 Key: HADOOP-11699
>                 URL: https://issues.apache.org/jira/browse/HADOOP-11699
>             Project: Hadoop Common
>          Issue Type: Bug
>          Components: security
>    Affects Versions: 2.6.0
>            Reporter: Kevin Minder
>            Assignee: Brahma Reddy Battula
> The _HOST marker used for Kerberos principals in various configuration files does not
always return lowercase fully qualified hostnames.  For example this setting in hdfs-site.xml
> {code}
> <property>
>   <name>dfs.namenode.kerberos.principal</name>
>   <value>hdfs/_HOST@YOURREALM.COM</value>
> </property>
> {code}
> In particular, this is impeding our work to have Hadoop work with equivalent security
on Windows as on Linux.
> In the windows env in which I'm having the issue, I was able to get a fully qualified
host name using this version of method getLocalHostName() in .  
> hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/security/SecurityUtil.java
> {code:java}
>   public static String getLocalHostName() throws UnknownHostException {
>     String hostname = InetAddress.getLocalHost().getCanonicalHostName();
>     if ( !hostname.contains( "." ) ) {
>       final String os = System.getProperties().getProperty( "os.name", "?" ).toLowerCase();
>       if ( os.startsWith( "windows" ) ) {
>         String domain = System.getenv( "USERDNSDOMAIN" );
>         if ( domain != null ) {
>           hostname += "." + domain.trim();
>         }
>       }
>     }
>     return hostname == null ? "localhost" : hostname.toLowerCase();
>   }
> {code}

This message was sent by Atlassian JIRA

View raw message