Hi there 👋
Wener here.
- 💻
- 👩🏻's 🧑🏻
- 👧🏻's 🧑🏻
- ☕️ 🍵
Wener's Personal Service
License: Apache License 2.0
Wener here.
我在代码里添加了 PTR 支持
case *dns.PTR:
rr.Hdr = hrd
rr.Ptr = v.Content
case *dns.NS:
rr.Hdr = hrd
rr.Ns = v.Content
紧接着打印 rr 的数据正常
;; opcode: QUERY, status: NOERROR, id: 52396
;; flags: qr aa rd; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 0
;; QUESTION SECTION:
;99.3.10.10.in-addr.arpa. IN PTR
;; ANSWER SECTION:
99.3.10.10.in-addr.arpa. 60 IN PTR a.xxxx.com
但是客户端查询却是失败的,
$ host -t PTR 10.10.3.99
;; connection timed out; no servers could be reached
我是 golang 小白,如果作者有空的话,望不吝赐教。
Hello,
I am trying to convert my old PowerDNS servers to CoreDNS using your pdsql + sqlite plugin, but am running into a few issues (I probably have something mis-configured). I'm testing out basic SOA and NS records, but I can't seem to get them working.
Here's what my Corefile
looks like:
#
# Authoritative Server
#
example.io. {
pdsql sqlite3 /path/to/example.io.db {
debug db
auto-migrate
}
log
errors
cache
}
#
# Default Recursors Forward
#
. {
forward . 2620:0:ccc::2 2620:0:ccd::2 208.67.222.222 208.67.220.220
cache
errors
log
}
And here's some debug logs from coredns
:
coredns.default(SV): Starting service as user=root, group=root
coredns.default(O): pdsql enable log [db]
coredns.default(O):
coredns.default(O): (/root/go/pkg/mod/github.com/wenerme/[email protected]/coredns/plugin/pdsql/setup.go:77)
coredns.default(O): [2020-01-26 19:00:38] [8.28ms] ALTER TABLE "records" ADD "chang_date" integer;
coredns.default(O): [0 rows affected or returned ]
coredns.default(O): pdsql enable log [db]
coredns.default(O):
coredns.default(O): (/root/go/pkg/mod/github.com/wenerme/[email protected]/coredns/plugin/pdsql/setup.go:77)
coredns.default(O): [2020-01-26 19:00:38] [7.66ms] ALTER TABLE "records" ADD "chang_date" integer;
coredns.default(O): [0 rows affected or returned ]
coredns.default(O): .:5300
coredns.default(O): example.io.:5300
coredns.default(O): CoreDNS-1.6.6
coredns.default(O): linux/amd64, go1.13.5,
coredns.default(O):
coredns.default(O): (/root/go/pkg/mod/github.com/wenerme/[email protected]/coredns/plugin/pdsql/pdsql.go:47)
coredns.default(O): [2020-01-26 19:00:40] [0.92ms] SELECT * FROM "records" WHERE ("records"."name" = 'example.io') AND ("records"."type" = 'SOA')
coredns.default(O): [1 rows affected or returned ]
coredns.default(O): [INFO] 172.17.0.1:32791 - 57123 "SOA IN example.io. udp 51 false 4096" NOERROR qr,aa,rd 85 0.002235243s
coredns.default(O): [ERROR] plugin/errors: 0 example.io. SOA: dns: domain must be fully qualified
coredns.default(O): [INFO] 172.17.0.1:39025 - 30550 "SOA IN example.io. udp 51 false 4096" NOERROR qr,aa,rd 105 0.00005859s
coredns.default(O): [INFO] 172.17.0.1:50535 - 56311 "SOA IN example.io. udp 51 false 4096" NOERROR qr,aa,rd 105 0.000117065s
coredns.default(O): [INFO] 172.17.0.1:50535 - 56311 "SOA IN example.io. udp 51 false 4096" NOERROR qr,aa,rd 105 0.00010024s
coredns.default(O): [INFO] 172.17.0.1:50535 - 56311 "SOA IN example.io. udp 51 false 4096" NOERROR qr,aa,rd 105 0.000046453s
coredns.default(O):
coredns.default(O): (/root/go/pkg/mod/github.com/wenerme/[email protected]/coredns/plugin/pdsql/pdsql.go:47)
coredns.default(O): [2020-01-26 19:01:04] [0.33ms] SELECT * FROM "records" WHERE ("records"."name" = 'example.io') AND ("records"."type" = 'NS')
coredns.default(O): [2 rows affected or returned ]
coredns.default(O): [INFO] 172.17.0.1:56110 - 35718 "NS IN example.io. udp 51 false 4096" NOERROR qr,aa,rd 73 0.000469583s
coredns.default(O): [ERROR] plugin/errors: 0 example.io. NS: dns: domain must be fully qualified
coredns.default(O): [INFO] 172.17.0.1:56110 - 35718 "NS IN example.io. udp 51 false 4096" NOERROR qr,aa,rd 102 0.000095002s
coredns.default(O): [INFO] 172.17.0.1:56110 - 35718 "NS IN example.io. udp 51 false 4096" NOERROR qr,aa,rd 102 0.000108018s
This is what dig
reports:
dig -p 5300 @localhost example.io SOA
; <<>> DiG 9.14.8 <<>> -p 5300 @localhost example.io SOA
; (1 server found)
;; global options: +cmd
;; connection timed out; no servers could be reached
And here's what my sqlite database for domains
& records
looks like:
sqlite3 /path/to/example.io.db -line 'SELECT * FROM "domains";'
id = 1
name = example.io
master = 1
last_check =
type = NATIVE
notified_serial = 2020026068
account =
sqlite3 /path/to/example.io.db -line 'SELECT * FROM "records";'
id = 1
domain_id = 1
name = example.io
type = SOA
content = ns1.example.io support.example.io 2020083356 10800 3600 604800 3600
ttl = 3600
prio = 0
chang_date =
disabled = 0
chang_date =
id = 2
domain_id = 1
name = example.io
type = NS
content = ns1.example.io
ttl = 3600
prio = 0
chang_date =
disabled = 0
chang_date =
id = 3
domain_id = 1
name = example.io
type = NS
content = ns2.example.io
ttl = 3600
prio = 0
chang_date =
disabled = 0
chang_date =
id = 4
domain_id = 1
name = ns1.example.io
type = A
content = 192.168.1.1
ttl = 3600
prio = 0
chang_date =
disabled = 0
chang_date =
id = 5
domain_id = 1
name = ns2.example.io
type = A
content = 192.168.1.2
ttl = 3600
prio = 0
chang_date =
disabled = 0
chang_date =
id = 6
domain_id = 1
name = bar.example.io
type = CNAME
content = google.com
ttl = 3600
prio = 0
chang_date =
disabled = 0
chang_date =
The sqlite entries above very closely mimic my existing MySQL powerdns schema, here's a snippet of my existing MySQL data, with domain values sanitized:
MariaDB [powerdns]> select * from records where domain_id=1;
+----------+-----------+----------------+------+---------------------------------------------------------------------+------+------+-------------+----------+-----------+------+
| id | domain_id | name | type | content | ttl | prio | change_date | disabled | ordername | auth |
+----------+-----------+----------------+------+---------------------------------------------------------------------+------+------+-------------+----------+-----------+------+
| 2 | 1 | example.io | NS | ns1.example.io | 3600 | 0 | NULL | 0 | NULL | 1 |
| 3 | 1 | example.io | NS | ns2.example.io | 3600 | 0 | NULL | 0 | NULL | 1 |
| 17579664 | 1 | ns1.example.io | A | x.x.x.1 | 3600 | 0 | NULL | 0 | NULL | 1 |
| 17579666 | 1 | ns2.example.io | A | x.x.x.2 | 3600 | 0 | NULL | 0 | NULL | 1 |
| 17579675 | 1 | example.io | SOA | ns1.example.io support.example.io 2020029263 10800 3600 604800 3600 | 3600 | 0 | NULL | 0 | NULL | 1 |
+----------+-----------+--------------------+------+-----------------------------------------------------------------+------+------+-------------+----------+-----------+------+
Lastly, here's my build-time plugin.cfg
for coredns
:
# Directives are registered in the order they should be executed.
#
# Ordering is VERY important. Every plugin will feel the effects of all other
# plugin below (after) them during a request, but they must not care what plugin
# above them are doing.
# How to rebuild with updated plugin configurations: Modify the list below and
# run `go generate && go build`
# The parser takes the input format of:
#
# <plugin-name>:<package-name>
# Or
# <plugin-name>:<fully-qualified-package-name>
#
# External plugin example:
#
# log:github.com/coredns/coredns/plugin/log
# Local plugin example:
# log:log
metadata:metadata
cancel:cancel
tls:tls
reload:reload
nsid:nsid
bufsize:bufsize
root:root
bind:bind
debug:debug
trace:trace
ready:ready
health:health
pprof:pprof
prometheus:metrics
errors:errors
log:log
dnstap:dnstap
acl:acl
any:any
chaos:chaos
loadbalance:loadbalance
cache:cache
rewrite:rewrite
dnssec:dnssec
autopath:autopath
template:template
transfer:transfer
hosts:hosts
route53:route53
azure:azure
clouddns:clouddns
federation:github.com/coredns/federation
k8s_external:k8s_external
kubernetes:kubernetes
file:file
auto:auto
secondary:secondary
etcd:etcd
loop:loop
forward:forward
grpc:grpc
erratic:erratic
whoami:whoami
on:github.com/caddyserver/caddy/onevent
sign:sign
pdsql:github.com/wenerme/wps/coredns/plugin/pdsql
pdsql_sqlite:github.com/jinzhu/gorm/dialects/sqlite
Right now you put things in the ADDITIONAL section, but the ANSWER section would be a better place.
;; QUESTION SECTION:
;192-168-1-1.example.org. IN A
;; ADDITIONAL SECTION:
192-168-1-1.example.org. 0 IN A 192.168.1.1
For the SRV this would be better:
;; QUESTION SECTION:
;127-0-0-1-8080.example.org. IN A
;; ANSWER SECTION:
127-0-0-1-8080.example.org. 0 IN A 127.0.0.1
;; ADDITIONAL SECTION:
_port.127-0-0-1-8080.example.org. 0 IN SRV 0 0 8080 .
Hey, cannot fetch pdsql with the current coredns version, maybe im doing something wrong here..
root@2ab378475a31:/go/src/github.com/coredns/coredns# go get github.com/wenerme/wps/coredns/plugin/pdsql
# github.com/coredns/coredns/core/dnsserver
core/dnsserver/register.go:252:5: cannot use new(Server) (type *Server) as type caddy.GracefulServer in assignment:
*Server does not implement caddy.GracefulServer (missing WrapListener method)
Regards
SeaLife
Hi! I'm totally new to the Go language and so apologies if I'm asking a trivial question.
I tried to include the pdsql plugin in CoreDNS v1.8.3 but to little avail:
go get github.com/wenerme/wps
but it later complains that it's not available.go get github.com/wenerme/wps/coredns/plugin/pdsql
after reading one of the Issues here, only to get this:go: found github.com/wenerme/wps/coredns/plugin/pdsql in github.com/wenerme/wps v0.0.0-20191105094758-5c216d826ac7
# github.com/wenerme/wps/coredns/plugin/pdsql
/root/go/pkg/mod/github.com/wenerme/[email protected]/coredns/plugin/pdsql/setup.go:67:12: cannot use c (type *"github.com/caddyserver/caddy".Controller) as type *"github.com/coredns/caddy".Controller in argument to dnsserver.GetConfig
So I would ask:
go get
? Would it be possible to include it in the documentation?Thanks!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.