🔐 HTTP Üzerinden TLS Kullanımı (Detaylı Türkçe Anlatım)
HTTP’nin Güvensizliği
Networking Core Protocols odasında gördüğümüz gibi, HTTP protokolü varsayılan olarak TCP üzerine kurulur ve 80 numaralı portu kullanır. Bu protokolde iletilen tüm veri paketleri şifrelenmeden, yani açık (plaintext) olarak gönderilir. Bu da, ağdaki herhangi biri tarafından kolayca yakalanıp izlenebileceği anlamına gelir. Aşağıdaki ekran görüntüsü, Wireshark adlı araçla kaydedilen bir HTTP trafiğini gösteriyor; burada istemci ile sunucu arasındaki tüm veri, okunabilir şekilde gözlemlenebilir.
HTTP Trafiği Nasıl İşler?
Bir web tarayıcısının bir web sayfası talep etmeden önce izlediği adımlar şunlardır:
-
Alan adını (domain) IP adresine çevirir (DNS çözümleme).
-
Hedef sunucuyla bir TCP üç yönlü el sıkışma (three-way handshake) kurar.
-
HTTP protokolü üzerinden iletişime geçer, örneğin
GET / HTTP/1.1
gibi bir istek gönderir.
Wireshark ekranında bu adımlar şöyle gözükür:
-
1 numara ile işaretlenen ilk üç paket, TCP el sıkışma paketleridir.
-
2 numaralı kısımda HTTP iletişimi başlar.
-
Son üç paket ise TCP bağlantısının sonlandırılması içindir (3 numarayla gösterilir).
TLS ile HTTP (HTTPS) Nasıl Çalışır?
HTTPS (Hypertext Transfer Protocol Secure), HTTP’nin TLS (Transport Layer Security) ile şifrelenmiş halidir. Yani HTTPS, temel olarak "HTTP over TLS"tir. HTTPS ile bir sayfa istemek için şu adımlar izlenir:
-
TCP üç yönlü el sıkışması gerçekleştirilir.
-
TLS oturumu kurulur (şifreleme anlaşması yapılır).
-
HTTP protokolü ile veri alışverişi yapılır (
GET / HTTP/1.1
gibi).
Aşağıdaki ekran görüntüsünde:
-
1 numaralı kısımda TCP bağlantısı kurulur.
-
2 numarada istemci ve sunucu TLS oturumunu başlatmak ve yapılandırmak için birkaç paket alışverişinde bulunur.
-
3 numarada ise şifrelenmiş uygulama verileri gönderilir.
Wireshark bu veriyi “Application Data” olarak gösterir çünkü paketlerin şifreli olması nedeniyle içerik protokolü (HTTP, SMTP vs.) bilinemez.
Şifrelenmiş Trafik Neye Benzer?
TLS ile şifrelenmiş trafiğe baktığınızda, paketleri birleştirseniz bile anlaşılmaz bir karışıklık (gibberish) görürsünüz. Kırmızı istemciden çıkan, mavi sunucudan gelen veridir; ancak şifreleme anahtarı olmadan bu içeriğin ne olduğunu anlamak imkânsızdır.
Şifreleme Anahtarını Alırsanız Ne Olur?
Normalde TLS oturumlarındaki şifreleme anahtarlarına erişiminiz olmaz. Ancak istisnai durumlarda (örneğin test ortamlarında), şifre çözme anahtarını Wireshark'a vererek trafiği çözümlemek mümkündür. Bu durumda:
-
TCP ve TLS el sıkışmaları aynıdır.
-
Ama artık HTTP içeriğini de görebilirsiniz (örneğin istemcinin
GET
isteği gibi).
Aşağıdaki ekran görüntüsünde bu çözülmüş hali görebilirsiniz; artık HTTPS trafiği şifreli olsa da Wireshark üzerinden okunabilir durumdadır.
Ana Fikir
TLS, HTTP protokolüne güvenlik eklerken TCP ya da IP gibi alt katmanlara herhangi bir değişiklik getirmez. Yani sistemin altyapısı aynen kalır; sadece HTTP, TLS üzerinden gönderilir. Bu da protokol katmanlarının birbirinden bağımsızlığına güzel bir örnektir.
🔐 HTTP Over TLS (Expanded English Translation)
The Insecurity of HTTP
As we learned in the Networking Core Protocols room, HTTP runs over TCP and uses port 80 by default. All HTTP traffic is sent in plaintext—meaning it can be intercepted and read by anyone on the network. The screenshot below, taken using Wireshark, shows how easily an attacker can observe every piece of communication between the client and the server in plain English.
How HTTP Communication Works
Before a web browser can request a web page over HTTP, the following steps occur:
-
The domain name is resolved to an IP address (DNS resolution).
-
A TCP three-way handshake is established with the target server.
-
Communication occurs over the HTTP protocol (e.g., sending a
GET / HTTP/1.1
request).
In the Wireshark screenshot:
-
Step 1 is the TCP handshake (first three packets).
-
Step 2 marks the beginning of HTTP communication.
-
The final three packets show the termination of the TCP connection.
How TLS Works With HTTP (HTTPS)
HTTPS stands for Hypertext Transfer Protocol Secure—it’s just HTTP layered over TLS. The steps to request a page over HTTPS are:
-
Establish a TCP three-way handshake.
-
Set up a TLS session (encryption negotiation).
-
Begin communicating over HTTP (e.g.,
GET / HTTP/1.1
).
In the Wireshark trace:
-
Step 1 is the TCP session (marked 1).
-
Step 2 is the TLS negotiation (marked 2).
-
Step 3 is encrypted HTTP application data (marked 3).
Since the traffic is encrypted, Wireshark can’t show protocol-level details and labels it as “Application Data”.
What Encrypted Traffic Looks Like
Trying to follow the stream of HTTPS packets will only reveal unreadable gibberish. In Wireshark:
-
Red text represents data sent by the client.
-
Blue text represents data from the server.
Without the encryption key, you can’t make sense of any of it.
Decrypting the Traffic (If You Have the Key)
Typically, you don’t have access to TLS session keys. But in controlled environments, if you feed Wireshark the private key, it can decrypt the traffic.
-
The TCP and TLS handshakes stay unchanged.
-
But now, you can see the actual HTTP content (e.g., the
GET
request).
The decrypted screenshot now reveals regular HTTP requests and responses—but protected from prying eyes by TLS.
The Takeaway
TLS adds a secure layer to HTTP without requiring any modification to the underlying layers like TCP or IP. It simply sits between the transport and application layers, enabling secure communication without disrupting the existing networking infrastructure.