Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support hbase enable kerberos authentication #1234

Merged
merged 2 commits into from
Oct 30, 2020

Conversation

tmljob
Copy link
Contributor

@tmljob tmljob commented Oct 29, 2020

support hbase enable kerberos authentication.

add configs as follows:

  • hbase.kerberos.enable, default value:false
  • hbase.krb5.conf,default value:/etc/krb5.conf
  • hbase.kerberos.principal,default value:""
  • hbase.kerberos.keytab,default value:""

Copy link
Contributor

@javeme javeme left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for contributing, there are some minor comments:

  1. The PR title is expected to be more clear, like "support hbase enable kerberos authentication".
  2. And "implement hbase作为backend是否支持开启kerberos认证? #1227" to commit message.
  3. Some inline comments.

support hbase enable kerberos authentication.add configs as follows:
hbase.kerberos.enable, default value:false
hbase.krb5.conf,default value:/etc/krb5.conf
hbase.kerberos.principal,default value:""
hbase.kerberos.keytab,default value:""
@codecov
Copy link

codecov bot commented Oct 29, 2020

Codecov Report

Merging #1234 into master will decrease coverage by 0.01%.
The diff coverage is 43.75%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master    #1234      +/-   ##
============================================
- Coverage     65.13%   65.12%   -0.02%     
  Complexity     5758     5758              
============================================
  Files           366      366              
  Lines         29910    29926      +16     
  Branches       4223     4224       +1     
============================================
+ Hits          19483    19490       +7     
- Misses         8447     8455       +8     
- Partials       1980     1981       +1     
Impacted Files Coverage Δ Complexity Δ
...u/hugegraph/backend/store/hbase/HbaseSessions.java 58.47% <10.00%> (-1.47%) 21.00 <0.00> (ø)
...du/hugegraph/backend/store/hbase/HbaseOptions.java 96.55% <100.00%> (+0.89%) 2.00 <0.00> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 406cfe0...03c8a1f. Read the comment docs.

hConfig = HBaseConfiguration.create();
String principal = config.get(HbaseOptions.HBASE_KERBEROS_PRINCIPAL);
String keyTab = config.get(HbaseOptions.HBASE_KERBEROS_KEYTAB);
hConfig.set("hadoop.security.authentication", "kerberos");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add hConfig.set("hadoop.security.authorization", "true");

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not a legal argument. After setting,program reports exception ,as follows:
Exception in thread "main" java.lang.IllegalArgumentException: Invalid attribute value for hadoop.security.authentication of true
at org.apache.hadoop.security.SecurityUtil.getAuthenticationMethod(SecurityUtil.java:609)
at org.apache.hadoop.security.UserGroupInformation.initialize(UserGroupInformation.java:272)
at org.apache.hadoop.security.UserGroupInformation.setConfiguration(UserGroupInformation.java:311)

Configuration hConfig = null;
if(isEnableKerberos) {
String krb5Conf = config.get(HbaseOptions.HBASE_KRB5_CONF);
System.setProperty("java.security.krb5.conf", krb5Conf);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove this line if possible.

Copy link
Contributor Author

@tmljob tmljob Oct 29, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

which line need to remove?pls tell me line num.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@houzhizhen It seems that setting this environment java.security.krb5.conf is the best way, see Locating the krb5.conf Configuration File

@tmljob tmljob changed the title fix #1227 support hbase enable kerberos authentication Oct 29, 2020
Configuration hConfig = null;
if(isEnableKerberos) {
String krb5Conf = config.get(HbaseOptions.HBASE_KRB5_CONF);
System.setProperty("java.security.krb5.conf", krb5Conf);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@houzhizhen It seems that setting this environment java.security.krb5.conf is the best way, see Locating the krb5.conf Configuration File

@javeme javeme merged commit ca5f48d into apache:master Oct 30, 2020
tmljob added a commit to tmljob/hugegraph that referenced this pull request Dec 10, 2020
support hbase enable kerberos authentication.

add configs as follows:
- hbase.kerberos.enable, default value:false
- hbase.krb5.conf,default value:/etc/krb5.conf
- hbase.kerberos.principal,default value:""
- hbase.kerberos.keytab,default value:""

* implement apache#1227
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants