fix: Clone new TLSA and fix some typos
This commit is contained in:
parent
5980edbf89
commit
f68186314b
58
varo.py
58
varo.py
@ -271,15 +271,71 @@ def copy_to_alts(domain):
|
|||||||
print(alt_zone)
|
print(alt_zone)
|
||||||
if alt_zone == "":
|
if alt_zone == "":
|
||||||
continue
|
continue
|
||||||
|
# Delete all records from domain.alt
|
||||||
|
data = {
|
||||||
|
"action": "getRecords",
|
||||||
|
"zone": alt_zone,
|
||||||
|
"name": domain+"."+alt_domain,
|
||||||
|
"type": "",
|
||||||
|
"content": ""
|
||||||
|
}
|
||||||
|
r = requests.post(url, headers=headers, json=data)
|
||||||
|
r = r.json()
|
||||||
|
if 'data' not in r:
|
||||||
|
continue
|
||||||
|
for record in r['data']:
|
||||||
|
data = {
|
||||||
|
"action": "deleteRecord",
|
||||||
|
"zone": alt_zone,
|
||||||
|
"record": record['uuid']
|
||||||
|
}
|
||||||
|
r = requests.post(url, headers=headers, json=data)
|
||||||
|
print(r.text)
|
||||||
|
|
||||||
# Add each record to each alt
|
# Add each record to each alt
|
||||||
for record in records:
|
for record in records:
|
||||||
data = {
|
data = {
|
||||||
"action": "addRecord",
|
"action": "addRecord",
|
||||||
"zone": alt_zone,
|
"zone": alt_zone,
|
||||||
"type": record['type'],
|
"type": record['type'],
|
||||||
"name": record['name'].replace(domain,alt_domain),
|
"name": domain+"."+alt_domain,
|
||||||
"content": record['content'],
|
"content": record['content'],
|
||||||
}
|
}
|
||||||
print(data)
|
print(data)
|
||||||
r = requests.post(url, headers=headers, json=data)
|
r = requests.post(url, headers=headers, json=data)
|
||||||
print(r.text)
|
print(r.text)
|
||||||
|
# Add TLSA record if it doesn't exist
|
||||||
|
data = {
|
||||||
|
"action": "getRecords",
|
||||||
|
"zone": alt_zone,
|
||||||
|
"name": "_443._tcp."+domain+"."+alt_domain,
|
||||||
|
"type": "TLSA",
|
||||||
|
"content": ""
|
||||||
|
}
|
||||||
|
r = requests.post(url, headers=headers, json=data)
|
||||||
|
r = r.json()
|
||||||
|
if 'data' not in r:
|
||||||
|
# Get alt TLSA from _443._tcp.alt_domain
|
||||||
|
data = {
|
||||||
|
"action": "getRecords",
|
||||||
|
"zone": alt_zone,
|
||||||
|
"name": "_443._tcp."+alt_domain,
|
||||||
|
"type": "TLSA",
|
||||||
|
"content": ""
|
||||||
|
}
|
||||||
|
r = requests.post(url, headers=headers, json=data)
|
||||||
|
r = r.json()
|
||||||
|
if 'data' not in r:
|
||||||
|
continue
|
||||||
|
for record in r['data']:
|
||||||
|
ALT_TLSA = record['content']
|
||||||
|
|
||||||
|
data = {
|
||||||
|
"action": "addRecord",
|
||||||
|
"zone": alt_zone,
|
||||||
|
"type": "TLSA",
|
||||||
|
"name": "_443._tcp."+domain+"."+alt_domain,
|
||||||
|
"content": ALT_TLSA,
|
||||||
|
}
|
||||||
|
r = requests.post(url, headers=headers, json=data)
|
||||||
|
print(r.text)
|
||||||
|
Loading…
Reference in New Issue
Block a user