<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Noufal Ibrahim</title>
    <description>The latest articles on DEV Community by Noufal Ibrahim (@nibrahim).</description>
    <link>https://dev.to/nibrahim</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F967409%2F23e04f2f-7e4f-44e8-a720-4bd3c15873ac.png</url>
      <title>DEV Community: Noufal Ibrahim</title>
      <link>https://dev.to/nibrahim</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/nibrahim"/>
    <language>en</language>
    <item>
      <title>HTTPS and HTTP</title>
      <dc:creator>Noufal Ibrahim</dc:creator>
      <pubDate>Fri, 13 Nov 2026 06:46:57 +0000</pubDate>
      <link>https://dev.to/nibrahim/https-and-http-15f3</link>
      <guid>https://dev.to/nibrahim/https-and-http-15f3</guid>
      <description>&lt;h2&gt;
  
  
  &lt;strong&gt;TL;DR&lt;/strong&gt;
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;HTTP is plain text. Anyone on the path can read and change the URL, the cookies and the page.&lt;/li&gt;
&lt;li&gt;HTTPS encrypts all of that, and a certificate signed by a trusted CA proves you reached the right server.&lt;/li&gt;
&lt;li&gt;The server name, the IP address and the DNS lookup still travel in the clear, and the trust is only as good as the CAs on the list.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Given the recent certificate scandal with eMudhra, HTTPS is in the news. This has some special significance to a domain blocker like &lt;a href="https://glockerapp.com/?ref=devto-https" rel="noopener noreferrer"&gt;glocker&lt;/a&gt; that runs on your own machine. Let's discuss what HTTPS is in this article. In part 2, we'll talk about the significance for glocker. &lt;br&gt;
Let's walk through what happens using a few basic commands on the shell. &lt;code&gt;nc&lt;/code&gt; (netcat) opens a raw network connection and passes along whatever you type, adding nothing of its own, so it lets us play the part of the browser or the server by hand. &lt;code&gt;curl&lt;/code&gt; is a command-line client that builds requests the way a browser does and prints what comes back. Later on, &lt;code&gt;openssl&lt;/code&gt; handles the encrypted part. So, shut down your agents, open up a terminal and follow along. &lt;/p&gt;
&lt;h2&gt;
  
  
  Plain HTTP
&lt;/h2&gt;

&lt;p&gt;HTTP is plain text, so you can type it by hand. Connect to example.com on port 80, the HTTP port, and you're talking directly to its web server. &lt;/p&gt;

&lt;p&gt;Let's play the part of the browser. Start &lt;code&gt;nc&lt;/code&gt; as a client and point it at example.com's port 80.&lt;/p&gt;

&lt;p&gt;Type the two lines below, then press Enter once more on an empty line.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight console"&gt;&lt;code&gt;$ nc example.com 80
GET / HTTP/1.1
Host: example.com

HTTP/1.1 200 OK
Date: Wed, 11 Nov 2026 08:34:16 GMT
Content-Type: text/html&lt;span class="o"&gt;;&lt;/span&gt; &lt;span class="nv"&gt;charset&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;utf-8
Server: cloudflare
...

&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;!doctype html&lt;span class="o"&gt;&amp;gt;&amp;lt;&lt;/span&gt;html &lt;span class="nv"&gt;lang&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;en&lt;span class="o"&gt;&amp;gt;&amp;lt;&lt;/span&gt;head&lt;span class="o"&gt;&amp;gt;&amp;lt;&lt;/span&gt;meta &lt;span class="nv"&gt;charset&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;utf-8&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;...&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;title&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;Example Domain&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;/title&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That's the whole protocol. The first line says what you want, the &lt;code&gt;Host&lt;/code&gt; header says which site, the empty line ends the request, and the page comes back. The server keeps the connection open for another request, so press Ctrl-C to leave.&lt;/p&gt;

&lt;p&gt;Now, let's play the part of the server and start &lt;code&gt;nc&lt;/code&gt; in listening mode using &lt;code&gt;-l&lt;/code&gt;. We'll make it listen on port 8080 on our own machine and point an actual HTTP client at it. We'll use &lt;code&gt;curl&lt;/code&gt;. Try the commands below.&lt;/p&gt;

&lt;p&gt;Run &lt;code&gt;nc&lt;/code&gt; in listening mode and point &lt;code&gt;curl&lt;/code&gt; at it. &lt;code&gt;--resolve&lt;/code&gt; tells curl that &lt;code&gt;shop.example&lt;/code&gt; lives at 127.0.0.1, so it connects to our listener while thinking it's talking to a shop:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight console"&gt;&lt;code&gt;$ nc -l 127.0.0.1 8080
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight console"&gt;&lt;code&gt;$ curl -b &lt;span class="s1"&gt;'session=4f9a2c'&lt;/span&gt; &lt;span class="s1"&gt;'http://shop.example:8080/account/orders?card=last4'&lt;/span&gt; \
       --resolve shop.example:8080:127.0.0.1
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The listener prints:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;GET /account/orders?card=last4 HTTP/1.1
Host: shop.example:8080
User-Agent: curl/8.14.1
Accept: */*
Cookie: session=4f9a2c
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;An HTTP request is like a postcard. It passes through many hands on its way, and anyone who handles it can read what's written on it, or rewrite it before passing it on.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fqbel28nzlixozjjdxtyy.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fqbel28nzlixozjjdxtyy.png" alt="Over HTTP the request travels readable through the wifi and every network in between, and any of them can change it on the way." width="800" height="200"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;Plain HTTP&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;The page you asked for, the query string and the session cookie are all there in plain text. The listener here is on your own machine, but your wifi, your ISP and every network in between see exactly the same bytes. They can also change the response on its way back to you.&lt;/p&gt;

&lt;p&gt;Now, imagine you're in a hotel or an untrusted network. You would typically access sites through a proxy server. In theory, these should just route your traffic and the responses but that's a matter of trusting them. A malicious proxy could alter the contents returned by a site to trick you. Here's what a setup would look like.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F8mri7hq8qxfzyd9q864e.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F8mri7hq8qxfzyd9q864e.png" alt="The browser sends its request to a proxy, which keeps a copy and forwards it to example.com. The reply comes back through the proxy, which changes Example Domain to Changed Domain before the browser sees it." width="800" height="280"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;A man in the middle&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;These are called man in the middle (or MITM) attacks. We can simulate this by making one instance of nc behave like a proxy. It will listen on port 8080 and forward everything to &lt;code&gt;example.com&lt;/code&gt; while keeping a copy in &lt;code&gt;request.txt&lt;/code&gt;. On the way back it runs the reply through &lt;code&gt;sed&lt;/code&gt;, which swaps one phrase for another. &lt;code&gt;reply&lt;/code&gt; is a named pipe that carries the answer back to the listener:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight console"&gt;&lt;code&gt;$ mkfifo reply
$ nc -l 127.0.0.1 8080 &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; reply &lt;span class="o"&gt;|&lt;/span&gt; tee request.txt &lt;span class="o"&gt;|&lt;/span&gt; nc example.com 80 \
    &lt;span class="o"&gt;|&lt;/span&gt; sed -u &lt;span class="s1"&gt;'s/Example Domain/Changed Domain/'&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; reply
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In a second terminal, ask curl to use it as a proxy, the way a browser on a company or hotel network often does:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight console"&gt;&lt;code&gt;$ curl -s -x http://127.0.0.1:8080 http://example.com/
&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;!doctype html&lt;span class="o"&gt;&amp;gt;&amp;lt;&lt;/span&gt;html &lt;span class="nv"&gt;lang&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;en&lt;span class="o"&gt;&amp;gt;&amp;lt;&lt;/span&gt;head&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;...&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;title&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;Changed Domain&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;/title&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;...
$ cat request.txt
GET http://example.com/ HTTP/1.1
Host: example.com
User-Agent: curl/8.14.1
Accept: */*
Proxy-Connection: Keep-Alive
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The proxy saw the whole request, and the page curl received is not the one example.com sent. Nothing in the reply shows it was changed. The replacement here is the same length as the original so the byte counts in the response still add up; a real attacker would take care of that too.&lt;/p&gt;

