Open xuanyuanaosheng opened 3 hours ago
api_key="cajkbcksjbkcsacslpXAX"
content_type="application/json"
list=$(dirname $(readlink -f "$0"))/list/dns.list
while read line;do
name=$(echo $line |awk '{print $1}')
content=$(echo $line |awk '{print $2}') zone=$(echo $name |awk -F. 'BEGIN {OFS="."}{$1="";print}' |sed 's/.//') pdns_api_url="http://powerdns.me/api/v1/servers/localhost/zones/$zone"
curl -H "X-API-Key: $api_key" -H "Content-Type: $content_type" -s -X PATCH --data \ '{"rrsets": [{"changetype": "REPLACE", "type": "A", "name": "'"$name."'", "ttl": "1800", "records": [{"content": "'"$content"'", "disabled": false}]}]}' \ $pdns_api_url && echo "Modifying $name to $content Succeeded!" done < $list
2. 批量修改Cname
api_key="cajkbcksjbkcsacslpXAX" content_type="application/json" list=$(dirname $(readlink -f "$0"))/list/dns.list
while read line;do name=$(echo $line |awk '{print $1}') content=$(echo $line |awk '{print $2}') zone=$(echo $name |awk -F. 'BEGIN {OFS="."}{$1="";print}' |sed 's/.//') pdns_api_url="http://powerdns.me/api/v1/servers/localhost/zones/$zone"
curl -H "X-API-Key: $api_key" -H "Content-Type: $content_type" -s -X PATCH --data \ '{"rrsets": [{"changetype": "REPLACE", "type": "CNAME", "name": "'"$name."'", "ttl": "60", "records": [{"content": "'"$content."'", "disabled": false}]}]}' \ $pdns_api_url && echo "Modifying $name to $content Succeeded!" done < $list
官方网站
组件
一个典型的配置
搭建步骤
API测试
PowerDNS的监控地址:
查询一个zone里面所有的记录
创建一个新的Zone
新建DNS记录
参考文档