Sub topic 2
HTTP on Ports 80 and 443
Assume you know IP addresses, hosts, the client-server model, and how to run basic terminal commands. This chapter connects familiar application protocols to their transport ports.
HTTP on ports 80 and 443
HTTP is the application protocol used to request and deliver web resources. A client connects to a server's IP address and port. Port 80 is the conventional port for HTTP without encryption. Port 443 is the conventional port for HTTP protected by TLS, commonly called HTTPS.
TLS encrypts the connection and authenticates the server with a certificate. The port number does not provide encryption by itself. A service on port 443 must actually negotiate TLS to be secure.
Plain-text protocols and TLS variants
A plain-text protocol sends application data without encryption. A TLS variant wraps that protocol in an encrypted connection. The port often identifies the expected service, but it is only a convention.
| Service | Plain-text port | TLS-protected port |
|---|---|---|
| HTTP / HTTPS | 80 | 443 |
| SMTP / message submission | 25, 587 | 465 or STARTTLS |
| IMAP | 143 | 993 |
| POP3 | 110 | 995 |
SMTP transfers mail between servers and can also submit mail from a client. IMAP keeps mail on the server for synchronized access. POP3 usually downloads mail to a client.
> callout note > STARTTLS begins as a plain connection and then upgrades it to TLS. A client must verify that the upgrade succeeded and must validate the server certificate.
DNS: port 53 over UDP and TCP
DNS translates names such as example.com into IP addresses. DNS commonly uses UDP port 53 because ordinary queries are small and do not need a connection setup. TCP port 53 is used for zone transfers and for responses that do not fit safely in one UDP exchange. Modern DNS services can also use encrypted protocols such as DNS over TLS, usually on port 853.
Remote access ports
SSH uses TCP port 22 for encrypted remote shells, command execution, and secure file transfer. Telnet uses TCP port 23 and sends credentials and commands without protection, so it should not be used for administrative access. RDP, Microsoft's graphical remote desktop protocol, commonly uses TCP and UDP port 3389.
When writing firewall rules, allow only the remote-access ports required by the service, restrict their source networks, and prefer SSH or a protected RDP deployment over Telnet.
Exercise
Which port and protocol should a client normally use for an encrypted web connection?
Show answer
TCP port 443 using HTTPS, which carries HTTP through a TLS connection.