Skip to content

Commit

Permalink
fix user and password references
Browse files Browse the repository at this point in the history
  • Loading branch information
suhancz committed Oct 29, 2023
1 parent 50bf014 commit cd5dc20
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion templates/dyndns/dynamic_dns_client.py.j2
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ from requests.auth import HTTPBasicAuth

# change these values if not given by arguments to the script
login = "{{ wg_configs[dyndns_item]['owner'] | default('dyndns') }}"
password = "{{ users | selectattr('name', 'equalto', dyndns_item.owner) | map(attribute='password') | first | default(users[mailserver_admin_user]['password') }}"
password = "{{ users | selectattr('name', 'equalto', (wg_configs[dyndns_item]['owner'] | default(users[mailserver_admin_user]))) | map(attribute='password') | first }}"
dyndns = socket.gethostname().split('.', 1)[0].lower() + "{% if wg_configs[dyndns_item]['owner'] is defined %}.{{ wg_configs[dyndns_item]['owner'] }}{% endif %}.dyndns.{{ mailserver_domain }}"
dyndns_server = 'https://dyndns.{{ mailserver_domain }}'
ip_lookup_url = 'https://clientip.{{ mailserver_domain }}'
Expand Down
2 changes: 1 addition & 1 deletion templates/dyndns/dynamic_dns_client.sh.j2
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
client_ip4="$(/usr/bin/curl -L -4 https://clientip.{{ mailserver_domain }})"
client_ip6="$(/usr/bin/curl -L -6 https://clientip.{{ mailserver_domain }})"
username="{{ wg_configs[dyndns_item]['owner'] | default('dyndns') }}"
password="{{ users | selectattr('name', 'equalto', dyndns_item.owner) | map(attribute='password') | first | default(users[mailserver_admin_user]['password') }}"
password="{{ users | selectattr('name', 'equalto', (wg_configs[dyndns_item]['owner'] | default(users[mailserver_admin_user]))) | map(attribute='password') | first }}"
mixed_hostname="$(/bin/hostname -s)"
target_hostname="${mixed_hostname,,}{% if wg_configs[dyndns_item]['owner'] is defined %}.{{ wg_configs[dyndns_item]['owner'] }}{% endif %}"
/usr/bin/curl -L -u ${username}:${password} "https://dyndns.{{ mailserver_domain }}/?hostname=${target_hostname}.dyndns.{{ mailserver_domain }}&verbose=true&myip=${client_ip4}"
Expand Down

0 comments on commit cd5dc20

Please sign in to comment.