12. Domains and DNS: GoDaddy, Elastic IP, A/CNAME and Subdomains
Chala mitrano, aata aapli website la ek naav deuya! http://203.0.113.10 koni lakshat thevat nahi – yourdomain.com thevtat. Aaj aapan DNS records punha nit baghu, GoDaddy var domain kasa ghyaycha, Elastic IP ka lagto, A aani CNAME records kase banvayche, aani subdomains kase banvayche he step by step karu. Security chya drushtine pan he khup mahatvacha aahe – recon madhe attackers sarvaat aadhi subdomains shodhtat. Ghabru naka, DNS disto tevdha avghad nahi.
What you will learn in this chapter
- DNS records every engineer must know, TTL and propagation
- Preparing the server: working site, Elastic IP and security group
- Buying a domain on GoDaddy (the UI may vary) and pointing it to EC2
- Optional: keeping DNS in Route 53
- Configuring the web server for the domain and verifying DNS with
dig - Creating subdomains for sites and backend apps
Concepts in this chapter
- 12.1DNS Records You Must Know
- 12.2Preparing the Server: Elastic IP and Security Group
- 12.3Buying a Domain on GoDaddy and Pointing It to EC2
- 12.4Optional: Keeping DNS in Route 53
- 12.5Configuring the Web Server for the Domain
- 12.6Verifying DNS with dig , nslookup and curl
- 12.7Subdomains
The chapter recap is at the end of the last concept page.
Chapter 12: Domains and DNS — practice tasks
Open chapter lessons · Full guided lab: check dns records dig nslookup (not repeated here)
12.1 Read DNS records of example.com
EasyITWhy: DNS tells you where a name points; wrong records cause outages and takeovers.
What: List A, AAAA, MX, NS and TXT for example.com.
How:
dig +short A example.com- Repeat for AAAA, MX, NS, TXT.
Expected output: IP addresses for A/AAAA, name servers for NS.
Hint
example.com is a reserved test domain — safe to query.
Answer / how to check
- Every record type returns or is empty; no errors.
12.2 Spot a dangling CNAME (paper task)
MediumRetailWhy: A CNAME pointing to a deleted cloud resource can be taken over.
What: Use the data file and mark risky records.
Data file: dns-records.csv
| Name | Type | Target | Target exists? |
|---|---|---|---|
| www | CNAME | shop.example.net | Yes |
| shop-old | CNAME | old-bucket.s3.amazonaws.com | No (deleted) |
| @ | A | 203.0.113.20 | Yes |
About this file: Made-up DNS records of a shop. Each row is one record. Columns: Name = sub-name; Type = record type; Target = where it points; Target exists? = whether that resource is still alive.
How:
- Read each row.
- Ask: does the target still exist?
- Mark Risky if target is deleted.
Expected output: shop-old is Risky; others OK.
Hint
Deleted bucket + live CNAME = takeover risk.
Answer / how to check
- Fix: delete the CNAME or recreate the resource.
12.3 Fake a domain locally with /etc/hosts
EasyLogisticsWhy: Testing on a local name avoids touching real domains.
What: Make track.lab point to 127.0.0.1.
How:
echo '127.0.0.1 track.lab' | sudo tee -a /etc/hostsping -c1 track.labcurl -I http://track.lab/(nginx running)- Remove the line afterwards.
Expected output: Ping replies from 127.0.0.1.
Hint
/etc/hosts is checked before DNS.
Answer / how to check
getent hosts track.labprints 127.0.0.1.
Extended teaching notes
Why this lesson matters
Use this lesson to strengthen systems you own: understand the risk, practise safely in a lab, then write and apply the fix.
Apply the fix across stacks
Same class of bug, same idea in every language.
Java / Spring Boot
Parameterise queries, encode output, CSRF tokens, limited Actuator, dependency scanning.
ASP.NET Core
EF Core / parameterised SQL, Razor encoding, HTTPS, Data Protection.
Node.js / Express
helmet, parameterised SQL, npm audit, avoid eval and shell concat.
Python / Django / Flask / FastAPI
ORM, autoescape, pip-audit, Bandit; never shell=True with user input.
PHP / Laravel
PDO/Eloquent, Blade escaping, composer audit.
Go / Ruby
database/sql placeholders / ActiveRecord; html/template / ERB escaping; govulncheck / Brakeman.
nginx / Apache / Tomcat
Hide versions, TLS, security headers, least-open ports.
MySQL / PostgreSQL / MongoDB / Redis
Private networks, auth on, least-privilege users, no 0.0.0.0/0.
AWS / Azure / GCP
Roles not long-lived keys, private data stores, cloud audit logs on.
Mini case study
Suppose we are on a purple-team exercise for an Indian mid-size company (sample data). Red notes a technique from this lesson against a lab clone. Blue must show the control that stops it, the log that would have fired, and the ticket that hardens production. That is the standard this course trains you for.
Defender's worksheet (do this today)
- Write the lesson title, date and the exact lab target you are allowed to use.
- List three owned systems (VMs, apps, or cloud accounts) where this lesson applies.
- Run one safe check from the lesson on a lab system only. Paste the command and output.
- Write a two-sentence fix you would give a teammate.
- Name one related public advisory (CERT-In, CISA, NVD, or a vendor bulletin) with its date.
Indian workplace (sample data)
Suppose we are a junior analyst at Infosys, TCS, Wipro or a fintech SOC in Bengaluru/Pune. Turn this lesson into one checklist item with an owner, a due date and a place to store evidence (ticket + screenshot).
Global practice
Compare your notes with OWASP, CIS Benchmarks, NIST CSF/IR guidance or a cloud Well-Architected security question. Write five lines on what overlaps.
Everyday analogy
Explain the risk and the fix to a family member without jargon. If they can repeat the warning, you understand it well enough to teach juniors.
Key terms
- Control: a safeguard (patch, config, process, detection).
- Finding: a weakness backed by evidence.
- Remediation: the fix plus how you verified it.
- Scope: systems you have written permission to touch.
- Least privilege: only the access the task needs.
- Defence in depth: several layers so one failure does not end the story.
Common mistakes
- Skipping written permission "just for a quick scan".
- Practising on hostel, office or public targets without authorisation.
- Collecting tool output without writing the fix.
- Copying attack steps onto production to "verify". Defenders verify with versions, configs and patches.
- Publishing screenshots that contain secrets, cookies or internal hostnames.
Recap
- Evidence, fix, owner, date.
- Own lab only.
- Fix > spectacle.