test-kafka-sasl-mssl.td 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. # Copyright Materialize, Inc. and contributors. All rights reserved.
  2. #
  3. # Use of this software is governed by the Business Source License
  4. # included in the LICENSE file at the root of this repository.
  5. #
  6. # As of the Change Date specified in that file, in accordance with
  7. # the Business Source License, use of this software will be governed
  8. # by the Apache License, Version 2.0.
  9. # ==> Set up. <==
  10. $ set-from-file ca-crt=/share/secrets/ca.crt
  11. $ set-from-file kafka-crt=/share/secrets/materialized-kafka.crt
  12. $ set-from-file kafka-key=/share/secrets/materialized-kafka.key
  13. $ set-from-file kafka1-crt=/share/secrets/materialized-kafka1.crt
  14. $ set-from-file kafka1-key=/share/secrets/materialized-kafka1.key
  15. > CREATE SECRET kafka_key AS '${kafka-key}'
  16. > CREATE SECRET kafka1_key AS '${kafka1-key}'
  17. > CREATE SECRET password AS 'sekurity';
  18. > CREATE SECRET password_wrong AS 'wrong';
  19. $ kafka-create-topic topic=text-data
  20. $ kafka-ingest topic=text-data format=bytes
  21. banana
  22. # ==> Test invalid configurations. <==
  23. ! CREATE CONNECTION kafka_invalid TO KAFKA (
  24. BROKER 'kafka:9097',
  25. SASL MECHANISMS 'PLAIN',
  26. SASL USERNAME 'materialize',
  27. SASL PASSWORD SECRET password,
  28. SSL CERTIFICATE AUTHORITY = '${ca-crt}'
  29. )
  30. contains:ssl/tls alert bad certificate
  31. ! CREATE CONNECTION kafka_invalid TO KAFKA (
  32. BROKER 'kafka:9097',
  33. SASL MECHANISMS 'PLAIN',
  34. SASL USERNAME 'materialize',
  35. SASL PASSWORD SECRET password,
  36. SSL CERTIFICATE '${kafka1-crt}',
  37. SSL KEY SECRET kafka1_key,
  38. SSL CERTIFICATE AUTHORITY '${ca-crt}'
  39. )
  40. contains:ssl/tls alert certificate unknown
  41. ! CREATE CONNECTION kafka_invalid TO KAFKA (
  42. BROKER 'kafka:9097',
  43. SASL MECHANISMS 'PLAIN',
  44. SASL USERNAME 'materialize',
  45. SASL PASSWORD SECRET password_wrong,
  46. SSL CERTIFICATE '${kafka-crt}',
  47. SSL KEY SECRET kafka_key,
  48. SSL CERTIFICATE AUTHORITY '${ca-crt}'
  49. )
  50. contains:Invalid username or password
  51. # ==> Test without an SSH tunnel. <==
  52. > CREATE CONNECTION kafka TO KAFKA (
  53. BROKER 'kafka:9097',
  54. SASL MECHANISMS 'PLAIN',
  55. SASL USERNAME 'materialize',
  56. SASL PASSWORD SECRET password,
  57. SSL CERTIFICATE '${kafka-crt}',
  58. SSL KEY SECRET kafka_key,
  59. SSL CERTIFICATE AUTHORITY '${ca-crt}'
  60. )
  61. > CREATE SOURCE text_data FROM KAFKA CONNECTION kafka (
  62. TOPIC 'testdrive-text-data-${testdrive.seed}'
  63. )
  64. > CREATE TABLE text_data_tbl FROM SOURCE text_data (REFERENCE "testdrive-text-data-${testdrive.seed}") FORMAT TEXT
  65. > SELECT * FROM text_data_tbl
  66. banana
  67. # ==> Test with an SSH tunnel. <==
  68. > CREATE CONNECTION kafka_ssh TO KAFKA (
  69. BROKER 'kafka:9097' USING SSH TUNNEL testdrive_no_reset_connections.public.ssh,
  70. SASL MECHANISMS 'PLAIN',
  71. SASL USERNAME 'materialize',
  72. SASL PASSWORD SECRET password,
  73. SSL CERTIFICATE '${kafka-crt}',
  74. SSL KEY SECRET kafka_key,
  75. SSL CERTIFICATE AUTHORITY '${ca-crt}'
  76. )
  77. > CREATE SOURCE text_data_ssh FROM KAFKA CONNECTION kafka_ssh (
  78. TOPIC 'testdrive-text-data-${testdrive.seed}'
  79. )
  80. > CREATE TABLE text_data_ssh_tbl FROM SOURCE text_data_ssh (REFERENCE "testdrive-text-data-${testdrive.seed}") FORMAT TEXT
  81. > SELECT * FROM text_data_ssh_tbl
  82. banana