Skip to content

Additional domains (DNS)

mgmschoene edited this page Nov 18, 2020 · 6 revisions

Usually our test cases target sites of a subdomain of test-canitrust.com. However, some test cases might require access to additional hosts. It is possible to add new hosts to the DNS container. In the DNS folder of the CIT backend you find the following files:

ls -la ./dns
total 28
drwxr-xr-x 2 mschoene domain^users 4096 Nov  9 14:54 ./
drwxr-xr-x 9 mschoene domain^users 4096 Nov  9 14:54 ../
-rw-r--r-- 1 mschoene domain^users  337 Nov  9 14:54 alternative-canitrust.com
-rw-r--r-- 1 mschoene domain^users  228 Nov  9 14:54 Corefile
-rw-r--r-- 1 mschoene domain^users  191 Nov  9 14:54 Dockerfile
-rw-r--r-- 1 mschoene domain^users  301 Nov  9 14:54 noexample.mgm
-rw-r--r-- 1 mschoene domain^users  323 Nov  9 14:54 test-canitrust.com

The Corefile contains the registered hosts:

cat ./dns/Corefile 
noexample.mgm {
    file noexample.mgm
    log
}

test-canitrust.com {
    file test-canitrust.com
    log
}

alternative-canitrust.com {
    file alternative-canitrust.com
    log
}

. {
    forward . /etc/resolv.conf
    log
}             

If you want to add an additional host, create another entry here, as done for alternative-canitrust.com.

Furthermore, you must create a file with the name of your new host. The file must have the following content:

cat ./dns/alternative-canitrust.com
$TTL	604800
@	IN	SOA	localhost. root.localhost. (
			      2		; Serial
			 604800		; Refresh
			  86400		; Retry
			2419200		; Expire
			 604800 )	; Negative Cache TTL
;
@	IN	NS	localhost.
; name servers - A records
alternative-canitrust.com.          IN      CNAME test_app.
*.alternative-canitrust.com.          IN      CNAME test_app.

As a last step, add a new COPY command to the dns/Dockerfile, which copies your new DNS file to the docker container:

FROM coredns/coredns:1.6.4

COPY Corefile ./Corefile
COPY noexample.mgm ./noexample.mgm
COPY test-canitrust.com ./test-canitrust.com
COPY alternative-canitrust.com ./alternative-canitrust.com

Note: The wildcard TLS certificate supported by CIT is only valid for subdomains of test-canitrust.com. Furthermore, we would like to keep as much tests as possible working under test-canitrust.com for the sake of clarity.