mirror of
https://github.com/spantaleev/matrix-docker-ansible-deploy.git
synced 2025-06-25 10:47:51 +02:00
Use the '-p' non-interactive option to generate password hash instead of 'expect'
This commit is contained in:
@ -79,9 +79,3 @@
|
||||
dest: "/usr/local/bin/matrix-synapse-register-user"
|
||||
mode: 0750
|
||||
|
||||
- name: Ensure matrix-synapse-generate-password-hash script created
|
||||
template:
|
||||
src: "{{ role_path }}/templates/synapse/usr-local-bin/matrix-synapse-generate-password-hash.j2"
|
||||
dest: "/usr/local/bin/matrix-synapse-generate-password-hash"
|
||||
mode: 0750
|
||||
|
||||
|
@ -41,7 +41,7 @@
|
||||
when: postgres_start_result.changed
|
||||
|
||||
- name: Generate password hash
|
||||
shell: "/usr/local/bin/matrix-synapse-generate-password-hash {{ password }}"
|
||||
shell: "/usr/bin/docker exec matrix-synapse /usr/local/bin/hash_password -c /data/homeserver.yaml -p {{ password }}"
|
||||
register: password_hash
|
||||
|
||||
- name: Update user password hash
|
||||
|
@ -1,31 +0,0 @@
|
||||
#!/usr/bin/env expect
|
||||
|
||||
# Read the password string
|
||||
set pass [lindex $argv 0]
|
||||
|
||||
# Check if password was provided
|
||||
if { $pass == "" } {
|
||||
puts "Usage: $argv0 <password>"
|
||||
exit 1
|
||||
}
|
||||
|
||||
# Disable output
|
||||
log_user 0
|
||||
|
||||
# Execute password hashing script
|
||||
spawn docker exec -it matrix-synapse /usr/local/bin/hash_password -c /data/homeserver.yaml
|
||||
expect "Password: "
|
||||
send "$pass\r"
|
||||
expect "Confirm password: "
|
||||
send "$pass\r"
|
||||
expect "%"
|
||||
|
||||
# Save the hash output to a variable
|
||||
set output $expect_out(buffer)
|
||||
|
||||
# Trim the whitespace
|
||||
regexp {\S+} $output passwordHash
|
||||
|
||||
# Output the password hash
|
||||
puts -nonewline stdout $passwordHash
|
||||
close stdout
|
Reference in New Issue
Block a user