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

Retrieve jwt token from token provider #3560

Merged
merged 11 commits into from
Nov 23, 2021

Conversation

jliunyu
Copy link
Contributor

@jliunyu jliunyu commented Sep 27, 2021

Retrieve jwt from token provider and forward it to the broker: the example received from provider is listed as the json below, extract the token key with key work "access_token".

{
    “access_token”: “eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiIsImtpZCI6ImFiY2VkZmcifQ.eyJleHAiOjE2MzI2ODYwNjAsImlhdCI6MTYzMjY4NTc2MCwic3ViIjoic3ViIn0.yY0F9NUD-MJydlF0NzfNXQtl7gYKO6A-yKM-6_6RTcg”
}

Test:

  1. The extract jwt from json is tested with unit test.
  2. The HTTP(S) request to http server part is tested with the following function which is not added to the unit test part:
int unittest_sasl_oauthbearer_oidc (void) {
        rd_kafka_conf_res_t res;

        rd_kafka_conf_t *conf = NULL;
        rd_kafka_t *rk;
        char errstr[512];

        RD_UT_BEGIN();

        conf = rd_kafka_conf_new();
        res = rd_kafka_conf_set(conf, "sasl.oauthbearer.token.endpoint.url",
                                "http://localhost:8080/retrieve", NULL, 0);
        res = rd_kafka_conf_set(conf, "sasl.oauthbearer.client.id",
                                "123", NULL, 0);
        res = rd_kafka_conf_set(conf, "sasl.oauthbearer.client.secret",
                               "abc", NULL, 0);
        res = rd_kafka_conf_set(conf, "sasl.oauthbearer.scope",
                                "test-scope", NULL, 0);
        res = rd_kafka_conf_set(conf, "sasl.oauthbearer.extensions",
                                "grant_type=client_credentials,"
                                "scope=test-scope",
                                NULL, 0);
        rk = rd_kafka_new(RD_KAFKA_CONSUMER, conf, errstr, sizeof(errstr));
        rd_kafka_conf_set_oauthbearer_oidc_token_refresh_cb(rk, NULL, NULL);

        rd_kafka_destroy(rk);
        RD_UT_PASS();
}
  1. Tested with OKTA as token provider and mock up broker.
[0126_oauthbearer_oidc       /  4.993s] [ do_test_produce_consumer_with_OIDC:48: Test producer and consumer with oidc configuration: PASS (4.99s) ]
[0126_oauthbearer_oidc       /  4.994s] [ do_test_produce_consumer_with_OIDC_should_fail:110: Test OAUTHBEARER/OIDC failing with invalid JWT ]
[0126_oauthbearer_oidc       /  4.995s] Created    kafka instance 0126_oauthbearer_oidc#consumer-3
[<MAIN>                      /  5.026s] 1 test(s) running: 0126_oauthbearer_oidc
[<MAIN>                      /  6.031s] 1 test(s) running: 0126_oauthbearer_oidc
%3|1635444868.772|FAIL|0126_oauthbearer_oidc#consumer-3| [thrd:sasl_plaintext://0.0.0.0:57804/bootstrap]: sasl_plaintext://0.0.0.0:57804/bootstrap: SASL authentication error: {"status":"invalid_token"} (after 313ms in state AUTH_REQ)
[0126_oauthbearer_oidc       /  6.314s] Expected error: Local: Authentication failure: sasl_plaintext://0.0.0.0:57804/bootstrap: SASL authentication error: {"status":"invalid_token"} (after 313ms in state AUTH_REQ)
[0126_oauthbearer_oidc       /  6.314s] Closing consumer 0126_oauthbearer_oidc#consumer-3
[0126_oauthbearer_oidc       /  6.314s] CONSUMER.CLOSE: duration 0.050ms
[0126_oauthbearer_oidc       /  6.315s] [ do_test_produce_consumer_with_OIDC_should_fail:110: Test OAUTHBEARER/OIDC failing with invalid JWT: PASS (1.32s) ]
[0126_oauthbearer_oidc       /  6.315s] 0126_oauthbearer_oidc: duration 6314.545ms
[0126_oauthbearer_oidc       /  6.315s] ================= Test 0126_oauthbearer_oidc PASSED =================
[<MAIN>                      /  7.036s] ALL-TESTS: duration 7035.850ms
TEST 20211028111429 (bare, scenario default) SUMMARY
#==================================================================#
| <MAIN>                                   |     PASSED |   7.037s |
| 0126_oauthbearer_oidc                    |     PASSED |   6.315s |
#==================================================================#
[<MAIN>                      /  7.041s] 0 thread(s) in use by librdkafka
[<MAIN>                      /  7.041s] 
============== ALL TESTS PASSED ==============
###
###  ./test-runner in bare mode PASSED! ###
###
bash-3.2$ 
  1. The build failure from Windows is not related to this PR:
[100%] Built target test-runner
Install the project...
-- Install configuration: ""
-- Installing: C:/Users/travis/build/edenhill/librdkafka/dest/lib/cmake/RdKafka/RdKafkaConfig.cmake
-- Installing: C:/Users/travis/build/edenhill/librdkafka/dest/lib/cmake/RdKafka/RdKafkaConfigVersion.cmake
-- Installing: C:/Users/travis/build/edenhill/librdkafka/dest/lib/cmake/RdKafka/FindLZ4.cmake
-- Installing: C:/Users/travis/build/edenhill/librdkafka/dest/lib/cmake/RdKafka/RdKafkaTargets.cmake
-- Installing: C:/Users/travis/build/edenhill/librdkafka/dest/lib/cmake/RdKafka/RdKafkaTargets-noconfig.cmake
-- Installing: C:/Users/travis/build/edenhill/librdkafka/dest/share/licenses/librdkafka/LICENSES.txt
-- Installing: C:/Users/travis/build/edenhill/librdkafka/dest/lib/pkgconfig/rdkafka-static.pc
-- Installing: C:/Users/travis/build/edenhill/librdkafka/dest/lib/librdkafka.a
-- Installing: C:/Users/travis/build/edenhill/librdkafka/dest/include/librdkafka/rdkafka.h
-- Installing: C:/Users/travis/build/edenhill/librdkafka/dest/include/librdkafka/rdkafka_mock.h
-- Installing: C:/Users/travis/build/edenhill/librdkafka/dest/lib/pkgconfig/rdkafka++-static.pc
-- Installing: C:/Users/travis/build/edenhill/librdkafka/dest/lib/librdkafka++.a
-- Installing: C:/Users/travis/build/edenhill/librdkafka/dest/include/librdkafka/rdkafkacpp.h
~/build/edenhill/librdkafka/mergescratch ~/build/edenhill/librdkafka
~/build/edenhill/librdkafka
  1. Tested with mock up token provider.
[0126_oauthbearer_oidc       /  7.192s] 0126_oauthbearer_oidc: duration 7191.931ms
[0126_oauthbearer_oidc       /  7.192s] ================= Test 0126_oauthbearer_oidc PASSED =================
[<MAIN>                      /  8.018s] ALL-TESTS: duration 8018.276ms
TEST 20211115233334 (bare, scenario default) SUMMARY
#==================================================================#
| <MAIN>                                   |     PASSED |   8.019s |
| 0126_oauthbearer_oidc                    |     PASSED |   7.192s |
#==================================================================#
[<MAIN>                      /  8.021s] 0 thread(s) in use by librdkafka
[<MAIN>                      /  8.021s] 
============== ALL TESTS PASSED ==============
###
###  ./test-runner in bare mode PASSED! ###
###
  1. valgrind: TESTS=0126 ./run-test.sh valgrind --exit-on-first-error=no
    Saw two leaks, but I don't think they are related to my change.
    (1) related to rd_http_req_destroy(&hreq)
