Skip to content

Commit

Permalink
Add Kerberos acceptance tests
Browse files Browse the repository at this point in the history
Runs three versions; password authentication, keytab authentication, and
using an existing ticket/session.
  • Loading branch information
bodgit committed Feb 19, 2021
1 parent 0fa5509 commit a6225f2
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 2 deletions.
2 changes: 2 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,11 @@ install:
# packages that live there.
# See: https://github.com/golang/go/issues/12933
- bash scripts/gogetcookie.sh
- sudo DEBIAN_FRONTEND=noninteractive apt-get install -yq krb5-user

script:
- make test
- echo 127.0.0.1 ns.example.com | sudo tee -a /etc/hosts
- bash internal/provider/acceptance.sh
- make vet

Expand Down
49 changes: 47 additions & 2 deletions internal/provider/acceptance.sh
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,31 @@ docker run -d --tmpfs /tmp --tmpfs /run \
DNS_UPDATE_KEYNAME="tsig.example.com." DNS_UPDATE_KEYALGORITHM="hmac-sha256" DNS_UPDATE_KEYSECRET="UHeh4Iv/DVmPhi6LqCPDs6PixnyjLH4fjGESBjYnOyE=" GO111MODULE=on GOFLAGS=-mod=vendor make testacc TEST=./internal/provider || failed
cleanup_docker

# Run with Kerberos authentication
export KRB5_CONFIG="${PWD}/internal/provider/testdata/krb5.conf"
export DNS_UPDATE_REALM="EXAMPLE.COM"
export DNS_UPDATE_SERVER="ns.example.com"

# Run with Kerberos authentication (password authentication)

docker run -d --tmpfs /tmp --tmpfs /run \
-v /sys/fs/cgroup:/sys/fs/cgroup:ro \
-v /etc/localtime:/etc/localtime:ro \
-p 127.0.0.1:88:88 \
-p 127.0.0.1:88:88/udp \
-p 127.0.0.1:464:464 \
-p 127.0.0.1:464:464/udp \
--rm --name kdc kdc || failed
docker run -d --tmpfs /tmp --tmpfs /run \
-v /sys/fs/cgroup:/sys/fs/cgroup:ro \
-v /etc/localtime:/etc/localtime:ro \
-v $PWD/internal/provider/testdata/named.conf.kerberos:/etc/named.conf:ro \
-p 127.0.0.1:53:53 \
-p 127.0.0.1:53:53/udp \
--rm --name ns --hostname ns.example.com ns || failed
DNS_UPDATE_USERNAME="test" DNS_UPDATE_PASSWORD="password" GO111MODULE=on GOFLAGS=-mod=vendor make testacc TEST=./internal/provider || failed
cleanup_docker

# Run with Kerberos authentication (keytab authentication)

docker run -d --tmpfs /tmp --tmpfs /run \
-v /sys/fs/cgroup:/sys/fs/cgroup:ro \
Expand All @@ -60,5 +84,26 @@ docker run -d --tmpfs /tmp --tmpfs /run \
-p 127.0.0.1:53:53 \
-p 127.0.0.1:53:53/udp \
--rm --name ns --hostname ns.example.com ns || failed
# FIXME Run Kerberos tests here
DNS_UPDATE_USERNAME="test" DNS_UPDATE_KEYTAB="${PWD}/internal/provider/testdata/test.keytab" GO111MODULE=on GOFLAGS=-mod=vendor make testacc TEST=./internal/provider || failed
cleanup_docker

# Run with Kerberos authentication (session authentication)

docker run -d --tmpfs /tmp --tmpfs /run \
-v /sys/fs/cgroup:/sys/fs/cgroup:ro \
-v /etc/localtime:/etc/localtime:ro \
-p 127.0.0.1:88:88 \
-p 127.0.0.1:88:88/udp \
-p 127.0.0.1:464:464 \
-p 127.0.0.1:464:464/udp \
--rm --name kdc kdc || failed
docker run -d --tmpfs /tmp --tmpfs /run \
-v /sys/fs/cgroup:/sys/fs/cgroup:ro \
-v /etc/localtime:/etc/localtime:ro \
-v $PWD/internal/provider/testdata/named.conf.kerberos:/etc/named.conf:ro \
-p 127.0.0.1:53:53 \
-p 127.0.0.1:53:53/udp \
--rm --name ns --hostname ns.example.com ns || failed
echo "password" | kinit [email protected]
GO111MODULE=on GOFLAGS=-mod=vendor make testacc TEST=./internal/provider || failed
cleanup_docker

0 comments on commit a6225f2

Please sign in to comment.