&lt;p&gt;When HTTP was designed at CERN in 1990–91, none of this mattered much. The web was a way for physicists to share documents. The network was mostly universities and research labs, there were no logins, payments or private pages, and nobody had much reason to tamper with the traffic. That changed once people started shopping, banking and logging in on the web, and once traffic began passing through networks you don't control, like coffee-shop wifi. Anyone along the way could read passwords and session cookies. In 2010 a Firefox add-on called Firesheep showed this to everyone: it let anyone on a shared wifi network take over other people's Facebook and Twitter sessions with a click. Networks also changed what they carried. Some ISPs inserted their own ads and notices into pages. And nothing told you whether the reply really came from the site you asked for. Netscape added SSL to its browser in the mid-1990s so people could shop safely online, and TLS replaced SSL in 1999.&lt;/p&gt;

&lt;h2&gt;
  
  
  HTTPS
&lt;/h2&gt;

&lt;p&gt;To solve this snooping problem, HTTPS was invented. It has two jobs.&lt;/p&gt;

&lt;p&gt;The first is encryption: scrambling the data so that only someone with the right key can unscramble it. The problem is that the browser and the server have never met, so they have no key in common, and anything they say to agree on one can be overheard. This is a larger topic, but the gist of it is that each side keeps a secret of its own and sends the other a value made from it. By combining its own secret with what the other side sent, each side arrives at the same key. Someone who overheard both values can't, because they don't have either secret. This is called a key exchange.&lt;/p&gt;

&lt;p&gt;The second is identity. An encrypted connection is no use if it's to the wrong server. So the server shows a certificate, which works like an ID card: it says "this server is example.com". Anyone can print a card like that, so someone trusted has to vouch for it. A certificate authority (CA) is an organisation that checks that whoever asks for a certificate really controls the website, and then signs it. Only the CA can make its signature, because it needs a secret called the CA's private key, but anyone can check it. Your operating system comes with a list of CAs it trusts, and your browser accepts a certificate signed by any of them.&lt;/p&gt;

&lt;p&gt;TLS (Transport Layer Security) is the set of rules for doing both jobs, and HTTPS is plain HTTP sent through a TLS connection. A TLS connection starts with a handshake, an exchange of messages in which the two sides agree on how to encrypt, do the key exchange, and check the certificate. No HTTP is sent until the handshake is done. The browser opens the handshake with a message called the &lt;code&gt;ClientHello&lt;/code&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  The same request over HTTPS
&lt;/h2&gt;

&lt;p&gt;Now do the same with HTTPS. Start the listener on another port, save what arrives, and point curl at it:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight console"&gt;&lt;code&gt;$ nc -l 127.0.0.1 8443 &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; capture.bin
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Unlike the earlier example, we're dumping our output into a file so that we can look at it later. It will shortly become obvious why.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight console"&gt;&lt;code&gt;$ curl -b &lt;span class="s1"&gt;'session=4f9a2c'&lt;/span&gt; &lt;span class="s1"&gt;'https://shop.example:8443/account/orders?card=last4'&lt;/span&gt; \
       --resolve shop.example:8443:127.0.0.1
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Notice the &lt;em&gt;s&lt;/em&gt; in the scheme: &lt;code&gt;https&lt;/code&gt; instead of &lt;code&gt;http&lt;/code&gt;. &lt;code&gt;--resolve&lt;/code&gt; works as before: curl believes it is connecting to &lt;code&gt;shop.example&lt;/code&gt; on port 8443, but the connection goes to our listener on 127.0.0.1, and curl still puts &lt;code&gt;shop.example&lt;/code&gt; in the ClientHello.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;nc&lt;/code&gt; doesn't speak TLS, so curl sends its &lt;code&gt;ClientHello&lt;/code&gt; and waits for a reply that never comes. &lt;code&gt;capture.bin&lt;/code&gt; is not even a text file. Here's what it looks like.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight console"&gt;&lt;code&gt;$ xxd capture.bin &lt;span class="o"&gt;|&lt;/span&gt; head -14
00000000: 1603 0106 1f01 0006 1b03 03a2 7655 9139  ............vU.9
00000010: 30e7 ee9a 68ac c99a 9f7f f045 ab30 ce1d  0...h......E.0..
...
00000090: 0001 0000 0000 1100 0f00 000c 7368 6f70  ............shop
000000a0: 2e65 7861 6d70 6c65 000b 0004 0300 0102  .example........
000000b0: 000a 0012 0010 11ec 001d 0017 001e 0018  ................
000000c0: 0019 0100 0101 0010 000e 000c 0268 3208  .............h2.
000000d0: 6874 7470 2f31 2e31 0016 0000 0017 0000  http/1.1........
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;We can also do a crude inspection to see if there's anything readable inside this file.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ strings -n 6 capture.bin
shop.example
http/1.1
...
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;What we captured is curl's ClientHello. Here's a breakdown:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Bytes&lt;/th&gt;
&lt;th&gt;Field&lt;/th&gt;
&lt;th&gt;What curl sent&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;0–4&lt;/td&gt;
&lt;td&gt;Record header&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;16 03 01 06 1f&lt;/code&gt;: a handshake record, 1,567 bytes follow&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;5–8&lt;/td&gt;
&lt;td&gt;Handshake header&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;01 00 06 1b&lt;/code&gt;: type 1, ClientHello, 1,563 bytes&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;9–10&lt;/td&gt;
&lt;td&gt;Version&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;03 03&lt;/code&gt;, TLS 1.2. Kept for old middleboxes; the real versions are in an extension below&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;11–42&lt;/td&gt;
&lt;td&gt;Random&lt;/td&gt;
&lt;td&gt;32 random bytes&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;43–75&lt;/td&gt;
&lt;td&gt;Session ID&lt;/td&gt;
&lt;td&gt;32 more bytes, also for compatibility&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;76–137&lt;/td&gt;
&lt;td&gt;Cipher suites&lt;/td&gt;
&lt;td&gt;30 encryption methods curl accepts, best first: &lt;code&gt;13 02&lt;/code&gt; is TLS_AES_256_GCM_SHA384&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;138–139&lt;/td&gt;
&lt;td&gt;Compression&lt;/td&gt;
&lt;td&gt;none&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;140 onwards&lt;/td&gt;
&lt;td&gt;Extensions&lt;/td&gt;
&lt;td&gt;1,430 bytes, the interesting part:&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;server_name (SNI)&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;shop.example&lt;/code&gt;, in plain text&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;supported_groups&lt;/td&gt;
&lt;td&gt;the key exchange methods: X25519MLKEM768, X25519, P-256 and others&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;ALPN&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;h2&lt;/code&gt;, &lt;code&gt;http/1.1&lt;/code&gt;: what curl can speak once the connection is up&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;signature_algorithms&lt;/td&gt;
&lt;td&gt;which signatures curl can check on the certificate&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;supported_versions&lt;/td&gt;
&lt;td&gt;TLS 1.3 and TLS 1.2&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;key_share&lt;/td&gt;
&lt;td&gt;1,258 bytes: curl's half of the key exchange (1,216 bytes for X25519MLKEM768, 32 for X25519)&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;This is the &lt;code&gt;ClientHello&lt;/code&gt;, the first message of a TLS connection. &lt;code&gt;16&lt;/code&gt; marks a handshake record and the &lt;code&gt;01&lt;/code&gt; a few bytes later says it's a ClientHello. The rest is a list of what curl supports: TLS versions, ciphers, and &lt;code&gt;h2&lt;/code&gt; and &lt;code&gt;http/1.1&lt;/code&gt; as the protocols it can speak afterwards. Most of the 1,572 bytes are curl's half of the key exchange, which is why it looks like noise.&lt;/p&gt;