==116526==     in use at exit: 80 bytes in 1 blocks
==116526==   total heap usage: 6,618 allocs, 6,617 frees, 433,555 bytes allocated
==116526== 
==116526== 80 bytes in 1 blocks are definitely lost in loss record 1 of 1
==116526==    at 0x483B7F3: malloc (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so)
==116526==    by 0x4A051CC: rd_malloc (rd.h:131)
==116526==    by 0x4A05F26: rd_buf_new (rdbuf.c:380)
==116526==    by 0x4A622C9: rd_http_req_init (rdhttp.c:139)
==116526==    by 0x4A65468: ut_sasl_oauthbearer_oidc_should_succeed (rdkafka_sasl_oauthbearer_oidc.c:410)
==116526==    by 0x4A6598B: unittest_sasl_oauthbearer_oidc (rdkafka_sasl_oauthbearer_oidc.c:504)
==116526==    by 0x4A116FF: rd_unittest (rdunittest.c:497)
==116526==    by 0x48DEFCC: rd_kafka_unittest (rdkafka.c:4860)
==116526==    by 0x1A5A3B: main_0000_unittests (0000-unittests.c:68)
==116526==    by 0x2884B7: run_test0 (test.c:1103)
==116526==    by 0x288ADD: run_test_from_thread (test.c:1167)
==116526==    by 0x4B686D9: start_thread (pthread_create.c:474)
==116526== 
==116526== 

Saw the same error for rdhttp.c.

==110197== 80 bytes in 1 blocks are definitely lost in loss record 1 of 2
==110197==    at 0x483B7F3: malloc (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so)
==110197==    by 0x4A051CC: rd_malloc (rd.h:131)
==110197==    by 0x4A05F26: rd_buf_new (rdbuf.c:380)
==110197==    by 0x4A622EF: rd_http_req_init (rdhttp.c:139)
==110197==    by 0x4A62B9E: rd_http_get_json (rdhttp.c:388)
==110197==    by 0x4A63009: unittest_http (rdhttp.c:475)
==110197==    by 0x4A11725: rd_unittest (rdunittest.c:497)
==110197==    by 0x48DEFCC: rd_kafka_unittest (rdkafka.c:4860)
==110197==    by 0x1A5A3B: main_0000_unittests (0000-unittests.c:68)
==110197==    by 0x2884B7: run_test0 (test.c:1103)
==110197==    by 0x288ADD: run_test_from_thread (test.c:1167)
==110197==    by 0x4B686D9: start_thread (pthread_create.c:474)

(2) Related to test_create_topic()

HEAP SUMMARY:
==121240==     in use at exit: 5,032 bytes in 70 blocks
==121240==   total heap usage: 6,830 allocs, 6,760 frees, 1,155,127 bytes allocated
==121240== 
==121240== 8 bytes in 1 blocks are indirectly lost in loss record 1 of 13
==121240==    at 0x483DD99: calloc (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so)
==121240==    by 0x4999A2B: rd_calloc (rd.h:125)
==121240==    by 0x4999E88: rd_list_prealloc_elems (rdlist.c:108)
==121240==    by 0x4999D88: rd_list_init_copy (rdlist.c:69)
==121240==    by 0x49D3DB6: rd_kafka_NewTopic_copy (rdkafka_admin.c:1479)
==121240==    by 0x49D68D1: rd_kafka_CreateTopics (rdkafka_admin.c:1739)
==121240==    by 0x299822: test_admin_create_topic (test.c:4585)
==121240==    by 0x299C99: test_create_topic (test.c:4653)
==121240==    by 0x1B0B60: do_test_produce_consumer_with_OIDC (0126-oauthbearer_oidc.c:66)
==121240==    by 0x1B1876: main_0126_oauthbearer_oidc (0126-oauthbearer_oidc.c:206)
==121240==    by 0x2884C3: run_test0 (test.c:1103)
==121240==    by 0x288AE9: run_test_from_thread (test.c:1167)
==121240== 
==121240== 
==121240== Exit program on first error (--exit-on-first-error=yes)

Saw the same error for 0090-idempotence.c

HEAP SUMMARY:
==120515==     in use at exit: 340 bytes in 8 blocks
==120515==   total heap usage: 6,359 allocs, 6,351 frees, 2,160,748 bytes allocated
==120515== 
==120515== 8 bytes in 1 blocks are indirectly lost in loss record 1 of 7
==120515==    at 0x483DD99: calloc (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so)
==120515==    by 0x4999A2B: rd_calloc (rd.h:125)
==120515==    by 0x4999E88: rd_list_prealloc_elems (rdlist.c:108)
==120515==    by 0x4999D88: rd_list_init_copy (rdlist.c:69)
==120515==    by 0x49D3DB6: rd_kafka_NewTopic_copy (rdkafka_admin.c:1479)
==120515==    by 0x49D68D1: rd_kafka_CreateTopics (rdkafka_admin.c:1739)
==120515==    by 0x299822: test_admin_create_topic (test.c:4585)
==120515==    by 0x299C99: test_create_topic (test.c:4653)
==120515==    by 0x176AB0: do_test_implicit_ack (0090-idempotence.c:133)
==120515==    by 0x177078: main_0090_idempotence (0090-idempotence.c:165)
==120515==    by 0x2884C3: run_test0 (test.c:1103)
==120515==    by 0x288AE9: run_test_from_thread (test.c:1167)
==120515== 
==120515== 

Since the above errors are not related to this PR, I will dig more and send a new PR to fix.

  1. Tested with manually set the token urls:
VALID_OIDC_URL=http://localhost:8080/retrieve INVALID_OIDC_URL=http://localhost:8080/retrieve/badformat EXPIRED_TOKEN_OIDC_URL=http://localhost:8080/retrieve/expire TESTS=0126 make

[0126_oauthbearer_oidc       / 29.667s] ================= Test 0126_oauthbearer_oidc PASSED =================
[<MAIN>                      / 30.100s] ALL-TESTS: duration 30099.377ms
TEST 20211121131641 (bare, scenario default) SUMMARY
#==================================================================#
| <MAIN>                                   |     PASSED |  30.100s |
| 0126_oauthbearer_oidc                    |     PASSED |  29.667s |
#==================================================================#
[<MAIN>                      / 30.101s] 0 thread(s) in use by librdkafka
[<MAIN>                      / 30.101s] 
============== ALL TESTS PASSED ==============
###
###  ./test-runner in bare mode PASSED! ###
###

@jliunyu jliunyu force-pushed the kip768-token branch 3 times, most recently from 7a5f996 to 04dc84c Compare September 27, 2021 10:47
@jliunyu jliunyu marked this pull request as ready for review September 27, 2021 11:17
src/rdhttp.c Outdated Show resolved Hide resolved
src/rdhttp.c Outdated Show resolved Hide resolved
src/rdhttp.c Outdated Show resolved Hide resolved
src/rdhttp.c Outdated Show resolved Hide resolved
src/rdhttp.c Outdated Show resolved Hide resolved
src/rdkafka_sasl_oauthbearer_oidc.c Outdated Show resolved Hide resolved
src/rdkafka_sasl_oauthbearer_oidc.c Outdated Show resolved Hide resolved
src/rdkafka_sasl_oauthbearer_oidc.c Outdated Show resolved Hide resolved
src/rdkafka_sasl_oauthbearer_oidc.c Show resolved Hide resolved
src/rdunittest.c Show resolved Hide resolved
@jliunyu jliunyu marked this pull request as draft October 6, 2021 23:58
@jliunyu jliunyu force-pushed the kip768-token branch 2 times, most recently from 0c73921 to f044778 Compare October 7, 2021 01:15
@jliunyu jliunyu marked this pull request as ready for review October 7, 2021 04:49
@jliunyu jliunyu marked this pull request as draft October 7, 2021 07:15
@jliunyu jliunyu marked this pull request as ready for review October 7, 2021 07:46
src/rdkafka.h Outdated Show resolved Hide resolved
Copy link
Contributor

@edenhill edenhill left a comment

Choose a reason for hiding this comment

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

Almost there!

I think we should add the last part to this PR as well; setting the token, it is just a single set_token() call on success and a set_token_failure() call on failure.

Please also include the FIXME-fix in oauthbearer_init() to redirect these callbacsk to the background queue and update the 0126 test to verify it works: I think the simplest approach is specifying a local miss URL (e.g., "http://localhost:1/bad") and then wait for a ERR__AUTHORIZATION failure in an error_cb.

