Skip to content

Commit ae9dd0e

Browse files
committed
more error messages, initial terrors.md
1 parent 62d1f5e commit ae9dd0e

File tree

8 files changed

+287
-113
lines changed

8 files changed

+287
-113
lines changed

README.md

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,17 @@ or the YARN scheduler starting to summon pre-human deities.
3636

3737
## Implementation notes.
3838

39-
This is a work in progress book designed to built using the [gitbook tool chain](https://github.com/GitbookIO/gitbook),
40-
the best OSS implementation to date of the book-as-software process proposed in
41-
[Refactoring the Publishing Process](http://people.apache.org/~stevel/papers/refactoring_publishing.pdf),
42-
Loughran and Hatcher, 2002.
39+
1. This is a work in progress book designed to built using the [gitbook tool chain](https://github.com/GitbookIO/gitbook).
4340

44-
It is hosted on [github](https://github.com/steveloughran/kerberos_and_hadoop)
41+
1. It is hosted on [github](https://github.com/steveloughran/kerberos_and_hadoop).
42+
43+
1. All the content is Apache licensed.
44+
45+
1. This is not a formal support channel for Hadoop + Kerberos problems. If you have a support
46+
contract with [Hortonworks](http://hortonworks.com/) then issues related to Kerberos may
47+
eventually reach the author. Otherwise: try
48+
49+
- [Hortonworks Answerhub](https://community.hortonworks.com/answers/index.html)
50+
- The users mailing list of Apache Hadoop, the application and you are using on top of it
51+
- [Stack Overflow](http://stackoverflow.com/search?q=hadoop+kerberos).
4552

SUMMARY.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
* [Testing](sections/testing.md)
1616
* [Low-Level Secrets](sections/secrets.md)
1717
* [Error Messages to Fear](sections/errors.md)
18+
* [Tales of Terror](sections/terrors.md)
1819
* [The Limits of Hadoop Security](sections/the_limits_of_hadoop_security.md)
1920
* [Checklists](sections/checklists.md)
2021
* [Glossary](sections/glossary.md)

sections/biblography.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
1. For OS/X users, the GUI ticket viewer is `/System/Library/CoreServices/Ticket\ Viewer.app`
2828
1. [Colouris01], Colouris, Dollimore & Kindberg, 2001, *Distributed System Concepts and Design*,
2929
1. [Java 8 GSS API](https://docs.oracle.com/javase/8/docs/technotes/guides/security/jgss/jgss-features.html)
30+
1. [Ubuntu Kerberos Wiki](https://help.ubuntu.com/community/Kerberos)
3031

3132
### Kerberos, Active Directory and Apache Hadoop
3233

sections/errors.md

Lines changed: 177 additions & 66 deletions
Large diffs are not rendered by default.

sections/secrets.md

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,9 @@ The JVM property MUST be set before UGI is initialized.
4848
The JVM kerberos operations are configured via the `krb5.conf` file specified in the JVM option
4949
`java.security.krb5.conf` which can be done on the JVM command line, or inside the JVM
5050

51-
System.setProperty("java.security.krb5.conf", krbfilepath);
51+
```java
52+
System.setProperty("java.security.krb5.conf", krbfilepath);
53+
```
5254

5355
The JVM property MUST be set before UGI is initialized.
5456

@@ -62,7 +64,9 @@ Notes
6264

6365
You can turn Kerberos low-level logging on
6466

65-
-Dsun.security.krb5.debug=true
67+
```
68+
-Dsun.security.krb5.debug=true
69+
```
6670

6771
This doesn't come out via Log4J, or `java.util logging;` it just comes out on the console. Which is somewhat inconvenient —but bear in mind they are logging at a very low level part of the system. And it does at least log.
6872
If you find yourself down at this level you are in trouble. Bear that in mind.
@@ -72,15 +76,21 @@ If you find yourself down at this level you are in trouble. Bear that in mind.
7276

7377
If you want to debug what is happening in SPNEGO, another system property lets you enable this:
7478

75-
-Dsun.security.spnego.debug=true
79+
```
80+
-Dsun.security.spnego.debug=true
81+
```
7682

77-
## Client side JAAS debugging
83+
## Hadoop-side JAAS debugging
7884

7985
Set the env variable `HADOOP_JAAS_DEBUG` to true and UGI will set the "debug" flag on any JAAS
80-
files it creates
86+
files it creates.
8187

82-
export HADOOP_JAAS_DEBUG=true
88+
You can do this on the client, before issuing a `hadoop`, `hdfs` or `yarn` command,
89+
and set it in the environment script of a YARN service to turn it on there.
8390

91+
```
92+
export HADOOP_JAAS_DEBUG=true
93+
```
8494

8595
On the next Hadoop command, you'll see a trace like
8696

@@ -162,7 +172,7 @@ Current consensus is no: you need DNS set up, or at least a consistent and valid
162172

163173
## Kerberos's defences against replay attacks
164174

165-
from the javadocs of `org.apache.hadoop.ipc.Client.handleSaslConnectionFailure()`:
175+
From the javadocs of `org.apache.hadoop.ipc.Client.handleSaslConnectionFailure()`:
166176

167177
/**
168178
* If multiple clients with the same principal try to connect to the same

sections/terrors.md

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
<!---
2+
Licensed under the Apache License, Version 2.0 (the "License");
3+
you may not use this file except in compliance with the License.
4+
You may obtain a copy of the License at
5+
6+
http://www.apache.org/licenses/LICENSE-2.0
7+
8+
Unless required by applicable law or agreed to in writing, software
9+
distributed under the License is distributed on an "AS IS" BASIS,
10+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11+
See the License for the specific language governing permissions and
12+
limitations under the License. See accompanying LICENSE file.
13+
-->
14+
15+
# Tales of Terror
16+
17+
The following are all true stories. We welcome more submissions of these stories, which will
18+
all be repeated anonymously.
19+
20+
21+
## The Zookeeper's Birthday Present
22+
23+
24+
A client program could not work with zookeeper: the connections were being broken. But it
25+
was working for everything else.
26+
27+
The cluster was one year old that day.
28+
29+
It turns out that ZK reacts to an auth failure by logging something in its logs, and breaking
30+
the client connection —without any notification to the client. Rather than a network problem
31+
(initial hypothesis), this was discovered to be an HDFS problem.
32+
33+
When a Kerberos keytab is created, the entries in it have a lifespan. The default value is one
34+
year. This was its first birthday, hence ZK wouldn't trust the client.
35+

sections/ugi.md

Lines changed: 41 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -144,40 +144,6 @@ What does that mean? A failure lasts for a while, even if it is a transient one.
144144

145145
This returns the *current* user.
146146

147-
The current user is not always the same as the logged in user; it changes
148-
when a service performs an action on the user's behalf
149-
150-
### `createProxyUser()`
151-
152-
Proxy users are a feature which was included in the Hadoop security model for services
153-
such as Oozie; a service which needs to be able to execute work on behalf of a user
154-
155-
### `doAs()`
156-
157-
158-
This method is at the core of UGI. A call to `doAs()` executes the inner code
159-
*as the user*. In secure, that means using the Kerberos tickets and Hadoop delegation
160-
tokens belonging to them.
161-
162-
Example: loading a filesystem as a user
163-
164-
```
165-
166-
UserGroupInformation proxy =
167-
UserGroupInformation.createProxyUser(user,
168-
UserGroupInformation.getLoginUser());
169-
170-
FileSystem userFS = proxy.doAs(
171-
new PrivilegedExceptionAction<FileSystem>() {
172-
public FileSystem run() throws Exception {
173-
return FileSystem.get(FileSystem.getDefaultUri(), conf);
174-
}
175-
});
176-
```
177-
178-
Here the variable `userFS` contains a client of the Hadoop Filesystem with
179-
the home directory and access rights of the user `user`. If the user identity
180-
had come in via an RPC call, they'd
181147

182148

183149

@@ -215,3 +181,44 @@ log4j.logger.org.apache.hadoop.security.authentication=DEBUG
215181
log4j.logger.org.apache.hadoop.security=DEBUG
216182
```
217183

184+
185+
## Proxy Users
186+
187+
Some applications need to act on behalf of other users. For example: Oozie wants to run scheduled
188+
jobs as people, YARN services
189+
190+
191+
The current user is not always the same as the logged in user; it changes
192+
when a service performs an action on the user's behalf
193+
194+
### `createProxyUser()`
195+
196+
Proxy users are a feature which was included in the Hadoop security model for services
197+
such as Oozie; a service which needs to be able to execute work on behalf of a user
198+
199+
### `doAs()`
200+
201+
202+
This method is at the core of UGI. A call to `doAs()` executes the inner code
203+
*as the user*. In secure, that means using the Kerberos tickets and Hadoop delegation
204+
tokens belonging to them.
205+
206+
Example: loading a filesystem as a user
207+
208+
```
209+
210+
UserGroupInformation proxy =
211+
UserGroupInformation.createProxyUser(user,
212+
UserGroupInformation.getLoginUser());
213+
214+
FileSystem userFS = proxy.doAs(
215+
new PrivilegedExceptionAction<FileSystem>() {
216+
public FileSystem run() throws Exception {
217+
return FileSystem.get(FileSystem.getDefaultUri(), conf);
218+
}
219+
});
220+
```
221+
222+
Here the variable `userFS` contains a client of the Hadoop Filesystem with
223+
the home directory and access rights of the user `user`. If the user identity
224+
had come in via an RPC call, they'd

sections/web_and_rest.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
limitations under the License. See accompanying LICENSE file.
1313
-->
1414

15-
# SPNEGO
15+
# Web, REST and SPNEGO
1616

1717
SPNEGO is the acronym of the protocol by which HTTP clients can authenticate with a web site using Kerberos. This allows the client to identify and authenticate itself to a web site or a web service.
1818
SPNEGO is supported by
@@ -29,6 +29,8 @@ Unlike, say Hadoop IPC, where the entire authentication code has been implemente
2929
The sole source of information is the JDK source, and anything which IDE decompilers
3030
can add if you end up stepping in to vendor-specific classes.
3131

32+
There is [one readme file](https://github.com/ddopson/openjdk-test/blob/master/sun/net/www/protocol/http/spnegoReadme) hidden in the test documentation.
33+
3234

3335
## Configuring Firefox to use SPNEGO
3436

0 commit comments

Comments
 (0)