UsingHttpTools.apt.vm 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. ~~ Licensed under the Apache License, Version 2.0 (the "License");
  2. ~~ you may not use this file except in compliance with the License.
  3. ~~ You may obtain a copy of the License at
  4. ~~
  5. ~~ http://www.apache.org/licenses/LICENSE-2.0
  6. ~~
  7. ~~ Unless required by applicable law or agreed to in writing, software
  8. ~~ distributed under the License is distributed on an "AS IS" BASIS,
  9. ~~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  10. ~~ See the License for the specific language governing permissions and
  11. ~~ limitations under the License.
  12. ---
  13. Hadoop HDFS over HTTP ${project.version} - Using HTTP Tools
  14. ---
  15. ---
  16. ${maven.build.timestamp}
  17. Hadoop HDFS over HTTP ${project.version} - Using HTTP Tools
  18. * Security
  19. Out of the box HttpFS supports both pseudo authentication and Kerberos HTTP
  20. SPNEGO authentication.
  21. ** Pseudo Authentication
  22. With pseudo authentication the user name must be specified in the
  23. <<<user.name=\<USERNAME\>>>> query string parameter of a HttpFS URL.
  24. For example:
  25. +---+
  26. $ curl "http://<HTTFS_HOST>:14000/webhdfs/v1?op=homedir&user.name=babu"
  27. +---+
  28. ** Kerberos HTTP SPNEGO Authentication
  29. Kerberos HTTP SPNEGO authentication requires a tool or library supporting
  30. Kerberos HTTP SPNEGO protocol.
  31. IMPORTANT: If using <<<curl>>>, the <<<curl>>> version being used must support
  32. GSS (<<<curl -V>>> prints out 'GSS' if it supports it).
  33. For example:
  34. +---+
  35. $ kinit
  36. Please enter the password for tucu@LOCALHOST:
  37. $ curl --negotiate -u foo "http://<HTTPFS_HOST>:14000/webhdfs/v1?op=homedir"
  38. Enter host password for user 'foo':
  39. +---+
  40. NOTE: the <<<-u USER>>> option is required by the <<<--negotiate>>> but it is
  41. not used. Use any value as <<<USER>>> and when asked for the password press
  42. [ENTER] as the password value is ignored.
  43. ** {Remembering Who I Am} (Establishing an Authenticated Session)
  44. As most authentication mechanisms, Hadoop HTTP authentication authenticates
  45. users once and issues a short-lived authentication token to be presented in
  46. subsequent requests. This authentication token is a signed HTTP Cookie.
  47. When using tools like <<<curl>>>, the authentication token must be stored on
  48. the first request doing authentication, and submitted in subsequent requests.
  49. To do this with curl the <<<-b>>> and <<<-c>>> options to save and send HTTP
  50. Cookies must be used.
  51. For example, the first request doing authentication should save the received
  52. HTTP Cookies.
  53. Using Pseudo Authentication:
  54. +---+
  55. $ curl -c ~/.httpfsauth "http://<HTTPFS_HOST>:14000/webhdfs/v1?op=homedir&user.name=babu"
  56. +---+
  57. Using Kerberos HTTP SPNEGO authentication:
  58. +---+
  59. $ curl --negotiate -u foo -c ~/.httpfsauth "http://<HTTPFS_HOST>:14000/webhdfs/v1?op=homedir"
  60. +---+
  61. Then, subsequent requests forward the previously received HTTP Cookie:
  62. +---+
  63. $ curl -b ~/.httpfsauth "http://<HTTPFS_HOST>:14000/webhdfs/v1?op=liststatus"
  64. +---+