src/rdhttp.c Outdated Show resolved Hide resolved
src/rdhttp.c Outdated Show resolved Hide resolved
src/rdhttp.c Outdated Show resolved Hide resolved
src/rdhttp.c Outdated Show resolved Hide resolved
src/rdhttp.c Show resolved Hide resolved
src/rdkafka_sasl_oauthbearer_oidc.c Outdated Show resolved Hide resolved
src/rdkafka_sasl_oauthbearer_oidc.c Outdated Show resolved Hide resolved
src/rdkafka_sasl_oauthbearer_oidc.c Outdated Show resolved Hide resolved
src/rdkafka_sasl_oauthbearer_oidc.c Outdated Show resolved Hide resolved
src/rdkafka_sasl_oauthbearer_oidc.c Outdated Show resolved Hide resolved
@edenhill edenhill changed the base branch from kip768 to master October 28, 2021 11:17
@jliunyu jliunyu marked this pull request as draft October 28, 2021 20:24
@jliunyu jliunyu force-pushed the kip768-token branch 2 times, most recently from aa97268 to 37cd3d8 Compare October 29, 2021 01:17
@jliunyu jliunyu marked this pull request as ready for review October 29, 2021 03:27
INTRODUCTION.md Outdated Show resolved Hide resolved
INTRODUCTION.md Outdated Show resolved Hide resolved
INTRODUCTION.md Outdated Show resolved Hide resolved
INTRODUCTION.md Outdated Show resolved Hide resolved
INTRODUCTION.md Outdated Show resolved Hide resolved
tests/0126-oauthbearer_oidc.c Outdated Show resolved Hide resolved

test_consumer_close(c1);
rd_kafka_destroy(c1);
SUB_TEST_PASS();
}


int main_0126_oauthbearer_oidc(int argc, char **argv) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Since these tests supposedly requires a cluster configured with SASL OAUTHBEARER OIDC I think you need to:

  • skip all tests here if OIDC is not configured
  • rely on the test conf (from test_conf_init()) to have correct OIDC configurations, since htat is set up by trivup, et.al.

Copy link
Contributor

Choose a reason for hiding this comment

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

You will need to make sure the cluster is configured for oidc by checking that sasl.oauthbearer.method is set to oidc.

tests/0126-oauthbearer_oidc.c Outdated Show resolved Hide resolved
tests/0126-oauthbearer_oidc.c Outdated Show resolved Hide resolved
tests/0126-oauthbearer_oidc.c Outdated Show resolved Hide resolved
@jliunyu jliunyu marked this pull request as draft November 16, 2021 07:43
@jliunyu jliunyu marked this pull request as ready for review November 16, 2021 08:42
src/rdhttp.c Outdated Show resolved Hide resolved
src/rdhttp.c Outdated Show resolved Hide resolved
src/rdhttp.h Outdated Show resolved Hide resolved
tests/0126-oauthbearer_oidc.c Outdated Show resolved Hide resolved

test_consumer_close(c1);
rd_kafka_destroy(c1);
SUB_TEST_PASS();
}


