【问题标题】:Ansible is masking strings which matches password with URI moduleAnsible 正在屏蔽与密码与 URI 模块匹配的字符串
【发布时间】:2018-12-14 05:51:23
【问题描述】:

使用 uri 模块从 API 获取一些数据

 - name: Fetch Data
    uri:
       url: "https://192.168.1.1:8080/api/data"
       headers:
       timeout: 60
       method: GET
       user: oes
       password: "123"
       force_basic_auth: yes
       status_code: 200
       return_content: yes
       validate_certs: no
    register: response
    ignore_errors: yes  

响应包含 password (123) 被屏蔽为 ***

{
  "Name":"sample",
  "Age":"10",
  "Roll No":"123"
}

有人可以帮忙找到一种方法来避免响应负载中的密码模式被屏蔽

【问题讨论】:

  • 呵呵,“不要使用123作为密码?!”怎么样?正如人们所预料的那样,它是directly addressed in the fine manual
  • 好吧,@MatthewLDaniel 我刚刚提供了一个示例密码。我得到 UUID 作为响应,它可能不像 123 那样简单,它可以与 GOOD 密码匹配。所以我在想是否有办法避免蒙面。
  • 供您考虑,UUID 中的第二个“U”应该提供合理的碰撞保证,所以除非密码 标识符,否则我不希望偶然匹配

标签: ansible ansible-2.x


【解决方案1】:

已经警告过您手册中的 please don't do that 建议,您可以通过欺骗 ansible 使其不知道 123 是您的密码来规避问题:

- uri:
    url: https://oes:123@192.168.1.1:8080/api/data
    force_basic_auth: yes
    # etc etc but **omitting** user: and password:

【讨论】:

    猜你喜欢
    • 2011-12-03
    • 2021-06-18
    • 1970-01-01
    • 1970-01-01
    • 2021-06-26
    • 1970-01-01
    • 1970-01-01
    • 2020-12-11
    • 1970-01-01
    相关资源
    最近更新 更多