&lt;p&gt;The path, the query string and the cookie aren't in there at all. They haven't been encrypted yet. They haven't been sent. Over HTTPS, the browser doesn't send the request until the handshake has finished and both sides share a key.&lt;/p&gt;

&lt;p&gt;One thing is readable, though: &lt;code&gt;shop.example&lt;/code&gt;. That's the SNI field, short for Server Name Indication. One IP address often serves many websites, and the server has to know which one you want before it can show the right certificate, so the name goes out before anything is encrypted. Keep it in mind. It comes up again in part 2.&lt;/p&gt;

&lt;h2&gt;
  
  
  Doing the handshake properly
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;nc&lt;/code&gt; can't talk to an HTTPS server, because the server expects a TLS handshake before anything else. &lt;code&gt;openssl s_client&lt;/code&gt; is a TLS client for the terminal. It connects, does the handshake, checks the certificate and prints a short summary. After that it behaves like &lt;code&gt;nc&lt;/code&gt;: what you type is encrypted and sent, and what comes back is decrypted and printed. &lt;code&gt;-servername&lt;/code&gt; sets the SNI field, and &lt;code&gt;-brief&lt;/code&gt; keeps the summary short.&lt;/p&gt;

&lt;p&gt;Connect, wait for the summary, then type the same two lines as before and an empty line:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight console"&gt;&lt;code&gt;$ openssl s_client -connect example.com:443 -servername example.com -brief
Connecting to 104.20.23.154
CONNECTION ESTABLISHED
Protocol version: TLSv1.3
Ciphersuite: TLS_AES_256_GCM_SHA384
Peer certificate: &lt;span class="nv"&gt;CN&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;example.com
Hash used: SHA256
Signature type: ecdsa_secp256r1_sha256
Verification: OK
Negotiated TLS1.3 group: X25519MLKEM768
GET / HTTP/1.1
Host: example.com

HTTP/1.1 200 OK
Content-Type: text/html&lt;span class="o"&gt;;&lt;/span&gt; &lt;span class="nv"&gt;charset&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;utf-8
...
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The request is identical to the one we sent with &lt;code&gt;nc&lt;/code&gt;. The only difference is the layer underneath. &lt;code&gt;Verification: OK&lt;/code&gt; means the certificate checked out.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;curl -v&lt;/code&gt; shows the steps of the handshake as they happen:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;* TLSv1.3 (OUT), TLS handshake, Client hello (1):
* TLSv1.3 (IN), TLS handshake, Server hello (2):
* TLSv1.3 (IN), TLS change cipher, Change cipher spec (1):
* TLSv1.3 (IN), TLS handshake, Encrypted Extensions (8):
* TLSv1.3 (IN), TLS handshake, Certificate (11):
* TLSv1.3 (IN), TLS handshake, CERT verify (15):
* TLSv1.3 (IN), TLS handshake, Finished (20):
* TLSv1.3 (OUT), TLS change cipher, Change cipher spec (1):
* TLSv1.3 (OUT), TLS handshake, Finished (20):
&amp;gt; GET / HTTP/2
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fl70dq21ld6lmi4d6bel8.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fl70dq21ld6lmi4d6bel8.png" alt="Sequence diagram: the browser says hello and names the site, the server replies with its certificate, the browser checks it, both sides arrive at a shared key, and everything after that is encrypted." width="800" height="800"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;How an HTTPS connection starts&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;The ClientHello carries curl's half of the key exchange, and the server's reply, the ServerHello, carries the other half. From the two, both sides calculate the same key, as described earlier. There are several mathematical methods for this. The &lt;code&gt;Negotiated TLS1.3 group&lt;/code&gt; line from &lt;code&gt;s_client&lt;/code&gt; names the one used here, &lt;code&gt;X25519MLKEM768&lt;/code&gt;, which is two methods combined: an older one called X25519 and a newer one called ML-KEM. ML-KEM is designed to stay safe against quantum computers, which could one day break the older methods. Its values are much larger, which is why curl's half took up most of those 1,572 bytes.&lt;/p&gt;

&lt;p&gt;Everything after the Server hello is encrypted, including the server's certificate. &lt;code&gt;&amp;gt; GET /&lt;/code&gt; only appears at the very end, after both sides have sent Finished. (curl picked HTTP/2 here, using the &lt;code&gt;h2&lt;/code&gt; it offered in the ClientHello.)&lt;/p&gt;

