Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

merkez/knxn-challenge

Folders and files

NameName
Last commit message
Last commit date

Latest commit

History

8 Commits

Repository files navigation

Kinexon custom DNS challenge

The challenge description was mentioning about creating a VM for DNS queries, however I preferred to do it through CoreDNS Docker image.

What does this mini script do ?

  • Fetches data from given endpoint
  • Formats data as requested
  • Creates zone and Core files for CoreDNS
  • Launchs a bash command through subprocess library of Python

Since I did not use any VM to complete the task, host command cannot work as wanted. Instead, I tested the automated script through dig tool.

How to run

This is pretty straightforward, it is just python3 main.py, however in case your environment is missing python or requests libraries, it may not work as expected.

In case you need to install requests lib :

$ pip3 install requests

OR

$ pip3 install -r requirements.txt

Demo


asciicast

Once Python script executed, it will automatically create zone and core files along running coredns image with custom settings.

The DNS Server can be tested through dig command as shown below.

Testing the script

  • Assuming that ./main.py file is run before using dig command
$ dig @172.17.0.2 customer-one.vpn.knx
; <<>> DiG 9.16.1-Ubuntu <<>> @172.17.0.2 customer-one.vpn.knx
; (1 server found)
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 6695
;; flags: qr aa rd; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 1
;; WARNING: recursion requested but not available

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 4096
; COOKIE: 9c151ecbd69ad1bf (echoed)
;; QUESTION SECTION:
;customer-one.vpn.knx.		IN	A

;; ANSWER SECTION:
customer-one.vpn.knx.	3600	IN	A	10.0.200.1

;; Query time: 0 msec
;; SERVER: 172.17.0.2#53(172.17.0.2)
;; WHEN: Mon Nov 22 16:47:44 UTC 2021
;; MSG SIZE rcvd: 97

NOTE: This is just a PROOF OF CONCEPT solution as the task is requested, so, it is NOT a perfect or optimum solution.

Since following example is provided in the challenge desc and there was no further information about the rest of the subnet which is left from each customer, I manipulated the data as expected from challenge description by considering the given assumption below.

 {"name": "customer-one", "subnet": "10.0.200.0/24"},
 the DNS server should resolve customer-one.vpn.knx to 10.0.200.1

The only difference between what the challenge desc requested and what I provided, is Docker component instead of VM and dig instead of host command.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

Contributors

Languages

AltStyle によって変換されたページ (->オリジナル) /