Cp-ansible: ๋น„๋ฐ€๋ฒˆํ˜ธ ๋ณด๊ด€ ์‹œ ์˜ˆ์™ธ SASL SCRAM ์‚ฌ์šฉ์ž

์— ๋งŒ๋“  2021๋…„ 04์›” 06์ผ  ยท  4์ฝ”๋ฉ˜ํŠธ  ยท  ์ถœ์ฒ˜: confluentinc/cp-ansible

๋ฌธ์ œ ์„ค๋ช…

sasl_protocol๊ณผ ํ•จ๊ป˜ ํ”Œ๋ ˆ์ด๋ถ์„ ์‚ฌ์šฉํ•˜์—ฌ ์Šคํฌ๋žจํ•‘ํ•ฉ๋‹ˆ๋‹ค. ์‚ฌ์šฉ์ž ๋น„๋ฐ€๋ฒˆํ˜ธ ๋ณด๊ด€ํ•จ์„ ์„ค์ •ํ•œ ๊ฒฝ์šฐ ์ด ์ž‘์—… ์—์„œ ์˜ˆ์™ธ๊ฐ€ ๋ฐœ์ƒํ•ฉ๋‹ˆ๋‹ค.
์น˜๋ช…์ : [XXXXXX]: ์‹คํŒจ! => {"msg": "'{{ kafka_broker_combined_properties | Combine(kafka_broker_custom_properties) }}'์„(๋ฅผ) ํ…œํ”Œ๋ฆฟํ•˜๋Š” ๋™์•ˆ ์ฒ˜๋ฆฌ๋˜์ง€ ์•Š์€ ์˜ˆ์™ธ๊ฐ€ ๋ฐœ์ƒํ–ˆ์Šต๋‹ˆ๋‹ค. [....]๋Š” str(\"AnsibleVaultEncryptedUnicode\" ์•„๋‹˜)์„ str์— ์—ฐ๊ฒฐํ•  ์ˆ˜๋งŒ ์žˆ์Šต๋‹ˆ๋‹ค."}

๊ธฐ๋ณธ ๊ตฌ์„ฑ์—์„œ ์•”ํ˜ธ๊ฐ€ ๋ฌธ์ž์—ด์ด๊ธฐ ๋•Œ๋ฌธ์— Combine_properties ํ•จ์ˆ˜์—์„œ ๋ฌธ์ œ๊ฐ€ ๋ฐœ์ƒํ•œ๋‹ค๊ณ  ์ƒ๊ฐํ•ฉ๋‹ˆ๋‹ค. ๋”ฐ๋ผ์„œ ๋น„๋ฐ€๋ฒˆํ˜ธ๊ฐ€ ๋ณผํŠธ ์ธ์ฝ”๋”ฉ myabe์ธ ๊ฒฝ์šฐ 'toString() python ๋ฉ”์†Œ๋“œ'๋กœ ์ˆ˜์ •ํ•˜์‹ญ์‹œ์˜ค.


    def combine_properties(self, properties_dict):
        # Loops over master properties dictionary and combines sub elements if enabled
        final_dict = {}
        for prop in properties_dict:
            if properties_dict[prop].get('enabled'):
                final_dict.update(properties_dict[prop].get('properties'))
        return final_dict

์žฌํ˜„ํ•˜๊ธฐ ์œ„ํ•ด
๋ชจ๋“  ๋ณ€์ˆ˜ ๊ตฌ์„ฑ:

    sasl_protocol: scram

    sasl_scram_users:
      admin:
        principal: "admin"
        password: !vault |
          $ANSIBLE_VAULT;1.1;AES256
          32313537636131333038303532613231653233343565303831396530393061643031303432303632
          6537306234393563343861643834336430353930643062370a663563376131653664653430363963
          62303339313937646635663032326266383439623736623462373632313934643261303634663732
          3331643634623337610a616365613231346630656564616265656231633238313932333437363461
          65626165666531656463353562323165376135653631316435653337366164653063
      client:
        principal: "client"
        password: !vault |
          $ANSIBLE_VAULT;1.1;AES256
          35653666663833386164616630353966363231633234633561663464653931393835653830303630
          3263373337396137653637383332656539373766346438370a353164383737306535646234363065
          66643863353439663064346564333062373265653036646137306531353336323931653931363032
          3231373831366531640a323161386538333966646635353462623263346234306631383635646237
          34613764663736346362616562623061333438613461616162386532373266393166