&lt;h2&gt;
  
  
  The certificate says who you're talking to
&lt;/h2&gt;

&lt;p&gt;Encryption on its own isn't enough. If someone gets your traffic to the wrong server, through a fake wifi network or a poisoned DNS answer, you'd have a perfectly encrypted connection to the wrong party. The certificate is what prevents that. Here's example.com's:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight console"&gt;&lt;code&gt;$ openssl s_client -connect example.com:443 -servername example.com &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;/dev/null 2&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;/dev/null \
    &lt;span class="o"&gt;|&lt;/span&gt; openssl x509 -noout -subject -issuer -dates -ext subjectAltName
&lt;span class="nv"&gt;subject&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nv"&gt;CN&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;example.com
&lt;span class="nv"&gt;issuer&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nv"&gt;C&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;US, &lt;span class="nv"&gt;O&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;SSL Corporation, &lt;span class="nv"&gt;CN&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;Cloudflare TLS Issuing ECC CA 3
&lt;span class="nv"&gt;notBefore&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;Sep 26 22:49:11 2026 GMT
&lt;span class="nv"&gt;notAfter&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;Dec 25 22:56:35 2026 GMT
X509v3 Subject Alternative Name:
    DNS:example.com, DNS:*.example.com
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;It names the sites it covers, it expires in 90 days, and it was signed by an issuer, Cloudflare TLS Issuing ECC CA 3. That issuer isn't on your system's list of trusted CAs. A CA's most valuable key is the one behind the certificate on that list, called its root. CAs keep it locked away offline and use it only to sign certificates for a few intermediate CAs, which do the day-to-day signing. So the server sends its own certificate along with the intermediate ones, and the browser follows the signatures from one to the next until it reaches a root it trusts. This is the chain. &lt;code&gt;-showcerts&lt;/code&gt; prints it, with each certificate's subject (&lt;code&gt;s:&lt;/code&gt;) and issuer (&lt;code&gt;i:&lt;/code&gt;):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight console"&gt;&lt;code&gt;$ openssl s_client -connect example.com:443 -servername example.com -showcerts &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;/dev/null
 0 s:CN=example.com
   i:C=US, &lt;span class="nv"&gt;O&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;SSL Corporation, &lt;span class="nv"&gt;CN&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;Cloudflare TLS Issuing ECC CA 3
 1 s:C=US, &lt;span class="nv"&gt;O&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;SSL Corporation, &lt;span class="nv"&gt;CN&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;Cloudflare TLS Issuing ECC CA 3
   i:C=US, &lt;span class="nv"&gt;O&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;SSL Corporation, &lt;span class="nv"&gt;CN&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;SSL.com TLS Transit ECC CA R2
 2 s:C=US, &lt;span class="nv"&gt;O&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;SSL Corporation, &lt;span class="nv"&gt;CN&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;SSL.com TLS Transit ECC CA R2
   i:C=US, &lt;span class="nv"&gt;O&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;SSL Corporation, &lt;span class="nv"&gt;CN&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;SSL.com TLS ECC Root CA 2022
 3 s:C=US, &lt;span class="nv"&gt;O&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;SSL Corporation, &lt;span class="nv"&gt;CN&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;SSL.com TLS ECC Root CA 2022
   i:C=GB, &lt;span class="nv"&gt;ST&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;Greater Manchester, &lt;span class="nv"&gt;L&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;Salford, &lt;span class="nv"&gt;O&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;Comodo CA Limited, &lt;span class="nv"&gt;CN&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;AAA Certificate Services
