Skip to content

set random password #6

@basz

Description

@basz

Hello,

Would you consider adding a random password to the user creation 'cause otherwise the account is locked and passwordless keys will not work.

Try this role and then dev-sec.ssh-hardening. You will not be able to login at all.

- name: Create user
  user:
    generate_ssh_key: "{{ user_generate_ssh_key }}"
    groups: "{{ (user_groups | join(',')) }}"
    append: True
    name: "{{ user_name }}"
    shell: "{{ user_shell }}"
    # this generates a hashed and random uuid string
    password: "{{ 9999999999999999999999 | random | string | to_uuid | password_hash('sha512', 65534 | random | string) }}"
    update_password: on_create

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions