2. Ports and Protocols: SSH, HTTP, HTTPS, FTP/SFTP and DNS
2.4 HTTPS and TLS Basics – Port 443
HTTPS mhanje HTTP + TLS. TLS teen goshti deto: confidentiality (गोपनीयता – dusra vachu shakat nahi), integrity (अखंडता – madhe koni badal karu shakat nahi) aani server authentication (certificate mule "ha kharach example.com aahe").
Browser Server
| ClientHello (TLS versions, cipher suites, random) -->|
|<-- ServerHello + Certificate (public key, signed by CA)|
| Browser verifies certificate: name, expiry, CA chain |
| Key exchange (ECDHE) -> both derive the same |
| session key; no key is ever sent in clear |
|<========= encrypted HTTP (symmetric, e.g. AES-GCM) ===>|
| Term | Meaning |
|---|---|
| Certificate | Server's public key + domain name, signed by a Certificate Authority (CA) |
| CA | Trusted organisation that signs certificates (for example Let's Encrypt) |
| Symmetric encryption | Same key encrypts and decrypts – fast, used for the actual data |
| Asymmetric encryption | Public/private key pair – used for identity and key exchange |
| TLS 1.2 / 1.3 | Current secure versions; SSL 2/3 and TLS 1.0/1.1 are obsolete |
curl -vI https://example.com 2>&1 | grep -E "SSL|TLS|subject|expire"
openssl s_client -connect example.com:443 -servername example.com </dev/null | head -20
Why this matters for security
HTTPS protects data in transit, not the application itself – a site with a valid padlock can still have SQL injection. Expired or self-signed certificates train users to click through warnings, which is exactly what phishing and MITM attackers want. In Part 6 we add free certificates with Certbot.
Ravindra Bagale's Tip
Many students say "there's a padlock, so the website is safe". No, friends! The padlock only tells you the connection is encrypted. Phishing sites use HTTPS too. Read the domain name carefully – paypa1.com and paypal.com are different.
Ravindra Bagale's Tip – मराठी
बरेच students म्हणतात "padlock आहे म्हणजे website safe आहे". नाही मित्रांनो! Padlock फक्त connection encrypted आहे हे सांगतो. Phishing sites पण HTTPS वापरतात. Domain नाव नीट वाचा – paypa1.com आणि paypal.com मध्ये फरक आहे.
Ravindra Bagale's Tip – हिंदी
बहुत से students कहते हैं "padlock है तो website safe है". नहीं दोस्तों! Padlock सिर्फ़ यह बताता है कि connection encrypted है. Phishing sites भी HTTPS इस्तेमाल करती हैं. Domain name ध्यान से पढ़ो – paypa1.com और paypal.com में फ़र्क है.
Practice task
Run the openssl s_client command above against any public HTTPS site. Note the certificate subject, the issuer (CA) and the TLS version.
Extended teaching notes
Why this lesson matters
Cryptography fails when people invent it. Use standard libraries, modern algorithms (AES-GCM, TLS 1.2+, bcrypt/argon2) and protect keys in a KMS or secrets manager.
Where crypto shows up
[('Passwords', 'bcrypt/argon2/PBKDF2 via the framework hasher — never plain MD5/SHA1.'), ('TLS', "Terminate on ALB/nginx with ACM/Let's Encrypt; redirect HTTP to HTTPS."), ('JWT / API tokens', 'Short lifetime, rotate signing keys, store secrets outside Git.'), ('Disk / S3', 'Provider or customer-managed keys; least privilege on decrypt.')]
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.