Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable DNSSEC validation #675

Merged
merged 2 commits into from
Nov 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/k8s.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ CoreDNS.

For other domain names such as `www.google.com`, node-local DNS cache servers can be
configured to send queries to upstream DNS servers defined in [cluster.yml](./cluster.md).
CKE validates the integrity of the replies using DNSSEC validation.

## Certificates for admission webhooks

Expand Down
2 changes: 1 addition & 1 deletion images.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const (
ToolsImage = Image("quay.io/cybozu/cke-tools:1.26.0")
PauseImage = Image("quay.io/cybozu/pause:3.9.0.1")
CoreDNSImage = Image("quay.io/cybozu/coredns:1.10.1.1")
UnboundImage = Image("quay.io/cybozu/unbound:1.17.1.4")
UnboundImage = Image("ghcr.io/cybozu/unbound:1.18.0.2")
UnboundExporterImage = Image("quay.io/cybozu/unbound_exporter:0.4.1.5")
)

Expand Down
22 changes: 21 additions & 1 deletion mtest/kubernetes_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,20 @@ func testKubernetes() {
}
return nil
}).Should(Succeed())

Eventually(func() error {
stdout, stderr, err := kubectl("get", "service", "-n="+namespace, "httpd", "-o", "jsonpath='{.spec.clusterIP}'")
if err != nil {
return fmt.Errorf("%v: stderr=%s", err, stderr)
}
ip := string(stdout)

_, stderr, err = kubectl("exec", "-n="+namespace, "client", "getent", "hosts", ip)
if err != nil {
return fmt.Errorf("%v: stderr=%s", err, stderr)
}
return nil
}).Should(Succeed())
})

It("updates unbound config", func() {
Expand Down Expand Up @@ -236,7 +250,7 @@ func testKubernetes() {
return nil
}).Should(Succeed())

By("querying www.google.com using node DNS from ubuntu pod")
By("querying www.cybozu.com using node DNS from ubuntu pod")
_, stderr, err = kubectl("run", "-n="+namespace, "--image=quay.io/cybozu/ubuntu:22.04", "--restart=Never",
"client", "--", "pause")
Expect(err).NotTo(HaveOccurred(), "stderr: %s", stderr)
Expand All @@ -245,6 +259,12 @@ func testKubernetes() {
return err
}).Should(Succeed())

By("querying www.dnssec-failed.org using node DNS from ubuntu pod")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test is OK.

Could you update the By() just before? Currently, we uses "www.cybozu.com".
By("querying www.google.com using node DNS from ubuntu pod")

Consistently(func() error {
_, _, err := kubectl("exec", "-n="+namespace, "client", "getent", "hosts", "www.dnssec-failed.org")
return err
}).WithTimeout(time.Second * 5).WithPolling(time.Second * 1).ShouldNot(Succeed())

By("getting metrics from unbound_exporter")
Eventually(func() error {
stdout, _, err := kubectl("exec", "-n=kube-system", "daemonset/node-dns", "-c", "unbound", "--", "curl", "-sSf", "http://127.0.0.1:9167/metrics")
Expand Down
20 changes: 20 additions & 0 deletions op/nodedns/nodedns.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,26 @@ server:
local-zone: "29.172.in-addr.arpa." transparent
local-zone: "30.172.in-addr.arpa." transparent
local-zone: "31.172.in-addr.arpa." transparent
trust-anchor-file: "/usr/local/unbound/etc/unbound/root.key"
domain-insecure: "{{ .Domain }}"
domain-insecure: "10.in-addr.arpa."
domain-insecure: "168.192.in-addr.arpa."
domain-insecure: "16.172.in-addr.arpa."
domain-insecure: "17.172.in-addr.arpa."
domain-insecure: "18.172.in-addr.arpa."
domain-insecure: "19.172.in-addr.arpa."
domain-insecure: "20.172.in-addr.arpa."
domain-insecure: "21.172.in-addr.arpa."
domain-insecure: "22.172.in-addr.arpa."
domain-insecure: "23.172.in-addr.arpa."
domain-insecure: "24.172.in-addr.arpa."
domain-insecure: "25.172.in-addr.arpa."
domain-insecure: "26.172.in-addr.arpa."
domain-insecure: "27.172.in-addr.arpa."
domain-insecure: "28.172.in-addr.arpa."
domain-insecure: "29.172.in-addr.arpa."
domain-insecure: "30.172.in-addr.arpa."
domain-insecure: "31.172.in-addr.arpa."
remote-control:
control-enable: yes
control-interface: {{ if .LocalControl }} /var/run/unbound/unbound.sock {{ else }} 127.0.0.1 {{ end }}
Expand Down
4 changes: 2 additions & 2 deletions static/resources.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.