You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-user@hadoop.apache.org by Brahma Reddy Battula <br...@huawei.com> on 2012/09/24 17:12:18 UTC

[Hadoop-SecureMode-Webconsole]Mismatch in documentation and Code

Dear All,

I started cluster in secure-mode by going through following document.

http://hadoop.apache.org/docs/r1.0.3/HttpAuthentication.html


Got following exception from Name-node.

throw new RuntimeException("Could not read HTTP signature secret file: " + signatureSecretFile);


Then I debugged the code and checked,,Problem with "hadoop.http.authentication.signature.secret" configuration.

Code(AuthenticationFilter.java):

static final String SIGNATURE_SECRET_FILE = AuthenticationFilter.SIGNATURE_SECRET + ".file";


While Putting into map(" hadoop.http.authentication.signature.secret" is putting)

 for (Map.Entry<String, String> entry : conf) {
      String name = entry.getKey();
      if (name.startsWith(PREFIX)) {
        String value = conf.get(name);
        name = name.substring(PREFIX.length());
        filterConfig.put(name, value);
      }
    }

Getting from Map:(" hadoop.http.authentication.signature.secret.file" is getting)

    String signatureSecretFile = filterConfig.get(SIGNATURE_SECRET_FILE);
    if (signatureSecretFile == null) {
      throw new RuntimeException("Undefined property: " + SIGNATURE_SECRET_FILE);
    }

    try {
      StringBuilder secret = new StringBuilder();
      Reader reader = new FileReader(signatureSecretFile);
      int c = reader.read();
      while (c > -1) {
        secret.append((char)c);
        c = reader.read();
      }
      reader.close();
      filterConfig.put(AuthenticationFilter.SIGNATURE_SECRET, secret.toString());
    } catch (IOException ex) {
      throw new RuntimeException("Could not read HTTP signature secret file: " + signatureSecretFile);

}



Here I have two questions:

i) why we are puting hadoop.http.authentication.signature.secret and getting hadoop.http.authentication.signature.secret.file..I mean purpose of this..?(I did not gone thru fully).

ii)If we configure "hadoop.http.authentication.signature.secret.file",we wn't get any exception..

If this is the expectation then better to change documentation.


Please let me know if this needs file..I'll file jira.



Thanks And Regards
Brahma Reddy


FW: [Hadoop-SecureMode-Webconsole]Mismatch in documentation and Code

Posted by Brahma Reddy Battula <br...@huawei.com>.
________________________________
From: Brahma Reddy Battula
Sent: Monday, September 24, 2012 11:12 PM
To: user@hadoop.apache.org
Subject: [Hadoop-SecureMode-Webconsole]Mismatch in documentation and Code


Dear All,

I started cluster in secure-mode by going through following document.

http://hadoop.apache.org/docs/r1.0.3/HttpAuthentication.html


Got following exception from Name-node.

throw new RuntimeException("Could not read HTTP signature secret file: " + signatureSecretFile);


Then I debugged the code and checked,,Problem with "hadoop.http.authentication.signature.secret" configuration.

Code(AuthenticationFilter.java):

static final String SIGNATURE_SECRET_FILE = AuthenticationFilter.SIGNATURE_SECRET + ".file";


While Putting into map(" hadoop.http.authentication.signature.secret" is putting)

 for (Map.Entry<String, String> entry : conf) {
      String name = entry.getKey();
      if (name.startsWith(PREFIX)) {
        String value = conf.get(name);
        name = name.substring(PREFIX.length());
        filterConfig.put(name, value);
      }
    }

Getting from Map:(" hadoop.http.authentication.signature.secret.file" is getting)

    String signatureSecretFile = filterConfig.get(SIGNATURE_SECRET_FILE);
    if (signatureSecretFile == null) {
      throw new RuntimeException("Undefined property: " + SIGNATURE_SECRET_FILE);
    }

    try {
      StringBuilder secret = new StringBuilder();
      Reader reader = new FileReader(signatureSecretFile);
      int c = reader.read();
      while (c > -1) {
        secret.append((char)c);
        c = reader.read();
      }
      reader.close();
      filterConfig.put(AuthenticationFilter.SIGNATURE_SECRET, secret.toString());
    } catch (IOException ex) {
      throw new RuntimeException("Could not read HTTP signature secret file: " + signatureSecretFile);

}



Here I have two questions:

i) why we are puting hadoop.http.authentication.signature.secret and getting hadoop.http.authentication.signature.secret.file..I mean purpose of this..?(I did not gone thru fully).

ii)If we configure "hadoop.http.authentication.signature.secret.file",we wn't get any exception..

If this is the expectation then better to change documentation.


Please let me know if this needs file..I'll file jira.



Thanks And Regards
Brahma Reddy