1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

[PR #7653/3d0da927 backport][stable-7] Change tab to space in SSHFP requests (#7679)

Change tab to space in SSHFP requests (#7653)

* Change tab to space in SSHFP requests

Cloudflare uses space and not tab when you search for SSHFP records

Cloudflare changes fingerprint to uppercase

Create 7653-fix-cloudflare-lookup.yml

* Update changelog fragment.

---------

Co-authored-by: Felix Fontein <felix@fontein.de>
(cherry picked from commit 3d0da92784)

Co-authored-by: Kalle Møller <git@k-moeller.dk>
This commit is contained in:
patchback[bot] 2023-12-04 06:29:10 +01:00 committed by GitHub
parent b3d79d728e
commit f3aab7a5b8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 3 deletions

View file

@ -0,0 +1,2 @@
bugfixes:
- cloudflare_dns - fix Cloudflare lookup of SHFP records (https://github.com/ansible-collections/community.general/issues/7652).

View file

@ -613,7 +613,7 @@ class CloudflareAPI(object):
content = str(params['key_tag']) + '\t' + str(params['algorithm']) + '\t' + str(params['hash_type']) + '\t' + params['value'] content = str(params['key_tag']) + '\t' + str(params['algorithm']) + '\t' + str(params['hash_type']) + '\t' + params['value']
elif params['type'] == 'SSHFP': elif params['type'] == 'SSHFP':
if not (params['value'] is None or params['value'] == ''): if not (params['value'] is None or params['value'] == ''):
content = str(params['algorithm']) + '\t' + str(params['hash_type']) + '\t' + params['value'] content = str(params['algorithm']) + ' ' + str(params['hash_type']) + ' ' + params['value'].upper()
elif params['type'] == 'TLSA': elif params['type'] == 'TLSA':
if not (params['value'] is None or params['value'] == ''): if not (params['value'] is None or params['value'] == ''):
content = str(params['cert_usage']) + '\t' + str(params['selector']) + '\t' + str(params['hash_type']) + '\t' + params['value'] content = str(params['cert_usage']) + '\t' + str(params['selector']) + '\t' + str(params['hash_type']) + '\t' + params['value']
@ -726,7 +726,7 @@ class CloudflareAPI(object):
if (attr is None) or (attr == ''): if (attr is None) or (attr == ''):
self.module.fail_json(msg="You must provide algorithm, hash_type and a value to create this record type") self.module.fail_json(msg="You must provide algorithm, hash_type and a value to create this record type")
sshfp_data = { sshfp_data = {
"fingerprint": params['value'], "fingerprint": params['value'].upper(),
"type": params['hash_type'], "type": params['hash_type'],
"algorithm": params['algorithm'], "algorithm": params['algorithm'],
} }
@ -736,7 +736,7 @@ class CloudflareAPI(object):
'data': sshfp_data, 'data': sshfp_data,
"ttl": params['ttl'], "ttl": params['ttl'],
} }
search_value = str(params['algorithm']) + '\t' + str(params['hash_type']) + '\t' + params['value'] search_value = str(params['algorithm']) + ' ' + str(params['hash_type']) + ' ' + params['value']
if params['type'] == 'TLSA': if params['type'] == 'TLSA':
for attr in [params['port'], params['proto'], params['cert_usage'], params['selector'], params['hash_type'], params['value']]: for attr in [params['port'], params['proto'], params['cert_usage'], params['selector'], params['hash_type'], params['value']]: