Przeglądaj źródła

Use the '-p' non-interactive option to generate password hash instead of 'expect'

pull/158/head
Lyubomir Popov 6 lat temu
rodzic
commit
a206b65ed7
4 zmienionych plików z 1 dodań i 40 usunięć
  1. +0
    -2
      roles/matrix-base/tasks/setup_server_base.yml
  2. +0
    -6
      roles/matrix-synapse/tasks/setup_synapse_main.yml
  3. +1
    -1
      roles/matrix-synapse/tasks/update_user_password.yml
  4. +0
    -31
      roles/matrix-synapse/templates/synapse/usr-local-bin/matrix-synapse-generate-password-hash.j2

+ 0
- 2
roles/matrix-base/tasks/setup_server_base.yml Wyświetl plik

@@ -25,7 +25,6 @@
- docker-python - docker-python
- ntp - ntp
- fuse - fuse
- expect
state: latest state: latest
update_cache: yes update_cache: yes
when: ansible_distribution == 'CentOS' when: ansible_distribution == 'CentOS'
@@ -63,7 +62,6 @@
- python-docker - python-docker
- ntp - ntp
- fuse - fuse
- expect
state: latest state: latest
update_cache: yes update_cache: yes
when: ansible_os_family == 'Debian' when: ansible_os_family == 'Debian'


+ 0
- 6
roles/matrix-synapse/tasks/setup_synapse_main.yml Wyświetl plik

@@ -79,9 +79,3 @@
dest: "/usr/local/bin/matrix-synapse-register-user" dest: "/usr/local/bin/matrix-synapse-register-user"
mode: 0750 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


+ 1
- 1
roles/matrix-synapse/tasks/update_user_password.yml Wyświetl plik

@@ -41,7 +41,7 @@
when: postgres_start_result.changed when: postgres_start_result.changed


- name: Generate password hash - 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 register: password_hash


- name: Update user password hash - name: Update user password hash


+ 0
- 31
roles/matrix-synapse/templates/synapse/usr-local-bin/matrix-synapse-generate-password-hash.j2 Wyświetl plik

@@ -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

Ładowanie…
Anuluj
Zapisz