Skip to content

Commit d5fafbf

Browse files
bizybotYogesh Gaikwad
authored and
Yogesh Gaikwad
committed
[Kerberos] Use canonical host name (#32588)
The Apache Http components support for Spnego scheme uses canonical name by default. Also when resolving host name, on centos by default there are other aliases so adding them to the DelegationPermission. Closes#32498
1 parent 8d2dbfa commit d5fafbf

File tree

3 files changed

+5
-2
lines changed

3 files changed

+5
-2
lines changed

x-pack/qa/kerberos-tests/build.gradle

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ Object httpPrincipal = new Object() {
4141
@Override
4242
String toString() {
4343
InetAddress resolvedAddress = InetAddress.getByName('127.0.0.1')
44-
return "HTTP/" + resolvedAddress.getHostName()
44+
return "HTTP/" + resolvedAddress.getCanonicalHostName()
4545
}
4646
}
4747

x-pack/qa/kerberos-tests/src/test/java/org/elasticsearch/xpack/security/authc/kerberos/KerberosAuthenticationIT.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ public void testSoDoesNotFailWithNoTests() {
112112
protected HttpHost buildHttpHost(String host, int port) {
113113
try {
114114
InetAddress inetAddress = InetAddress.getByName(host);
115-
return super.buildHttpHost(inetAddress.getHostName(), port);
115+
return super.buildHttpHost(inetAddress.getCanonicalHostName(), port);
116116
} catch (UnknownHostException e) {
117117
assumeNoException("failed to resolve host [" + host + "]", e);
118118
}
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
grant {
22
permission javax.security.auth.AuthPermission "doAsPrivileged";
33
permission javax.security.auth.kerberos.DelegationPermission "\"HTTP/[email protected]\" \"krbtgt/[email protected]\"";
4+
permission javax.security.auth.kerberos.DelegationPermission "\"HTTP/[email protected]\" \"krbtgt/[email protected]\"";
5+
permission javax.security.auth.kerberos.DelegationPermission "\"HTTP/[email protected]\" \"krbtgt/[email protected]\"";
6+
permission javax.security.auth.kerberos.DelegationPermission "\"HTTP/[email protected]\" \"krbtgt/[email protected]\"";
47
};

0 commit comments

Comments
 (0)