mirror of
https://github.com/honeymoose/OpenSearch.git
synced 2025-02-22 12:56:53 +00:00
[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
This commit is contained in:
parent
0a67cb4133
commit
615aa85f4e
@ -41,7 +41,7 @@ Object httpPrincipal = new Object() {
|
||||
@Override
|
||||
String toString() {
|
||||
InetAddress resolvedAddress = InetAddress.getByName('127.0.0.1')
|
||||
return "HTTP/" + resolvedAddress.getHostName()
|
||||
return "HTTP/" + resolvedAddress.getCanonicalHostName()
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -112,7 +112,7 @@ public class KerberosAuthenticationIT extends ESRestTestCase {
|
||||
protected HttpHost buildHttpHost(String host, int port) {
|
||||
try {
|
||||
InetAddress inetAddress = InetAddress.getByName(host);
|
||||
return super.buildHttpHost(inetAddress.getHostName(), port);
|
||||
return super.buildHttpHost(inetAddress.getCanonicalHostName(), port);
|
||||
} catch (UnknownHostException e) {
|
||||
assumeNoException("failed to resolve host [" + host + "]", e);
|
||||
}
|
||||
|
@ -1,4 +1,7 @@
|
||||
grant {
|
||||
permission javax.security.auth.AuthPermission "doAsPrivileged";
|
||||
permission javax.security.auth.kerberos.DelegationPermission "\"HTTP/localhost@BUILD.ELASTIC.CO\" \"krbtgt/BUILD.ELASTIC.CO@BUILD.ELASTIC.CO\"";
|
||||
permission javax.security.auth.kerberos.DelegationPermission "\"HTTP/localhost.localdomain@BUILD.ELASTIC.CO\" \"krbtgt/BUILD.ELASTIC.CO@BUILD.ELASTIC.CO\"";
|
||||
permission javax.security.auth.kerberos.DelegationPermission "\"HTTP/localhost4@BUILD.ELASTIC.CO\" \"krbtgt/BUILD.ELASTIC.CO@BUILD.ELASTIC.CO\"";
|
||||
permission javax.security.auth.kerberos.DelegationPermission "\"HTTP/localhost4.localdomain4@BUILD.ELASTIC.CO\" \"krbtgt/BUILD.ELASTIC.CO@BUILD.ELASTIC.CO\"";
|
||||
};
|
Loading…
x
Reference in New Issue
Block a user