Verify &lt;span class="nb"&gt;return&lt;/span&gt; code: 0 &lt;span class="o"&gt;(&lt;/span&gt;ok&lt;span class="o"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Certificate 2 was issued by SSL.com TLS ECC Root CA 2022, which is on the list, so the chain is trusted. (The server also sends that root signed by an older Comodo root, for devices whose list is too old to have the new one.) On Debian, the list is a directory of files:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight console"&gt;&lt;code&gt;$ ls /etc/ssl/certs/*.pem &lt;span class="o"&gt;|&lt;/span&gt; wc -l
164
$ ls /etc/ssl/certs &lt;span class="o"&gt;|&lt;/span&gt; grep -i ssl.com_tls
SSL.com_TLS_ECC_Root_CA_2022.pem
SSL.com_TLS_RSA_Root_CA_2022.pem
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Firefox ships its own list, and Chrome uses its own root store. Either way, the check is the same. The name must match, the dates must be valid, every signature up the chain must verify, and the top must be on the list. Finally, the server has to sign the handshake with the private key that matches its certificate. That's the CERT verify step above. The certificate itself is public, so anyone can copy it. Only the real server holds the key.&lt;/p&gt;

&lt;h2&gt;
  
  
  Watching a counterfeit fail
&lt;/h2&gt;

&lt;p&gt;Let's build a counterfeit example.com. Anyone can make a certificate that says &lt;code&gt;example.com&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight console"&gt;&lt;code&gt;$ openssl req -x509 -newkey ec -pkeyopt ec_paramgen_curve:P-256 -nodes \
    -keyout fake.key -out fake.crt -days 30 \
    -subj /CN=example.com -addext &lt;span class="nv"&gt;subjectAltName&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;DNS:example.com
$ openssl s_server -accept 8443 -cert fake.crt -key fake.key
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;-newkey&lt;/code&gt; makes the private key, which is just a random 256-bit number saved in &lt;code&gt;fake.key&lt;/code&gt;. Yours will be different:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight console"&gt;&lt;code&gt;$ openssl pkey -in fake.key -text -noout &lt;span class="o"&gt;|&lt;/span&gt; head -5
Private-Key: &lt;span class="o"&gt;(&lt;/span&gt;256 bit&lt;span class="o"&gt;)&lt;/span&gt;
priv:
    6a:98:5b:23:d3:bb:50:40:92:6b:f8:24:e7:8d:77:
    a7:80:ab:d7:a1:79:17:33:62:bd:43:28:45:4b:97:
    0d:4f
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The certificate holds the matching public key and is signed with this private key, by itself. That's what "self-signed" means below.&lt;/p&gt;

&lt;p&gt;Then point curl at it, with &lt;code&gt;--resolve&lt;/code&gt; playing the part of a poisoned DNS answer:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight console"&gt;&lt;code&gt;$ curl -b &lt;span class="s1"&gt;'session=4f9a2c'&lt;/span&gt; https://example.com:8443/login \
       --resolve example.com:8443:127.0.0.1
curl: &lt;span class="o"&gt;(&lt;/span&gt;60&lt;span class="o"&gt;)&lt;/span&gt; SSL certificate problem: self-signed certificate
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The verbose log shows where it stopped:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;* TLSv1.3 (OUT), TLS handshake, Client hello (1):
* TLSv1.3 (IN), TLS handshake, Server hello (2):
* TLSv1.3 (IN), TLS change cipher, Change cipher spec (1):
* TLSv1.3 (IN), TLS handshake, Encrypted Extensions (8):
* TLSv1.3 (IN), TLS handshake, Certificate (11):
* TLSv1.3 (OUT), TLS alert, unknown CA (560):
* SSL certificate problem: self-signed certificate
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The name on the certificate matched, but no CA on the list signed it, so curl sent an alert and hung up. All the fake server got was this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;error:0A000418:SSL routines:ssl3_read_bytes:tlsv1 alert unknown ca
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;No path and no cookie. curl gave up before it sent the request.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fkxpvaoua7pozxkyqmyhs.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fkxpvaoua7pozxkyqmyhs.png" alt="A real server shows a certificate signed by a trusted CA and the browser accepts it. A fake server for the same name has no valid signature and the browser refuses it." width="800" height="540"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Why a counterfeit gets caught&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Now do what people do when a browser shows a certificate warning and they click "Accept the risk". With curl, that's &lt;code&gt;-k&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight console"&gt;&lt;code&gt;$ curl -k -b &lt;span class="s1"&gt;'session=4f9a2c'&lt;/span&gt; https://example.com:8443/login \
       --resolve example.com:8443:127.0.0.1
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This time the fake server prints:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;GET /login HTTP/1.1
Host: example.com:8443
User-Agent: curl/8.14.1
Accept: */*
Cookie: session=4f9a2c
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The connection was encrypted the whole way. It just went to the wrong party, who now has the session cookie. That's why the warning matters, and why sites that send an HSTS header take the "accept" button away completely.&lt;/p&gt;

&lt;h2&gt;
  
  
  What HTTPS doesn't hide
&lt;/h2&gt;

&lt;p&gt;The capture above already showed one gap. Here's the full list of what someone on the network can still see:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;The server name.&lt;/strong&gt; SNI is in the clear, as &lt;code&gt;strings&lt;/code&gt; showed. A newer extension, Encrypted ClientHello (ECH), encrypts it, but only where both the browser and the site support it.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The DNS lookup.&lt;/strong&gt; Before connecting, your machine asks for the site's address, usually over plain UDP. DNS over HTTPS hides that, but your system resolver doesn't use it by default.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The IP address.&lt;/strong&gt; Packets have to be addressed. If a site has its own IP, the address alone gives it away.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Sizes and timing.&lt;/strong&gt; How much you send and receive, and when, can sometimes identify the page even without reading it.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;What HTTPS does hide is everything inside: the path, the query string, the headers, the cookies, what you typed and the page itself.&lt;/p&gt;

&lt;h2&gt;
  
  
  The weak point is the list
&lt;/h2&gt;

&lt;p&gt;The certificate check is only as strong as the CAs on the list, and any of them can sign for any name. In October we saw what happens when one gets this wrong. On 17 October, a researcher &lt;a href="https://bugzilla.mozilla.org/show_bug.cgi?id=2083449" rel="noopener noreferrer"&gt;reported&lt;/a&gt; that the private keys of eight intermediate CAs belonging to eMudhra, an Indian CA, could be recovered. Six of them signed website certificates. The keys should have been huge random numbers. They were all smaller than 256, and one was &lt;a href="https://www.bleepingcomputer.com/news/security/mozilla-google-apple-block-compromised-emudhra-ca-certificates/" rel="noopener noreferrer"&gt;reportedly the number 4&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;With one of those keys, our counterfeit would have passed. It failed because &lt;code&gt;fake.crt&lt;/code&gt; was signed by its own key, and no browser trusts that. An attacker with a leaked eMudhra intermediate key would sign &lt;code&gt;fake.crt&lt;/code&gt; with that key instead, and have the fake server send it along with eMudhra's intermediate certificate, which is public. curl would follow the chain: the fake certificate is signed by the eMudhra intermediate, the intermediate is signed by an eMudhra root, and eMudhra's roots (the &lt;code&gt;emSign&lt;/code&gt; files in &lt;code&gt;/etc/ssl/certs&lt;/code&gt;) are on the list. Every check passes. Anyone who can redirect your traffic, through a fake wifi network or a poisoned DNS answer, gets the request with the cookie, and nothing on the screen looks wrong. Since any CA can sign for any name, this works for every site, not only those that buy certificates from eMudhra.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fgqeghk8zbwf7aviifc05.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fgqeghk8zbwf7aviifc05.png" alt="With a leaked CA key, a fake server can present a validly signed certificate for any name and the browser accepts it. Once browsers remove that CA, the same certificate is refused." width="800" height="527"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;What a leaked CA key changes&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Mozilla and Google blocked the keys within hours, and &lt;a href="https://www.microsoft.com/en-us/msrc/blog/2026/10/microsoft-response-to-compromised-emudhra-certificate-authority-keys" rel="noopener noreferrer"&gt;Microsoft did the same on Windows&lt;/a&gt;. There's also a second check that makes this kind of forgery visible. Chrome only accepts certificates recorded in public Certificate Transparency logs, so a forged certificate has to be published where anyone can see it. The maths held up. What failed was one company's key handling, and the fix was to take it off the list.&lt;/p&gt;

&lt;h2&gt;
  
  
  Next
&lt;/h2&gt;

&lt;p&gt;That's the whole picture: HTTP is plain text, and HTTPS wraps it in a channel that's encrypted and authenticated by a certificate. A counterfeit server gets refused before the browser sends anything, and the only thing the browser sends before that check is the server's name.&lt;/p&gt;

&lt;p&gt;Part 2 is about a program that sits on your own machine and wants to answer for a website, which is exactly what a blocker like glocker does, and what HTTPS is built to refuse.&lt;/p&gt;

</description>
      <category>http</category>
      <category>security</category>
      <category>ssl</category>
      <category>tls</category>
    </item>
    <item>
      <title>A Cold Turkey alternative for Linux</title>
      <dc:creator>Noufal Ibrahim</dc:creator>
      <pubDate>Thu, 05 Nov 2026 07:53:07 +0000</pubDate>
      <link>https://dev.to/nibrahim/a-cold-turkey-alternative-for-linux-kep</link>
      <guid>https://dev.to/nibrahim/a-cold-turkey-alternative-for-linux-kep</guid>
      <description>&lt;p&gt;&lt;a href="https://getcoldturkey.com/" rel="noopener noreferrer"&gt;Cold Turkey&lt;/a&gt; is usually the first name that comes up when people ask about website blockers, and on Windows or macOS it's a reasonable place to start. There is no Linux version. Its guide says that supporting two platforms is hard enough already, and that one may come in the future but not right now, so anyone on Linux has to look elsewhere.&lt;/p&gt;

&lt;p&gt;Most lists of alternatives compare features, and on features alone a few Linux tools come close. Blocking a domain isn't hard, and neither is killing a process on a schedule. What sets Cold Turkey apart is what happens once a block is locked: the uninstaller refuses to run, and task managers and clock changes can be blocked as well. The lock can be released by a timer, a schedule, a restart or a long string of random text. It's meant to hold against the one person a blocker has to worry about, which is whoever installed it.&lt;/p&gt;

&lt;p&gt;That is the difficult part to reproduce on Linux. The blocking itself needs root, and the person using the machine usually has root through &lt;code&gt;sudo&lt;/code&gt;, so anything a blocker sets up can be taken down from a terminal. The desktop is also less uniform than on the other two platforms. There's no single way to control browsers, and on Wayland no common way even to ask which window has focus, so each desktop has to be handled separately. Linux tools tend to settle on doing less, or on assuming that you won't try very hard to get around them. For many people that's fine.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fu4gj0r5xdvcrtxq2r39m.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fu4gj0r5xdvcrtxq2r39m.png" alt="The guards hold off everything outside. Then you walk up with the master key and send them home." width="800" height="817"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  The options
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://www.proginosko.com/leechblock/" rel="noopener noreferrer"&gt;LeechBlock NG&lt;/a&gt; is a browser extension for Firefox and Chrome, with schedules, time limits and delay pages. For rules about the sites themselves it's the closest thing to Cold Turkey, but its reach ends at the browser it's installed in, and it can be removed from the add-ons page.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://digitalzen.app/" rel="noopener noreferrer"&gt;DigitalZen&lt;/a&gt; is the nearest in form: a closed-source desktop app with a GUI and a free tier, which blocks applications and uses a browser extension for sites. If what you liked about Cold Turkey was having one app to manage everything, this is probably where to look. It leans less on keeping you from turning it off.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/bdcdo/open-turkey" rel="noopener noreferrer"&gt;Open Turkey&lt;/a&gt; is an open-source blocker in Go, inspired by Cold Turkey as the name suggests. It runs as a systemd service and combines several methods, including iptables.&lt;/p&gt;

&lt;p&gt;Plucky is free and closed source, and it's set up from the terminal. Rule changes take effect after a delay, which is a sensible answer to the same problem: you can still loosen a rule, but not in the moment you want to. I tried it some time ago and it didn't fit my setup.&lt;/p&gt;

&lt;p&gt;Freedom is available on Linux only as a Chrome extension, so it doesn't apply outside that browser.&lt;/p&gt;

&lt;p&gt;I built &lt;a href="https://glockerapp.com/?ref=article-coldturkey" rel="noopener noreferrer"&gt;glocker&lt;/a&gt; because none of these held up for me, and I should say that it's a different kind of tool rather than a port. It deals with the root problem by removing it: during the hours I choose, my &lt;code&gt;sudo&lt;/code&gt; is reduced to a short list of harmless commands, so the service, the hosts file and the uninstaller are all out of reach. It can also email an accountability partner if the machine stops reporting. Rules are set in a terminal rather than a GUI, there are no path-level rules and nothing like Cold Turkey's allowances or Pomodoro breaks, and DNS-over-HTTPS can still get around it in some browsers. The &lt;a href="https://glockerapp.com/articles/technical-choices.html" rel="noopener noreferrer"&gt;technical notes&lt;/a&gt; go through those gaps.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F79evan4jycxq4k9z8y5y.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F79evan4jycxq4k9z8y5y.png" alt="Not a perfect lock, but you can't send the guards home in a weak moment." width="" height=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The part I've come to use most is glockpeek, the dashboard that comes with it. Glocker records violations, unblocks and the focused window on X11, GNOME, KDE and Hyprland, and glockpeek reads that back: a calendar of clean days and violations, an hour-by-day map of when I'm most likely to slip, and time per application, which can be tagged along separate axes so that the same hours can be split by category, by project or into deep and shallow work. Its insights page turns this into suggestions, such as tightening the rules around a word I keep searching for or an app I keep opening during work hours. Blocking without this data means guessing, and I've changed my configuration more than once because of what it showed.&lt;/p&gt;

&lt;p&gt;All of it is open source under the &lt;a href="https://github.com/glocker-app/glocker" rel="noopener noreferrer"&gt;AGPL&lt;/a&gt;, including the agent, the dashboard and the encryption, and you can run the dashboard yourself for free. It's also actively maintained, and I use it every day. The early response has been good: someone recently tried it on Bazzite, a distribution I'd never used, and ran into problems. I added support for ostree-based systems and KDE and put out a release about two days later.&lt;/p&gt;

&lt;h2&gt;
  
  
  Choosing between them
&lt;/h2&gt;

&lt;p&gt;It comes down to what you wanted from Cold Turkey. For flexible rules on a handful of sites, LeechBlock is enough. For a single app with a GUI, there's DigitalZen. If you've already found that you switch these tools off when it matters, you'll want something that makes that difficult, and you'll have to accept a rougher setup to get it.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://glockerapp.com/articles/blocking-websites-on-linux.html" rel="noopener noreferrer"&gt;Blocking websites on Linux&lt;/a&gt; covers the wider set of options, including DNS filters and accountability software.&lt;/p&gt;

</description>
      <category>linux</category>
      <category>productivity</category>
      <category>opensource</category>
      <category>showdev</category>
    </item>
    <item>
      <title>Blocking websites on Linux: the options, and what each can't do</title>
      <dc:creator>Noufal Ibrahim</dc:creator>
      <pubDate>Wed, 28 Oct 2026 07:19:17 +0000</pubDate>
      <link>https://dev.to/nibrahim/blocking-websites-on-linux-the-options-and-what-each-cant-do-1382</link>
      <guid>https://dev.to/nibrahim/blocking-websites-on-linux-the-options-and-what-each-cant-do-1382</guid>
      <description>&lt;p&gt;Most guides to blocking websites on Linux stop at "add a line to &lt;code&gt;/etc/hosts&lt;/code&gt;". That works, but it didn't help me much, because the person I was trying to stop was me. These are the things I tried or looked at over the years, what each was good for, and where each one gave way.&lt;/p&gt;

&lt;h2&gt;
  
  
  Editing /etc/hosts
&lt;/h2&gt;

&lt;p&gt;This is where I started. A line like this in &lt;code&gt;/etc/hosts&lt;/code&gt; sends the site nowhere:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight console"&gt;&lt;code&gt;&lt;span class="go"&gt;0.0.0.0 twitter.com
0.0.0.0 www.twitter.com
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;It works on every distro and costs nothing, and the block holds until you remove it. The trouble is that removing it is easy: open the file, delete the line, and the site is back.&lt;/p&gt;

&lt;p&gt;So I made the file immutable with &lt;code&gt;chattr +i /etc/hosts&lt;/code&gt;. After that, even root can't edit it without first running &lt;code&gt;chattr -i&lt;/code&gt;. It's only one more command, but on an ordinary day that extra step was often enough to make me stop and think. On a bad day it wasn't.&lt;/p&gt;

&lt;p&gt;From there it grew into a pile of small shell scripts that made the block more annoying to undo: putting the lines back if they disappeared, setting the flag again, and so on. It helped, but every script could be undone by the same person who wrote it.&lt;/p&gt;

&lt;p&gt;You'll also need to list every subdomain yourself, and browsers that use DNS-over-HTTPS skip the hosts file entirely unless you turn that off.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Good for:&lt;/strong&gt; a quick, permanent block on a few sites.&lt;/p&gt;

&lt;h2&gt;
  
  
  A DNS filter (Pi-hole, NextDNS, OpenDNS)
&lt;/h2&gt;

&lt;p&gt;These block domains for every device on the network, and they come with large ready-made blocklists, including adult content. NextDNS can apply rules on a schedule. I used OpenDNS for a while, and we run Pi-hole at home now. The setup takes some effort, but it's worth it.&lt;/p&gt;

&lt;p&gt;A filter only works while traffic goes through it, though. On a laptop, changing the DNS server, or connecting from somewhere else, gets around it. And since most of these are built for blocking ads, nothing stops you from switching the filter off.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Good for:&lt;/strong&gt; blocking across a household, or a whole category of sites.&lt;/p&gt;

&lt;h2&gt;
  
  
  Browser extensions (LeechBlock NG and others)
&lt;/h2&gt;

&lt;p&gt;I looked at LeechBlock NG, which runs in Firefox and Chrome. It can block by schedule, limit time per site, and show a delay page before a site loads. It's the most flexible option for the sites themselves.&lt;/p&gt;

&lt;p&gt;But it only covers the browser it's installed in. An incognito window, another browser, another profile, or two clicks in the add-ons menu, and the blocks are gone. It can't do anything about desktop apps either.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Good for:&lt;/strong&gt; gentle limits when a nudge is all you need.&lt;/p&gt;

&lt;h2&gt;
  
  
  Blocker apps for Linux
&lt;/h2&gt;

&lt;p&gt;There are a few open-source apps for this, such as Open Turkey and Focuser. They combine the hosts file, browser policies and killing processes, put things back if you undo them, and some make you pass a typing challenge before you can turn them off.&lt;/p&gt;

&lt;p&gt;The commercial blockers mostly don't run on Linux. Cold Turkey has no Linux version, and Freedom is only a browser extension there. Plucky does run on Linux; it's free but closed source, and you set it up from the terminal. I tried it before building my own, and it didn't fit my Linux and Firefox setup well.&lt;/p&gt;

&lt;p&gt;The gap they all share is root. If you can run &lt;code&gt;sudo&lt;/code&gt;, you can stop the service, edit the files or uninstall the app, so any of them can be undone in a minute when you really want to.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Good for:&lt;/strong&gt; blocking sites and apps on a schedule, if you trust yourself to leave it on.&lt;/p&gt;

&lt;h2&gt;
  
  
  Accountability software
&lt;/h2&gt;

&lt;p&gt;Accountable2You runs on Linux. It reports your activity to a partner rather than blocking anything. I tried it too, and like Plucky it didn't suit my setup. It also needs an X11 session; under Wayland, which is now the default on Ubuntu and Fedora, its monitoring is limited. Covenant Eyes doesn't support Linux at all.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Good for:&lt;/strong&gt; when knowing someone else will see is the deterrent.&lt;/p&gt;

&lt;h2&gt;
  
  
  When you need something you can't switch off
&lt;/h2&gt;

&lt;p&gt;That gap, being able to switch everything off in a weak moment, is why I built &lt;a href="https://glockerapp.com/?ref=devto-article-blocking" rel="noopener noreferrer"&gt;glocker&lt;/a&gt;. It blocks sites and apps on a schedule like the apps above, and adds three things:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;It takes away my sudo&lt;/strong&gt; during the hours I choose, so I can't stop the service, edit the hosts file or uninstall it. During my allowed hours sudo works as normal.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Uninstalling is slow on purpose.&lt;/strong&gt; I have to type a sentence that's revealed one character at a time, and start again if I slip.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Someone else can notice.&lt;/strong&gt; With the optional hosted dashboard, if glocker stops reporting, an accountability partner gets an email. The usage data is encrypted before it leaves the machine.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;It runs on Debian, Ubuntu, Fedora, Arch and Omarchy, on X11 and Wayland, and it's open source. It has gaps too: it doesn't stop DNS-over-HTTPS in Firefox or in a browser it doesn't manage, or a second device. The &lt;a href="https://glockerapp.com/articles/technical-choices.html?ref=devto" rel="noopener noreferrer"&gt;technical notes&lt;/a&gt; list them. I plan to close them one by one, but it works for me as it stands.&lt;/p&gt;

&lt;h2&gt;
  
  
  Which one should you use?
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;A nudge is enough:&lt;/strong&gt; LeechBlock NG.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;You want to block a category across the house:&lt;/strong&gt; a DNS filter like NextDNS or Pi-hole.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;You want sites and apps blocked on a schedule, and you'll leave it on:&lt;/strong&gt; a blocker app.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;You know you'll switch it off in a weak moment:&lt;/strong&gt; something that takes away sudo, like glocker, possibly with a partner who's told when it goes quiet.&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>linux</category>
      <category>produc</category>
      <category>opensource</category>
      <category>privacy</category>
    </item>
    <item>
      <title>End-to-end encryption for a hosted dashboard</title>
      <dc:creator>Noufal Ibrahim</dc:creator>
      <pubDate>Tue, 27 Oct 2026 09:49:22 +0000</pubDate>
      <link>https://dev.to/nibrahim/end-to-end-encryption-for-a-hosted-dashboard-5333</link>
      <guid>https://dev.to/nibrahim/end-to-end-encryption-for-a-hosted-dashboard-5333</guid>
      <description>&lt;p&gt;For &lt;a href="https://glockerapp.com/?ref=devto-e2e" rel="noopener noreferrer"&gt;Glocker&lt;/a&gt;, I wanted to provide the convenience of a hosted dashboard but without compromising the private data of the people who use it. For this, I decided to implement end-to-end encryption. The ideas are interesting and new to me, so I thought I'd write about them here.&lt;/p&gt;

&lt;p&gt;The setup is an agent that runs on your machine and records things about it, and a cloud service that stores those records and shows them to you in a browser. The goal is that the cloud can store and serve the data, but can't read it.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fopls7jqtxntv1cns260m.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fopls7jqtxntv1cns260m.png" alt="Data flow" width="800" height="1027"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;There are two keys. The blue one is the data key. It's random, and it locks every record before the agent sends it. The amber one is your passphrase, which only you know.&lt;/p&gt;

&lt;p&gt;The cloud never holds a key. It holds locked boxes: the records, locked with the blue key, and one more box, locked with the amber key, with the blue key inside it. When you open the dashboard, your passphrase opens that outer box in your browser, and the blue key inside opens the records. All of this happens on your side.&lt;/p&gt;

&lt;p&gt;Why two keys and not just the passphrase? Passphrases are guessable and you might want to change one. With a random data key, changing the passphrase only means relocking one small box, not every record. And before a passphrase is used as a key, it's run through a deliberately slow function (PBKDF2, hundreds of thousands of rounds), so trying guesses is expensive.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fsx2upwwz74u8z9nlqu9s.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fsx2upwwz74u8z9nlqu9s.png" alt="Initial key setup" width="800" height="1000"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The first exchange is the only tricky part. (1) In your browser, a blue key is made and locked in an amber box. (2) The cloud stores that box. (3) On your machine, you type the passphrase once, the box opens, and the agent keeps the blue key from then on.&lt;/p&gt;

&lt;p&gt;Two implementation details&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;The cloud needs some way to tell if a record was already uploaded, but a plain hash of the content leaks it (anyone can hash "youtube.com" and compare), so the ID has to be a hash keyed with the blue key. &lt;/li&gt;
&lt;li&gt;Some things have to stay readable, like when a record was made, so the cloud can notice if the agent goes quiet. No way around this so it's the content that's locked. Not the timestamps.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;I'm not a cryptographer and this hasn't been audited, so corrections are welcome.&lt;/p&gt;

</description>
      <category>security</category>
      <category>privacy</category>
      <category>encryption</category>
      <category>beginners</category>
    </item>
    <item>
      <title>Notes on the technical choices behind glocker, a Linux blocker I can’t switch off</title>
      <dc:creator>Noufal Ibrahim</dc:creator>
      <pubDate>Mon, 26 Oct 2026 04:54:46 +0000</pubDate>
      <link>https://dev.to/nibrahim/notes-on-the-technical-choices-behind-glocker-a-linux-blocker-i-cant-switch-off-3p53</link>
      <guid>https://dev.to/nibrahim/notes-on-the-technical-choices-behind-glocker-a-linux-blocker-i-cant-switch-off-3p53</guid>
      <description>&lt;p&gt;I spent some time creating a tool to block sites and apps based on schedules as well as to track behaviour. This is an overview of how it works. &lt;/p&gt;

&lt;p&gt;The application is completely open source and available at &lt;a href="https://glockerapp.com/?ref=devto" rel="noopener noreferrer"&gt;the official site&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Blocking
&lt;/h2&gt;

&lt;p&gt;Blocking is done by putting domains into /etc/hosts, pointed at localhost, and the file is made immutable with chattr +i. A small server on 127.0.0.1 answers those requests with a blocked page and logs the hit. The domains are fetched from public blocklists. Domains which have web based proxies are also blocked. A Firefox/Chrome extension, force-installed through the browsers' enterprise policies, catches keywords in URLs and page content. Programs on a list are killed during their windows. Repeated violations run a command of your choice, usually a screen lock you can't dismiss until it times out.&lt;/p&gt;

&lt;h2&gt;
  
  
  Taking away sudo
&lt;/h2&gt;

&lt;p&gt;If glocker is uninstalled, all protections are lifted. This is prevented by allowing only root to uninstall it and then removing root access during specified windows. During the hours you choose, your sudo line is the full one; outside them it's a short list of harmless commands. glocker writes that line to its own file, /etc/sudoers.d/glocker, validated with visudo first, and swaps it on schedule.&lt;/p&gt;

&lt;p&gt;That only works if it's your only sudo, and every distro hands out sudo differently. Debian, Ubuntu and Fedora use a group (sudo or wheel); Arch's installer and Omarchy write a per-user file in sudoers.d; Ubuntu cloud images add a NOPASSWD file of their own. So install has an explicit plan per distro: it removes you from the admin group or moves your file aside, records exactly what it changed, and uninstall puts it back. On a distro without a plan, the sudo window is simply off. An earlier version edited /etc/sudoers directly and broke on Ubuntu's new sudo-rs, which rejects a file without a trailing newline.&lt;/p&gt;

&lt;p&gt;glocker -check lists the routes that still get you root: a root password for su, SSH root login, other users with sudo, auto-login. I keep recovery mode open on purpose, as the break-glass.&lt;/p&gt;

&lt;h2&gt;
  
  
  Making uninstall slow
&lt;/h2&gt;

&lt;p&gt;Now, during the sudo window, it will be possible to uninstall glocker but that can be made annoying enough to prevent you from doing it unless you really need to. glocker -uninstall asks for a reason and then a typing test: a sentence is revealed one character per second, and you type each character as it appears. A wrong key or falling behind starts it over. If you uninstalled recently, the sentence gets longer. It sounds silly, but a minute of typing "I am removing my own guardrails" is usually enough to change your mind.&lt;/p&gt;

&lt;h2&gt;
  
  
  Watchdog
&lt;/h2&gt;

&lt;p&gt;A small watchdog, glockdoc, pings the daemon every 30 minutes and logs the result, and it survives an uninstall, so a silent teardown still shows up as a gap. With the hosted dashboard, those heartbeats go to a server, and if none arrive for about an hour it emails your accountability partner. This is available on the hosted plan since it requires an email setup.&lt;/p&gt;

&lt;h2&gt;
  
  
  What the server can see
&lt;/h2&gt;

&lt;p&gt;Synced records are encrypted on the machine before upload. A random master key encrypts window titles, URLs, keywords, app names and reasons per field with AES-GCM; the key is wrapped under your passphrase (PBKDF2-SHA256, 600,000 iterations) and decrypted in the browser. Record IDs are an HMAC under the same key, so they can't be used to guess contents.&lt;/p&gt;

&lt;p&gt;Some metadata stays readable, deliberately: timestamps, idle time, window counts, the type of a violation or lifecycle event, and whether a heartbeat arrived. The partner emails need that, and they contain counts and liveness, never what you visited. PBKDF2 isn't memory-hard, so the passphrase has to be strong; the setup page enforces that. I'm not a cryptographer and this hasn't been independently audited.&lt;/p&gt;

</description>
      <category>linux</category>
      <category>go</category>
      <category>productivity</category>
      <category>opensource</category>
    </item>
  </channel>
</rss>