int main_0126_oauthbearer_oidc(int argc, char **argv) {
Copy link
Contributor

Choose a reason for hiding this comment

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

You will need to make sure the cluster is configured for oidc by checking that sasl.oauthbearer.method is set to oidc.

src/rdkafka_sasl_oauthbearer_oidc.c Show resolved Hide resolved
src/rdkafka_sasl_oauthbearer_oidc.c Show resolved Hide resolved
src/rdkafka_sasl_oauthbearer_oidc.c Outdated Show resolved Hide resolved
src/rdkafka_sasl_oauthbearer_oidc.c Show resolved Hide resolved
src/rdkafka_sasl_oauthbearer_oidc.c Outdated Show resolved Hide resolved
@jliunyu jliunyu marked this pull request as draft November 19, 2021 08:44
@jliunyu jliunyu marked this pull request as ready for review November 21, 2021 19:53
if (len > 0)
break; /* Success */
/* Empty response */
rd_http_req_destroy(&hreq);
Copy link
Contributor

Choose a reason for hiding this comment

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

I think you will need to set jsonp to NULL here, otherwise the caller will think this was a successful call but jsonp will be undefined.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hi @edenhill, hanks for the review comments. The jsonp is initialized as NULL from the caller already: https://github.com/jliunyu/librdkafka/blob/kip768-token/src/rdkafka_sasl_oauthbearer_oidc.c#L223.
From the current function, we didn't use it yet before this line. So I think we don't need to set jsonp to NULL here?

src/rdkafka_sasl_oauthbearer_oidc.c Show resolved Hide resolved
src/rdkafka_sasl_oauthbearer_oidc.c Outdated Show resolved Hide resolved
src/rdkafka_sasl_oauthbearer_oidc.c Outdated Show resolved Hide resolved
src/rdkafka_sasl_oauthbearer_oidc.c Outdated Show resolved Hide resolved
tests/0126-oauthbearer_oidc.c Outdated Show resolved Hide resolved
tests/0126-oauthbearer_oidc.c Outdated Show resolved Hide resolved
tests/0126-oauthbearer_oidc.c Show resolved Hide resolved
tests/0126-oauthbearer_oidc.c Outdated Show resolved Hide resolved
tests/interactive_broker_version.py Outdated Show resolved Hide resolved
@jliunyu jliunyu marked this pull request as draft November 22, 2021 22:06
@jliunyu jliunyu marked this pull request as ready for review November 22, 2021 22:30
Copy link
Contributor

@edenhill edenhill left a comment

Choose a reason for hiding this comment

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

LGTM!
GREAT STUFF, JING!

@edenhill edenhill merged commit a82595b into confluentinc:master Nov 23, 2021
garrett528 pushed a commit to UrbanCompass/librdkafka that referenced this pull request Apr 8, 2022
garrett528 added a commit to UrbanCompass/librdkafka that referenced this pull request Apr 11, 2022
* Fix memory leak in admin requests

Fix a memory leak introduces in ca1b30e in which the arguments to an
admin request were not being freed. Discovered by the test suite for
rust-rdkafka [0].

[0]: https://github.com/fede1024/rust-rdkafka/pull/397/checks?check_run_id=3914902373

* Fix MinGW Travis build issues by breaking test execution into a separate script

* ACL Admin Apis: CreateAcls, DescribeAcls, DeleteAcls

* Minor ACL API adjustments and some small code tweaks

* Add ACL support to CHANGELOG

* Retrieve jwt token from token provider (@jliunyu, confluentinc#3560)

* Fixed typo

* MsgSets with just aborted msgs raised a MSG_SIZE error, and fix backoff (confluentinc#2993)

This also removes fetch backoffs on underflows (truncated responses).

* test 0129: style fix

* test 0105: Fix race condition

* Idempotent producer: save state for removed partitions

.. in case they come back. To avoid silent message loss.

* Remove incorrect comment on mock API

* Fix rkbuf_rkb assert on malformed JoinGroupResponse.metadata

* clusterid() would fail if there were no topics in metadata (confluentinc#3620)

* sasl.oauthbearer.extensions should be optional

Fixes confluentinc/confluent-kafka-python#1269.

* Added AK 3.1.0 to test versions

* Changelog updates

* Bump version to v1.9.0

* sasl.oauthbearer.scope should be optional

According to the section 4.4.2 of RFC 6749, the scope is optional
in the access token request in client credentials flow.

And indeed, for OIDC providers that I find in the wild such as
Amazon Cognito, the scope _is_ optional. If the scope is omitted
from the request, then the returned access token will contain any
and all scope(s) that are configured for the client.

See https://datatracker.ietf.org/doc/html/rfc6749#section-4.4.2

* Fix hang in list_groups() when cluster is unavailable (confluentinc#3705)

This was caused by holding on to an old broker state version that got outdated
and caused an infinite loop, rather than a timeout.

* Style fixes

* Integration test for OIDC (confluentinc#3646)

* Test for trivup

* integration test

* Update code style for existing code at rdkafka_sasl_oauthbearer_oidc.c

* Handle review comment

* tiny fix

* Handle review comments

* misc.c style fix

* Test fixes: OIDC requires AK 3.1, not 3.0

* Test 0113: reset security.protocol when using mock cluster

* Travis: use Py 3.8 (not 3.5) on Xenial builder

* Travis: bump integration test from AK 2.7.0 to 2.8.1

* Fix README release wording

* Improve subscribe() error documentation

* Fix linger.ms/message.timeout.ms config checking (confluentinc#3709)

* Replace deprecated zookeeper flag with bootstrap (@ladislavmacoun, confluentinc#3700)

* Replace deprecated zookeeper flag with bootstrap

Fixes: confluentinc#3699

Signed-off-by: Ladislav Macoun <[email protected]>

* Add backwards compatibility

Signed-off-by: Ladislav Macoun <[email protected]>

* Add assertion for cmd fitting inside buffer

Signed-off-by: Ladislav Macoun <[email protected]>

* Increase command buffer

Signed-off-by: Ladislav Macoun <[email protected]>

* Save one superfluous message timeout toppar scan

* Update to fedora:35 to fix the CentOS 8 build

mock epel-8-x86_64 is now broken in fedora:33:
https://bugzilla.redhat.com/show_bug.cgi?id=2049024

Update to fedora:35 with mock configs:
centos+epel-7-x86_64
centos-stream+epel-8-x86_64

* Add link to tutorial on Confluent Developer

Also fix indenting of bullet list

* Grooming (compilation warnings, potential issues)

Signed-off-by: Sergio Arroutbi <[email protected]>

* fix: acl binding enum checks (@emasab, confluentinc#3741)

* checking enums values when creating or reading AclBinding and AclBindingFilter

* AclBinding destroy array function

* acl binding unit tests

* warnings and fix for unknown enums, test fixes

* int sizes matching the read size

* pointer to the correct broker

* cmake: Use CMAKE_INSTALL_LIBDIR

this ensures that it is portable across platforms e.g. ppc64/linux
uses lib64 not lib

Signed-off-by: Khem Raj <[email protected]>

* Trigger op callbacks regardless for unhandled types in consume_batch_queue() et.al. (confluentinc#3263)

* AppVeyor: Use Visual Studio 2019 image to build since 2015 has TLS problems

The 2015 image fails to donwload openssl due to TLS 1.2 not being available,
or something along those lines.

* mklove: add LD_LIBRARY_PATH to libcurl builder so that runtime checks pass

* Travis: build alpine & manylinux builds with --source-deps-only

This avoids relying on distro installed packages, which isn't very robust.

* Nuget Debian build: use --source-deps-only to avoid external dependencies

* RPM test: Use ubi8 image instead of centos:8

.. since centos is no more

* Curl 7.82.0

* mklove: curl now requires CoreFoundation and SystemConfiguration frameworks on osx

* Test 0128: skip if there's no oauthbearer support

* Test 0128: make thread-safe

* Test 0077: reduce flakyness by expediting compaction

* Update to zlib 1.2.12 and OpenSSL 1.1.1n

* vcpkg: revoke to zlib 1.2.11 since 1.2.12 is not yet available (as vcpkg)

* Travis: Disable mingw dynamic build for now (gcc breakage)

GCC 11 adds a new symbol that is not available in the mingw/msys2 libstdc++,
which makes it impossible to run applications that were built.

Until that's fixed we disable this worker since it will fail anyway.

* mklove: fix formatting of skipped pkg-config checks

* Fix lock order for rk_init_lock to avoid deadlock (non-released regression)

* vcpkg version bumps

* Update release instructions

* Make dynamic MinGW build copy DLLs instead of trying to manipulate PATH (@neptoess, confluentinc#3787)

* Make dynamic MinGW build copy DLLs instead of trying to manipulate PATH

* Remove tag requirement on MinGW dynamic build

Co-authored-by: Bill Rose <[email protected]>

* Fix regression from last PR: curl_ldflags

* Reset stored offset on assign() and prevent offsets_store() for unassigned partitions

* Include broker_id in offset reset logs and corresponding consumer errors (confluentinc#3785)

* Txn: properly handle PRODUCER_FENCED in InitPid reply

* Provide reason to broker thread wakeups in debug logs

This will make troubleshooting easier

* rdkafka_performance: include broker in DR printouts

* Make SUBTESTS=.. match all of the subtest format string

* Added file io abstraction

* rdkafka_performance: cut down on the number of poll calls in full-rate mode

* Added test.mock.broker.rtt

* Log mock broker bootstrap.servers addresses when test.mock.num.brokers is set

* Mock brokers now allow compressed ProduceRequests

No decompression or validation is performed.

* Made rd_buf_read|peek_iXX() type safe

* SUB_TEST_SKIP() format verification

* Statistics: let broker.wakeups metric cover all broker wakeups, both IO and cnds

* Improved producer queue wakeups

* Broker thread: don't block on IO if there are ops available

* vcpkg: Update to zlib 1.2.12

* Fix some win32 compilation warnings

* Proper use of rd_socket_close() on Win32

Regression during v1.9.0 development

* Test 0101: missing return after Test::Skip()

* seek() doc clarification (confluentinc#3004)

* Documentation updates

* style-check* now fails on style warnings

* Automatic style fixes

* Some OIDC documentation fixes

* Fix for AWS_MSK_IAM

* Update for new method signature

Co-authored-by: Nikhil Benesch <[email protected]>
Co-authored-by: Bill Rose <[email protected]>
Co-authored-by: Emanuele Sabellico <[email protected]>
Co-authored-by: Magnus Edenhill <[email protected]>
Co-authored-by: Jing Liu <[email protected]>
Co-authored-by: Matt Clarke <[email protected]>
Co-authored-by: Leo Singer <[email protected]>
Co-authored-by: Ladislav <[email protected]>
Co-authored-by: Ladislav Snizek <[email protected]>
Co-authored-by: Lance Shelton <[email protected]>
Co-authored-by: Robin Moffatt <[email protected]>
Co-authored-by: Sergio Arroutbi <[email protected]>
Co-authored-by: Khem Raj <[email protected]>
Co-authored-by: Bill Rose <[email protected]>
jacobpath pushed a commit to pathccm/librdkafka that referenced this pull request Jun 6, 2023
parent d2bc749
author garrett528 <[email protected]> 1625669334 -0400
committer Jacob Lee <[email protected]> 1686019633 -0700
gpgsig -----BEGIN SSH SIGNATURE-----
 U1NIU0lHAAAAAQAAAH8AAAAic2stZWNkc2Etc2hhMi1uaXN0cDI1NkBvcGVuc3NoLmNvbQ
 AAAAhuaXN0cDI1NgAAAEEE/KxKuQeycJHYJkNEqsJPsQqQxVl1ftFETXL0PMawe+tBCMrH
 AiNd2GpQHEKTqzopO72+yiqWDjpM10WrTyzXBAAAAARzc2g6AAAAA2dpdAAAAAAAAAAGc2
 hhNTEyAAAAeAAAACJzay1lY2RzYS1zaGEyLW5pc3RwMjU2QG9wZW5zc2guY29tAAAASQAA
 ACBhH8xrzkQR+w6xy86JjJ6tC6udVA0Xn4VgdX3YEEZ25QAAACEA//YouC+q94g0jxjA8D
 tL+R+SGXR8782VjNc2vO5hS6YBAAAfoQ==
 -----END SSH SIGNATURE-----

sasl: Enable AWS_MSK_IAM SASL mechanism (confluentinc#3402)

AWS_MSK_IAM is a new SASL mechanism for
authenticating clients to AWS MSK Kafka
clusters and use IAM-based controls to
set Kafka ACLs and permissions. This change
provides support to allow clients to pass
AWS credentials at runtime which is used
to build the SASL payload and authenticate
clients to IAM enabled MSK clusters. It adds
a new SASL mechanism, AWS_MSK_IAM, as well
as configuration options to set the following:
* AWS access key id
* AWS secret access key
* AWS region
* AWS security token
The SASL handshake requires a specific payload
that is described here:
https://github.com/aws/aws-msk-iam-auth

Add curl to doozer build

Address comments (UrbanCompass#5)

Reduce Travis-CI runtime

 * Reduce number of jobs when not building a tag
 * Run unit tests if no tag, and local quick suite (old default) when tagged.
 * Combine some jobs.

Travis ARM64: build static lib

Travis: Disable C99 for all builds but the integration test build

.. since it hampers the use of assembler (asm()) on arm64.

Keep session alive when receiving heartbeat responses during rebalancing

add changelog message

Update Changelog

Add cleanup-s3.py script

Move Admin request arguments to result op to make them available on merge (confluentinc#3476)

Fix test 0055 now when flush() does not wait for linger.ms

Adds support for buildling on illumos

mklove: Use curl for module downloads

.. instead of wget, since we rely on curl elsewhere.

Verify checksum of source dependencies and bump to OpenSSL 1.1.1l, zstd 1.5.0

Travis: login with docker account to avoid rate-limiting

Docker dotnet images have changed names, updated.

rxidle and txidle were stats emitted as unsigned 64, now signed (confluentinc#3519)

Fix a small error due to the unreleased lock before program exit

Fix a small error due to the unreleased lock skm->lock before program exit.

mklove: make zlib test program compilable

The test program that is used at compile-time to detect whether zlib is
available fails to compile due to `NULL` being undefined:

```
_mkltmpyos55w.c:5:20: error: use of undeclared identifier 'NULL'
     z_stream *p = NULL;
                   ^
1 error generated.
```

This means that zlib availability is only automatically detected when
using pkg-config.

Import `stddef.h` (which defines `NULL`) in the test program, allowing
zlib to be automatically detected via a compilation check.

sasl: Enable STS credential refresh (UrbanCompass#7)

Define IOV_MAX as 1024 if not defined

Removed check int and added debug

Fixes error handling for error responses from STS (UrbanCompass#10)

mklove: make zlib test program compilable

The test program that is used at compile-time to detect whether zlib is
available fails to compile due to `NULL` being undefined:

```
_mkltmpyos55w.c:5:20: error: use of undeclared identifier 'NULL'
     z_stream *p = NULL;
                   ^
1 error generated.
```

This means that zlib availability is only automatically detected when
using pkg-config.

Import `stddef.h` (which defines `NULL`) in the test program, allowing
zlib to be automatically detected via a compilation check.

Travis: New secure env vars

AppVeyor: rotate access keys

Travis: show sha256sums of artifacts prior to deploy

Add MSVC 140 runtimes (for packaging)

Add 'ssl.ca.pem' property (confluentinc#2380)

Improve nuget release script

 - Verify artifact file contents and architectures.
 - Verify that artifact attributes match.
 - Get README, CONFIG,.. etc, from artifacts instead of local source tree
   (which may not match the released version).

Bump to version 1.8.2

(Skipping 1.8.1 due to dotnet release with that number)

mklove: fix static bundle .a generation on osx

mklove: portable checksum checking for downloads

mklove: allow --source-deps-only OpenSSL builds on OSX

Don't build ancient OSX Sierra artifacts

Travis: reduce build minutes (tagged jobs)

Travis: use --source-deps-only for dependencies instead of using homebrew

Homebrew is fantastically slow to update to Travis-CI, and it is burning
build credits like crazy.

mklove: added mklove_patch

mklove: show more of failed build logs

mklove openssl installer: workaround build issue in 1.1.1l on osx.

Apply OpenSSL PR 16409 patch to fix 1.1.1l build issues on OSX

Travis: Remove -Werror from OSX worker since OpenSSL builds have quite a few warnings

mklove: try both wget and curl for archive downloads

Don't overwrite ssl.ca.location on OSX (confluentinc#3566)

Travis: bump Linux base builder from trusty to xenial to circumvent ISRG cert expiry

.. which causes older versions of OpenSSL+curl to fail to download OpenSSL..

AddOffsetsToTxn Refresh errors did not trigger coord refresh (confluentinc#3571)

Ensure timers are started even if timeout is 0

Transactional producer: Fix possible message loss on OUT_OF_ORDER_SEQ error (confluentinc#3575)

Mock push_request_errors() appended the errors in reverse order

Update list of supported KIPs

Add rd_buf_new()

Import cJSON v1.7.14

URL: https://github.com/DaveGamble/cJSON
Tag: v1.7.14
SHA: d2735278ed1c2e4556f53a7a782063b31331dbf7

Added HTTP(S) client using cURL

Add HTTP(S) client using cURL

Fix uninitialized warning on msvc

Remove commented-out printfs

Remove stray license include in librdkafka vcxproj

librdkafka.vcxproj: remove stale OpenSSL paths and enable Vcpkg manifests

mklove: but all built deps in the same destdir and set up compiler flags accordingly

This fixes some issues when dependency B depends on dependency A, in this
case for libcurl that depends on OpenSSL, to make it find the OpenSSL
libraries, pkg-config files, etc.

mklove: don't include STATIC_LIB_..s in BUILT_WITH

mklove: Some autoconf versions seem to need a full path to $INSTALL

curl: disable everything but HTTP(S)

Added string splitter and kv splitter

OAuth/OIDC: Add fields to client configuration (confluentinc#3510)

Implement native Win32 IO/Queue scheduler (WSAWaitForMultipleEvents)

This removes the internal loopback connections (one per known broker)
that were previously used to trigger io-based queue wakeups.

Add vcpkg_installed to gitignore

Left-trim spaces from string configuration values

This makes it easier to use Bash on Windows where a prefixing / is translated
into the MinGW32 file system root.

Mark rd_kafka_conf_kv_split as unused .. until it's used.

rd_kafka_queue_get_background() now creates the background thread

Added custom SASL callback queue

Fix test flags for 0122 and 0126

Test 0119: remove unused code

Direct questions to the github discussions forum to keep issue load down

Add clang-format style checking and fixing

Add Python style checking and fixing

Run style-checker with Github Actions

Automatic style fixes using 'make style-fix'

Manual style fixes of Python code

Avoid use of FILE* BIOs to circumvent OpenSSL_Applink requirement on Windows (confluentinc#3554)

Added README for fork (UrbanCompass#15)

merge upstream 2022 04 08 (UrbanCompass#17)

* Fix memory leak in admin requests

Fix a memory leak introduces in ca1b30e in which the arguments to an
admin request were not being freed. Discovered by the test suite for
rust-rdkafka [0].

[0]: https://github.com/fede1024/rust-rdkafka/pull/397/checks?check_run_id=3914902373

* Fix MinGW Travis build issues by breaking test execution into a separate script

* ACL Admin Apis: CreateAcls, DescribeAcls, DeleteAcls

* Minor ACL API adjustments and some small code tweaks

* Add ACL support to CHANGELOG

* Retrieve jwt token from token provider (@jliunyu, confluentinc#3560)

* Fixed typo

* MsgSets with just aborted msgs raised a MSG_SIZE error, and fix backoff (confluentinc#2993)

This also removes fetch backoffs on underflows (truncated responses).

* test 0129: style fix

* test 0105: Fix race condition

* Idempotent producer: save state for removed partitions

.. in case they come back. To avoid silent message loss.

* Remove incorrect comment on mock API

* Fix rkbuf_rkb assert on malformed JoinGroupResponse.metadata

* clusterid() would fail if there were no topics in metadata (confluentinc#3620)

* sasl.oauthbearer.extensions should be optional

Fixes confluentinc/confluent-kafka-python#1269.

* Added AK 3.1.0 to test versions

* Changelog updates

* Bump version to v1.9.0

* sasl.oauthbearer.scope should be optional

According to the section 4.4.2 of RFC 6749, the scope is optional
in the access token request in client credentials flow.

And indeed, for OIDC providers that I find in the wild such as
Amazon Cognito, the scope _is_ optional. If the scope is omitted
from the request, then the returned access token will contain any
and all scope(s) that are configured for the client.

See https://datatracker.ietf.org/doc/html/rfc6749#section-4.4.2

* Fix hang in list_groups() when cluster is unavailable (confluentinc#3705)

This was caused by holding on to an old broker state version that got outdated
and caused an infinite loop, rather than a timeout.

* Style fixes

* Integration test for OIDC (confluentinc#3646)

* Test for trivup

* integration test

* Update code style for existing code at rdkafka_sasl_oauthbearer_oidc.c

* Handle review comment

* tiny fix

* Handle review comments

* misc.c style fix

* Test fixes: OIDC requires AK 3.1, not 3.0

* Test 0113: reset security.protocol when using mock cluster

* Travis: use Py 3.8 (not 3.5) on Xenial builder

* Travis: bump integration test from AK 2.7.0 to 2.8.1

* Fix README release wording

* Improve subscribe() error documentation

* Fix linger.ms/message.timeout.ms config checking (confluentinc#3709)

* Replace deprecated zookeeper flag with bootstrap (@ladislavmacoun, confluentinc#3700)

* Replace deprecated zookeeper flag with bootstrap

Fixes: confluentinc#3699

Signed-off-by: Ladislav Macoun <[email protected]>

* Add backwards compatibility

Signed-off-by: Ladislav Macoun <[email protected]>

* Add assertion for cmd fitting inside buffer

Signed-off-by: Ladislav Macoun <[email protected]>

* Increase command buffer

Signed-off-by: Ladislav Macoun <[email protected]>

* Save one superfluous message timeout toppar scan

* Update to fedora:35 to fix the CentOS 8 build

mock epel-8-x86_64 is now broken in fedora:33:
https://bugzilla.redhat.com/show_bug.cgi?id=2049024

Update to fedora:35 with mock configs:
centos+epel-7-x86_64
centos-stream+epel-8-x86_64

* Add link to tutorial on Confluent Developer

Also fix indenting of bullet list

* Grooming (compilation warnings, potential issues)

Signed-off-by: Sergio Arroutbi <[email protected]>

* fix: acl binding enum checks (@emasab, confluentinc#3741)

* checking enums values when creating or reading AclBinding and AclBindingFilter

* AclBinding destroy array function

* acl binding unit tests

* warnings and fix for unknown enums, test fixes

* int sizes matching the read size

* pointer to the correct broker

* cmake: Use CMAKE_INSTALL_LIBDIR

this ensures that it is portable across platforms e.g. ppc64/linux
uses lib64 not lib

Signed-off-by: Khem Raj <[email protected]>

* Trigger op callbacks regardless for unhandled types in consume_batch_queue() et.al. (confluentinc#3263)

* AppVeyor: Use Visual Studio 2019 image to build since 2015 has TLS problems

The 2015 image fails to donwload openssl due to TLS 1.2 not being available,
or something along those lines.

* mklove: add LD_LIBRARY_PATH to libcurl builder so that runtime checks pass

* Travis: build alpine & manylinux builds with --source-deps-only

This avoids relying on distro installed packages, which isn't very robust.

* Nuget Debian build: use --source-deps-only to avoid external dependencies

* RPM test: Use ubi8 image instead of centos:8

.. since centos is no more

* Curl 7.82.0

* mklove: curl now requires CoreFoundation and SystemConfiguration frameworks on osx

* Test 0128: skip if there's no oauthbearer support

* Test 0128: make thread-safe

* Test 0077: reduce flakyness by expediting compaction

* Update to zlib 1.2.12 and OpenSSL 1.1.1n

* vcpkg: revoke to zlib 1.2.11 since 1.2.12 is not yet available (as vcpkg)

* Travis: Disable mingw dynamic build for now (gcc breakage)

GCC 11 adds a new symbol that is not available in the mingw/msys2 libstdc++,
which makes it impossible to run applications that were built.

Until that's fixed we disable this worker since it will fail anyway.

* mklove: fix formatting of skipped pkg-config checks

* Fix lock order for rk_init_lock to avoid deadlock (non-released regression)

* vcpkg version bumps

* Update release instructions

* Make dynamic MinGW build copy DLLs instead of trying to manipulate PATH (@neptoess, confluentinc#3787)

* Make dynamic MinGW build copy DLLs instead of trying to manipulate PATH

* Remove tag requirement on MinGW dynamic build

Co-authored-by: Bill Rose <[email protected]>

* Fix regression from last PR: curl_ldflags

* Reset stored offset on assign() and prevent offsets_store() for unassigned partitions

* Include broker_id in offset reset logs and corresponding consumer errors (confluentinc#3785)

* Txn: properly handle PRODUCER_FENCED in InitPid reply

* Provide reason to broker thread wakeups in debug logs

This will make troubleshooting easier

* rdkafka_performance: include broker in DR printouts

* Make SUBTESTS=.. match all of the subtest format string

* Added file io abstraction

* rdkafka_performance: cut down on the number of poll calls in full-rate mode

* Added test.mock.broker.rtt

* Log mock broker bootstrap.servers addresses when test.mock.num.brokers is set

* Mock brokers now allow compressed ProduceRequests

No decompression or validation is performed.

* Made rd_buf_read|peek_iXX() type safe

* SUB_TEST_SKIP() format verification

* Statistics: let broker.wakeups metric cover all broker wakeups, both IO and cnds

* Improved producer queue wakeups

* Broker thread: don't block on IO if there are ops available

* vcpkg: Update to zlib 1.2.12

* Fix some win32 compilation warnings

* Proper use of rd_socket_close() on Win32

Regression during v1.9.0 development

* Test 0101: missing return after Test::Skip()

* seek() doc clarification (confluentinc#3004)

* Documentation updates

* style-check* now fails on style warnings

* Automatic style fixes

* Some OIDC documentation fixes

* Fix for AWS_MSK_IAM

* Update for new method signature

Co-authored-by: Nikhil Benesch <[email protected]>
Co-authored-by: Bill Rose <[email protected]>
Co-authored-by: Emanuele Sabellico <[email protected]>
Co-authored-by: Magnus Edenhill <[email protected]>
Co-authored-by: Jing Liu <[email protected]>
Co-authored-by: Matt Clarke <[email protected]>
Co-authored-by: Leo Singer <[email protected]>
Co-authored-by: Ladislav <[email protected]>
Co-authored-by: Ladislav Snizek <[email protected]>
Co-authored-by: Lance Shelton <[email protected]>
Co-authored-by: Robin Moffatt <[email protected]>
Co-authored-by: Sergio Arroutbi <[email protected]>
Co-authored-by: Khem Raj <[email protected]>
Co-authored-by: Bill Rose <[email protected]>

merge upstream 2022 08 01 (UrbanCompass#19)

Co-authored-by: Bill Rose <[email protected]>
Co-authored-by: Magnus Edenhill <[email protected]>
Co-authored-by: Nikhil Benesch <[email protected]>
Co-authored-by: Emanuele Sabellico <[email protected]>
Co-authored-by: Jing Liu <[email protected]>
Co-authored-by: Matt Clarke <[email protected]>
Co-authored-by: Leo Singer <[email protected]>
Co-authored-by: Ladislav <[email protected]>
Co-authored-by: Ladislav Snizek <[email protected]>
Co-authored-by: Lance Shelton <[email protected]>
Co-authored-by: Robin Moffatt <[email protected]>
Co-authored-by: Sergio Arroutbi <[email protected]>
Co-authored-by: Khem Raj <[email protected]>
Co-authored-by: Bill Rose <[email protected]>
Co-authored-by: Dmytro Milinevskyi <[email protected]>
Co-authored-by: Mikhail Avdienko <[email protected]>
Co-authored-by: wding <[email protected]>
Co-authored-by: Shawn <[email protected]>
Co-authored-by: ihsinme <[email protected]>
Co-authored-by: Emanuele Sabellico <[email protected]>
Co-authored-by: Roman Schmitz <[email protected]>
Co-authored-by: Miklos Espak <[email protected]>
Co-authored-by: Alice Rum <[email protected]>
Co-authored-by: Eli Smaga <[email protected]>
jacobpath pushed a commit to pathccm/librdkafka that referenced this pull request Jun 6, 2023
parent d2bc749
author garrett528 <[email protected]> 1625669334 -0400
committer Jacob Lee <[email protected]> 1686019633 -0700
gpgsig -----BEGIN SSH SIGNATURE-----
 U1NIU0lHAAAAAQAAAH8AAAAic2stZWNkc2Etc2hhMi1uaXN0cDI1NkBvcGVuc3NoLmNvbQ
 AAAAhuaXN0cDI1NgAAAEEE/KxKuQeycJHYJkNEqsJPsQqQxVl1ftFETXL0PMawe+tBCMrH
 AiNd2GpQHEKTqzopO72+yiqWDjpM10WrTyzXBAAAAARzc2g6AAAAA2dpdAAAAAAAAAAGc2
 hhNTEyAAAAeAAAACJzay1lY2RzYS1zaGEyLW5pc3RwMjU2QG9wZW5zc2guY29tAAAASQAA
 ACBhH8xrzkQR+w6xy86JjJ6tC6udVA0Xn4VgdX3YEEZ25QAAACEA//YouC+q94g0jxjA8D
 tL+R+SGXR8782VjNc2vO5hS6YBAAAfoQ==
 -----END SSH SIGNATURE-----

sasl: Enable AWS_MSK_IAM SASL mechanism (confluentinc#3402)

AWS_MSK_IAM is a new SASL mechanism for
authenticating clients to AWS MSK Kafka
clusters and use IAM-based controls to
set Kafka ACLs and permissions. This change
provides support to allow clients to pass
AWS credentials at runtime which is used
to build the SASL payload and authenticate
clients to IAM enabled MSK clusters. It adds
a new SASL mechanism, AWS_MSK_IAM, as well
as configuration options to set the following:
* AWS access key id
* AWS secret access key
* AWS region
* AWS security token
The SASL handshake requires a specific payload
that is described here:
https://github.com/aws/aws-msk-iam-auth

Add curl to doozer build

Address comments (UrbanCompass#5)

Reduce Travis-CI runtime

 * Reduce number of jobs when not building a tag
 * Run unit tests if no tag, and local quick suite (old default) when tagged.
 * Combine some jobs.

Travis ARM64: build static lib

Travis: Disable C99 for all builds but the integration test build

.. since it hampers the use of assembler (asm()) on arm64.

Keep session alive when receiving heartbeat responses during rebalancing

add changelog message

Update Changelog

Add cleanup-s3.py script

Move Admin request arguments to result op to make them available on merge (confluentinc#3476)

Fix test 0055 now when flush() does not wait for linger.ms

Adds support for buildling on illumos

mklove: Use curl for module downloads

.. instead of wget, since we rely on curl elsewhere.

Verify checksum of source dependencies and bump to OpenSSL 1.1.1l, zstd 1.5.0

Travis: login with docker account to avoid rate-limiting

Docker dotnet images have changed names, updated.

rxidle and txidle were stats emitted as unsigned 64, now signed (confluentinc#3519)

Fix a small error due to the unreleased lock before program exit

Fix a small error due to the unreleased lock skm->lock before program exit.

mklove: make zlib test program compilable

The test program that is used at compile-time to detect whether zlib is
available fails to compile due to `NULL` being undefined:

```
_mkltmpyos55w.c:5:20: error: use of undeclared identifier 'NULL'
     z_stream *p = NULL;
                   ^
1 error generated.
```

This means that zlib availability is only automatically detected when
using pkg-config.

Import `stddef.h` (which defines `NULL`) in the test program, allowing
zlib to be automatically detected via a compilation check.

sasl: Enable STS credential refresh (UrbanCompass#7)

Define IOV_MAX as 1024 if not defined

Removed check int and added debug

Fixes error handling for error responses from STS (UrbanCompass#10)

mklove: make zlib test program compilable

The test program that is used at compile-time to detect whether zlib is
available fails to compile due to `NULL` being undefined:

```
_mkltmpyos55w.c:5:20: error: use of undeclared identifier 'NULL'
     z_stream *p = NULL;
                   ^
1 error generated.
```

This means that zlib availability is only automatically detected when
using pkg-config.

Import `stddef.h` (which defines `NULL`) in the test program, allowing
zlib to be automatically detected via a compilation check.

Travis: New secure env vars

AppVeyor: rotate access keys

Travis: show sha256sums of artifacts prior to deploy

Add MSVC 140 runtimes (for packaging)

Add 'ssl.ca.pem' property (confluentinc#2380)

Improve nuget release script

 - Verify artifact file contents and architectures.
 - Verify that artifact attributes match.
 - Get README, CONFIG,.. etc, from artifacts instead of local source tree
   (which may not match the released version).

Bump to version 1.8.2

(Skipping 1.8.1 due to dotnet release with that number)

mklove: fix static bundle .a generation on osx

mklove: portable checksum checking for downloads

mklove: allow --source-deps-only OpenSSL builds on OSX

Don't build ancient OSX Sierra artifacts

Travis: reduce build minutes (tagged jobs)

Travis: use --source-deps-only for dependencies instead of using homebrew

Homebrew is fantastically slow to update to Travis-CI, and it is burning
build credits like crazy.

mklove: added mklove_patch

mklove: show more of failed build logs

mklove openssl installer: workaround build issue in 1.1.1l on osx.

Apply OpenSSL PR 16409 patch to fix 1.1.1l build issues on OSX

Travis: Remove -Werror from OSX worker since OpenSSL builds have quite a few warnings

mklove: try both wget and curl for archive downloads

Don't overwrite ssl.ca.location on OSX (confluentinc#3566)

Travis: bump Linux base builder from trusty to xenial to circumvent ISRG cert expiry

.. which causes older versions of OpenSSL+curl to fail to download OpenSSL..

AddOffsetsToTxn Refresh errors did not trigger coord refresh (confluentinc#3571)

Ensure timers are started even if timeout is 0

Transactional producer: Fix possible message loss on OUT_OF_ORDER_SEQ error (confluentinc#3575)

Mock push_request_errors() appended the errors in reverse order

Update list of supported KIPs

Add rd_buf_new()

Import cJSON v1.7.14

URL: https://github.com/DaveGamble/cJSON
Tag: v1.7.14
SHA: d2735278ed1c2e4556f53a7a782063b31331dbf7

Added HTTP(S) client using cURL

Add HTTP(S) client using cURL

Fix uninitialized warning on msvc

Remove commented-out printfs

Remove stray license include in librdkafka vcxproj

librdkafka.vcxproj: remove stale OpenSSL paths and enable Vcpkg manifests

mklove: but all built deps in the same destdir and set up compiler flags accordingly

This fixes some issues when dependency B depends on dependency A, in this
case for libcurl that depends on OpenSSL, to make it find the OpenSSL
libraries, pkg-config files, etc.

mklove: don't include STATIC_LIB_..s in BUILT_WITH

mklove: Some autoconf versions seem to need a full path to $INSTALL

curl: disable everything but HTTP(S)

Added string splitter and kv splitter

OAuth/OIDC: Add fields to client configuration (confluentinc#3510)

Implement native Win32 IO/Queue scheduler (WSAWaitForMultipleEvents)

This removes the internal loopback connections (one per known broker)
that were previously used to trigger io-based queue wakeups.

Add vcpkg_installed to gitignore

Left-trim spaces from string configuration values

This makes it easier to use Bash on Windows where a prefixing / is translated
into the MinGW32 file system root.

Mark rd_kafka_conf_kv_split as unused .. until it's used.

rd_kafka_queue_get_background() now creates the background thread

Added custom SASL callback queue

Fix test flags for 0122 and 0126

Test 0119: remove unused code

Direct questions to the github discussions forum to keep issue load down

Add clang-format style checking and fixing

Add Python style checking and fixing

Run style-checker with Github Actions

Automatic style fixes using 'make style-fix'

Manual style fixes of Python code

Avoid use of FILE* BIOs to circumvent OpenSSL_Applink requirement on Windows (confluentinc#3554)

Added README for fork (UrbanCompass#15)

merge upstream 2022 04 08 (UrbanCompass#17)

* Fix memory leak in admin requests

Fix a memory leak introduces in ca1b30e in which the arguments to an
admin request were not being freed. Discovered by the test suite for
rust-rdkafka [0].

[0]: https://github.com/fede1024/rust-rdkafka/pull/397/checks?check_run_id=3914902373

* Fix MinGW Travis build issues by breaking test execution into a separate script

* ACL Admin Apis: CreateAcls, DescribeAcls, DeleteAcls

* Minor ACL API adjustments and some small code tweaks

* Add ACL support to CHANGELOG

* Retrieve jwt token from token provider (@jliunyu, confluentinc#3560)

* Fixed typo

* MsgSets with just aborted msgs raised a MSG_SIZE error, and fix backoff (confluentinc#2993)

This also removes fetch backoffs on underflows (truncated responses).

* test 0129: style fix

* test 0105: Fix race condition

* Idempotent producer: save state for removed partitions

.. in case they come back. To avoid silent message loss.

* Remove incorrect comment on mock API

* Fix rkbuf_rkb assert on malformed JoinGroupResponse.metadata

* clusterid() would fail if there were no topics in metadata (confluentinc#3620)

* sasl.oauthbearer.extensions should be optional

Fixes confluentinc/confluent-kafka-python#1269.

* Added AK 3.1.0 to test versions

* Changelog updates

* Bump version to v1.9.0

* sasl.oauthbearer.scope should be optional

According to the section 4.4.2 of RFC 6749, the scope is optional
in the access token request in client credentials flow.

And indeed, for OIDC providers that I find in the wild such as
Amazon Cognito, the scope _is_ optional. If the scope is omitted
from the request, then the returned access token will contain any
and all scope(s) that are configured for the client.

See https://datatracker.ietf.org/doc/html/rfc6749#section-4.4.2

* Fix hang in list_groups() when cluster is unavailable (confluentinc#3705)

This was caused by holding on to an old broker state version that got outdated
and caused an infinite loop, rather than a timeout.

* Style fixes

* Integration test for OIDC (confluentinc#3646)

* Test for trivup

* integration test

* Update code style for existing code at rdkafka_sasl_oauthbearer_oidc.c

* Handle review comment

* tiny fix

* Handle review comments

* misc.c style fix

* Test fixes: OIDC requires AK 3.1, not 3.0

* Test 0113: reset security.protocol when using mock cluster

* Travis: use Py 3.8 (not 3.5) on Xenial builder

* Travis: bump integration test from AK 2.7.0 to 2.8.1

* Fix README release wording

* Improve subscribe() error documentation

* Fix linger.ms/message.timeout.ms config checking (confluentinc#3709)

* Replace deprecated zookeeper flag with bootstrap (@ladislavmacoun, confluentinc#3700)

* Replace deprecated zookeeper flag with bootstrap

Fixes: confluentinc#3699

Signed-off-by: Ladislav Macoun <[email protected]>

* Add backwards compatibility

Signed-off-by: Ladislav Macoun <[email protected]>

* Add assertion for cmd fitting inside buffer

Signed-off-by: Ladislav Macoun <[email protected]>

* Increase command buffer

Signed-off-by: Ladislav Macoun <[email protected]>

* Save one superfluous message timeout toppar scan

* Update to fedora:35 to fix the CentOS 8 build

mock epel-8-x86_64 is now broken in fedora:33:
https://bugzilla.redhat.com/show_bug.cgi?id=2049024

Update to fedora:35 with mock configs:
centos+epel-7-x86_64
centos-stream+epel-8-x86_64

* Add link to tutorial on Confluent Developer

Also fix indenting of bullet list

* Grooming (compilation warnings, potential issues)

Signed-off-by: Sergio Arroutbi <[email protected]>

* fix: acl binding enum checks (@emasab, confluentinc#3741)

* checking enums values when creating or reading AclBinding and AclBindingFilter

* AclBinding destroy array function

* acl binding unit tests

* warnings and fix for unknown enums, test fixes

* int sizes matching the read size

* pointer to the correct broker

* cmake: Use CMAKE_INSTALL_LIBDIR

this ensures that it is portable across platforms e.g. ppc64/linux
uses lib64 not lib

Signed-off-by: Khem Raj <[email protected]>

* Trigger op callbacks regardless for unhandled types in consume_batch_queue() et.al. (confluentinc#3263)

* AppVeyor: Use Visual Studio 2019 image to build since 2015 has TLS problems

The 2015 image fails to donwload openssl due to TLS 1.2 not being available,
or something along those lines.

* mklove: add LD_LIBRARY_PATH to libcurl builder so that runtime checks pass

* Travis: build alpine & manylinux builds with --source-deps-only

This avoids relying on distro installed packages, which isn't very robust.

* Nuget Debian build: use --source-deps-only to avoid external dependencies

* RPM test: Use ubi8 image instead of centos:8

.. since centos is no more

* Curl 7.82.0

* mklove: curl now requires CoreFoundation and SystemConfiguration frameworks on osx

* Test 0128: skip if there's no oauthbearer support

* Test 0128: make thread-safe

* Test 0077: reduce flakyness by expediting compaction

* Update to zlib 1.2.12 and OpenSSL 1.1.1n

* vcpkg: revoke to zlib 1.2.11 since 1.2.12 is not yet available (as vcpkg)

* Travis: Disable mingw dynamic build for now (gcc breakage)

GCC 11 adds a new symbol that is not available in the mingw/msys2 libstdc++,
which makes it impossible to run applications that were built.

Until that's fixed we disable this worker since it will fail anyway.

* mklove: fix formatting of skipped pkg-config checks

* Fix lock order for rk_init_lock to avoid deadlock (non-released regression)

* vcpkg version bumps

* Update release instructions

* Make dynamic MinGW build copy DLLs instead of trying to manipulate PATH (@neptoess, confluentinc#3787)

* Make dynamic MinGW build copy DLLs instead of trying to manipulate PATH

* Remove tag requirement on MinGW dynamic build

Co-authored-by: Bill Rose <[email protected]>

* Fix regression from last PR: curl_ldflags

* Reset stored offset on assign() and prevent offsets_store() for unassigned partitions

* Include broker_id in offset reset logs and corresponding consumer errors (confluentinc#3785)

* Txn: properly handle PRODUCER_FENCED in InitPid reply

* Provide reason to broker thread wakeups in debug logs

This will make troubleshooting easier

* rdkafka_performance: include broker in DR printouts

* Make SUBTESTS=.. match all of the subtest format string

* Added file io abstraction

* rdkafka_performance: cut down on the number of poll calls in full-rate mode

* Added test.mock.broker.rtt

* Log mock broker bootstrap.servers addresses when test.mock.num.brokers is set

* Mock brokers now allow compressed ProduceRequests

No decompression or validation is performed.

* Made rd_buf_read|peek_iXX() type safe

* SUB_TEST_SKIP() format verification

* Statistics: let broker.wakeups metric cover all broker wakeups, both IO and cnds

* Improved producer queue wakeups

* Broker thread: don't block on IO if there are ops available

* vcpkg: Update to zlib 1.2.12

* Fix some win32 compilation warnings

* Proper use of rd_socket_close() on Win32

Regression during v1.9.0 development

* Test 0101: missing return after Test::Skip()

* seek() doc clarification (confluentinc#3004)

* Documentation updates

* style-check* now fails on style warnings

* Automatic style fixes

* Some OIDC documentation fixes

* Fix for AWS_MSK_IAM

* Update for new method signature

Co-authored-by: Nikhil Benesch <[email protected]>
Co-authored-by: Bill Rose <[email protected]>
Co-authored-by: Emanuele Sabellico <[email protected]>
Co-authored-by: Magnus Edenhill <[email protected]>
Co-authored-by: Jing Liu <[email protected]>
Co-authored-by: Matt Clarke <[email protected]>
Co-authored-by: Leo Singer <[email protected]>
Co-authored-by: Ladislav <[email protected]>
Co-authored-by: Ladislav Snizek <[email protected]>
Co-authored-by: Lance Shelton <[email protected]>
Co-authored-by: Robin Moffatt <[email protected]>
Co-authored-by: Sergio Arroutbi <[email protected]>
Co-authored-by: Khem Raj <[email protected]>
Co-authored-by: Bill Rose <[email protected]>

merge upstream 2022 08 01 (UrbanCompass#19)

Co-authored-by: Bill Rose <[email protected]>
Co-authored-by: Magnus Edenhill <[email protected]>
Co-authored-by: Nikhil Benesch <[email protected]>
Co-authored-by: Emanuele Sabellico <[email protected]>
Co-authored-by: Jing Liu <[email protected]>
Co-authored-by: Matt Clarke <[email protected]>
Co-authored-by: Leo Singer <[email protected]>
Co-authored-by: Ladislav <[email protected]>
Co-authored-by: Ladislav Snizek <[email protected]>
Co-authored-by: Lance Shelton <[email protected]>
Co-authored-by: Robin Moffatt <[email protected]>
Co-authored-by: Sergio Arroutbi <[email protected]>
Co-authored-by: Khem Raj <[email protected]>
Co-authored-by: Bill Rose <[email protected]>
Co-authored-by: Dmytro Milinevskyi <[email protected]>
Co-authored-by: Mikhail Avdienko <[email protected]>
Co-authored-by: wding <[email protected]>
Co-authored-by: Shawn <[email protected]>
Co-authored-by: ihsinme <[email protected]>
Co-authored-by: Emanuele Sabellico <[email protected]>
Co-authored-by: Roman Schmitz <[email protected]>
Co-authored-by: Miklos Espak <[email protected]>
Co-authored-by: Alice Rum <[email protected]>
Co-authored-by: Eli Smaga <[email protected]>
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.

3 participants