0
1

More than 1 year has passed since last update.

【ルール説明】no-log-password

Posted at

こちらの記事は Ansible lint Advent Calendar 2022 カレンダー2 25日目の記事になります。

今回はルール no-log-password について説明します。

no-log-password

no-log-password はパスワード等の秘匿情報が渡された時に秘匿情報が Ansible の実行ログに露出しないか検証します。no-log-passwordopt-inのため初期設定では有効になっていません。no-log-password を適用する場合は設定ファイル等で有効にします。

enable_list:
  - no-log-password

ほとんどの Ansible モジュールでは秘匿情報が実行ログに露出する事はありません。しかしが万が一を避けるためにno_log: trueにする方法も考えられます。

問題のあるコード

---
- name: Example playbook
  hosts: localhost
  tasks:
    - name: Log user passwords
      ansible.builtin.user:
        name: john_doe
        comment: John Doe
        uid: 1040
        group: admin
        password: "{{ item }}"
      with_items:
        - wow
      no_log: false # <- no_log が false になっている

修正されたコード

---
- name: Example playbook
  hosts: localhost
  tasks:
    - name: Do not log user passwords
      ansible.builtin.user:
        name: john_doe
        comment: John Doe
        uid: 1040
        group: admin
        password: "{{ item }}"
      with_items:
        - wow
      no_log: true # <- no_log を true にする

参考サイト

0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1