ํ•ด๊ฒฐ ๋ฐฉ๋ฒ•

ํ•ด๊ฒฐ ๋ฐฉ๋ฒ•์ด ์กด์žฌ ํ•ฉ๋‹ˆ๋‹ค. ๋ณผํŠธ๋กœ ์ธ์ฝ”๋”ฉ๋œ ๋ฌธ์ž์—ด์„ ๋ณ€ํ™˜ํ•ด์•ผ ํ•ฉ๋‹ˆ๋‹ค.

    sasl_protocol: scram

    sasl_admin_password: !vault |
      $ANSIBLE_VAULT;1.1;AES256
      32313537636131333038303532613231653233343565303831396530393061643031303432303632
      6537306234393563343861643834336430353930643062370a663563376131653664653430363963
      62303339313937646635663032326266383439623736623462373632313934643261303634663732
      3331643634623337610a616365613231346630656564616265656231633238313932333437363461
      65626165666531656463353562323165376135653631316435653337366164653063

    sasl_client_password: !vault |
      $ANSIBLE_VAULT;1.1;AES256
      35653666663833386164616630353966363231633234633561663464653931393835653830303630
      3263373337396137653637383332656539373766346438370a353164383737306535646234363065
      66643863353439663064346564333062373265653036646137306531353336323931653931363032
      3231373831366531640a323161386538333966646635353462623263346234306631383635646237
      34613764663736346362616562623061333438613461616162386532373266393166

    sasl_scram_users:
      admin:
        principal: "admin"
        password: "{{sasl_admin_password|string}}"
      client:
        principal: "client"
        password: "{{sasl_client_password|string}}"

๋ชจ๋“  4 ๋Œ“๊ธ€

@LGouellec ๋‹ค์Œ Ansible ๋ชจ๋ฒ” ์‚ฌ๋ก€๊ฐ€ ์œ ํšจํ•œ ํ•ด๊ฒฐ ๋ฐฉ๋ฒ•์ด ๋  ์ˆ˜ ์žˆ์Šต๋‹ˆ๊นŒ? https://docs.ansible.com/ansible/latest/user_guide/playbooks_best_practices.html#keep -vaulted-variables-safely-visible, ๋˜๋Š” ๋ฌธ์ œ?

์•ˆ๋…•ํ•˜์„ธ์š” @erkgb ๋‹˜

๋„ค, ์œ ํšจํ•œ ํ•ด๊ฒฐ ๋ฐฉ๋ฒ•์ž…๋‹ˆ๋‹ค.
Combine_properties ํ•จ์ˆ˜์—์„œ AnsibleVaultEncryptedUnicode๋ฅผ ๊ด€๋ฆฌํ•  ์ˆ˜ ์—†์Šต๋‹ˆ๊นŒ?

๋„ค, ์œ ํšจํ•œ ํ•ด๊ฒฐ ๋ฐฉ๋ฒ•์ž…๋‹ˆ๋‹ค.

๋ฉ‹์ง€๋„ค์š”! ๐Ÿ‘

Combine_properties ํ•จ์ˆ˜์—์„œ AnsibleVaultEncryptedUnicode๋ฅผ ๊ด€๋ฆฌํ•  ์ˆ˜ ์—†์Šต๋‹ˆ๊นŒ?

์˜ˆ, ๊ณ ์น  ์ˆ˜ ์žˆ๋‹ค๊ณ  ์ƒ๊ฐํ•ฉ๋‹ˆ๋‹ค. ์ด ๋ฌธ์ œ๋ฅผ ํ•ด๊ฒฐํ•˜๊ธฐ ์œ„ํ•ด PR์„ ์ œ์ถœํ•˜๋ฉด ๊ฒ€ํ† ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ์ด ๋ฒ„๊ทธ๋Š” ๋ฐฑ๋กœ๊ทธ์— ๊ธฐ๋ก๋˜๊ณ  ์—ฌ๊ธฐ์— ์„ค๋ช…๋œ ์ตœ์„ ์˜ ๋…ธ๋ ฅ์— ๋”ฐ๋ผ ์ฒ˜๋ฆฌ

PR #640์—์„œ ํ•ด๊ฒฐ๋จ

์ด ํŽ˜์ด์ง€๊ฐ€ ๋„์›€์ด ๋˜์—ˆ๋‚˜์š”?
0 / 5 - 0 ๋“ฑ๊ธ‰