-
Notifications
You must be signed in to change notification settings - Fork 92
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
Fix nullpointer that occurs when OAuthKafkaPrincipalBuilder is used with Kerberos listener #207
Changes from all commits
b7fbcca
83f4a73
97b2143
3c97f8e
31ac9ed
88a0534
0576b85
fe0930a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
FROM ubuntu:22.04 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @mstruk Are you fine with this being based on Ubuntu? Strimzi IMHO does not use Ubuntu images anywhere else. So I would feel better if this used Red Hat UBI images as all our other projects. But I can live with this if you are fine with it. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Now that you pointed this out, if I remember correctly, we had some Travis build issues with Ubuntu images on some architectures. @akaczano Could you try use: or
You may need to install some additional packages. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sure; I'll give that a try. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I took a look at this and it looks very challenging to set it up on |
||
|
||
RUN DEBIAN_FRONTEND=noninteractive apt-get update -y && apt-get install -y krb5-kdc krb5-admin-server | ||
|
||
EXPOSE 88 749 | ||
|
||
ADD ./config.sh /config.sh | ||
|
||
ENTRYPOINT ["/config.sh"] | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
#!/bin/bash | ||
|
||
[[ "TRACE" ]] && set -x | ||
|
||
: ${REALM:=KERBEROS} | ||
: ${DOMAIN_REALM:=kerberos} | ||
: ${KERB_MASTER_KEY:=masterkey} | ||
: ${KERB_ADMIN_USER:=admin} | ||
: ${KERB_ADMIN_PASS:=admin} | ||
: ${KAFKA_USER:=kafka} | ||
: ${KAFKA_HOST:=kafka} | ||
: ${KAFKA_CLIENT_USER:=client} | ||
|
||
fix_nameserver() { | ||
cat>/etc/resolv.conf<<EOF | ||
nameserver $NAMESERVER_IP | ||
search $SEARCH_DOMAINS | ||
EOF | ||
} | ||
|
||
fix_hostname() { | ||
sed -i "/^hosts:/ s/ *files dns/ dns files/" /etc/nsswitch.conf | ||
} | ||
|
||
create_config() { | ||
: ${KDC_ADDRESS:=$(hostname -f)} | ||
|
||
cat>/etc/krb5.conf<<EOF | ||
[logging] | ||
default = FILE:/var/log/kerberos/krb5libs.log | ||
kdc = FILE:/var/log/kerberos/krb5kdc.log | ||
admin_server = FILE:/var/log/kerberos/kadmind.log | ||
|
||
[libdefaults] | ||
default_realm = $REALM | ||
dns_lookup_realm = false | ||
dns_lookup_kdc = false | ||
ticket_lifetime = 24h | ||
renew_lifetime = 7d | ||
forwardable = true | ||
|
||
[realms] | ||
$REALM = { | ||
kdc = $KDC_ADDRESS | ||
admin_server = $KDC_ADDRESS | ||
} | ||
|
||
[domain_realm] | ||
.$DOMAIN_REALM = $REALM | ||
$DOMAIN_REALM = $REALM | ||
EOF | ||
} | ||
|
||
create_db() { | ||
kdb5_util -P $KERB_MASTER_KEY -r $REALM create -s | ||
} | ||
|
||
start_kdc() { | ||
service krb5-kdc start | ||
service krb5-admin-server start | ||
} | ||
|
||
restart_kdc() { | ||
service krb5-kdc restart | ||
service krb5-admin-server restart | ||
} | ||
|
||
create_admin_user() { | ||
kadmin.local -q "addprinc -pw $KERB_ADMIN_PASS $KERB_ADMIN_USER/admin" | ||
echo "*/admin@$REALM *" > /etc/krb5kdc/kadm5.acl | ||
} | ||
|
||
create_kafka_user() { | ||
kadmin.local -q "addprinc -randkey $KAFKA_HOST/$KAFKA_USER@$REALM" | ||
kadmin.local -q "ktadd -k /keytabs/kafka_broker.keytab $KAFKA_HOST/$KAFKA_USER@$REALM" | ||
kadmin.local -q "addprinc -randkey $KAFKA_HOST/$KAFKA_CLIENT_USER@$REALM" | ||
kadmin.local -q "ktadd -k /keytabs/kafka_client.keytab $KAFKA_HOST/$KAFKA_CLIENT_USER@$REALM" | ||
chmod 666 /keytabs/kafka_broker.keytab | ||
chmod 666 /keytabs/kafka_client.keytab | ||
} | ||
|
||
|
||
|
||
if [ ! -f /kerberos_initialized ]; then | ||
mkdir -p /var/log/kerberos | ||
create_config | ||
create_db | ||
create_admin_user | ||
create_kafka_user | ||
start_kdc | ||
|
||
touch /kerberos_initialized | ||
else | ||
start_kdc | ||
fi | ||
|
||
tail -F /var/log/kerberos/krb5kdc.log |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
KafkaServer { | ||
com.sun.security.auth.module.Krb5LoginModule required | ||
useKeyTab=true | ||
storeKey=true | ||
keyTab="/opt/kafka/keytabs/kafka_broker.keytab" | ||
principal="kafka/kafka@KERBEROS"; | ||
}; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
[logging] | ||
default = FILE:/var/log/kerberos/krb5libs.log | ||
kdc = FILE:/var/log/kerberos/krb5kdc.log | ||
admin_server = FILE:/var/log/kerberos/kadmind.log | ||
[libdefaults] | ||
default_realm = KERBEROS | ||
dns_lookup_realm = false | ||
dns_lookup_kdc = false | ||
ticket_lifetime = 24h | ||
renew_lifetime = 7d | ||
forwardable = true | ||
rdns = false | ||
ignore_acceptor_hostname = true | ||
[realms] | ||
KERBEROS = { | ||
kdc = kerberos | ||
admin_server = kerberos | ||
} | ||
[domain_realm] | ||
.kerberos = KERBEROS | ||
kerberos = KERBEROS |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this have the same alignment as the lines above? I guess technically, it does not matter, but would be more readable.