<?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: Enmanuel Reynoso</title>
    <description>The latest articles on DEV Community by Enmanuel Reynoso (@enmareynoso).</description>
    <link>https://dev.to/enmareynoso</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.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F2788016%2F97ae529a-00d7-483e-acc9-8c01f115bcd8.png</url>
      <title>DEV Community: Enmanuel Reynoso</title>
      <link>https://dev.to/enmareynoso</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/enmareynoso"/>
    <language>en</language>
    <item>
      <title>How I blocked ads and malware on my home network using a DNS Sinkhole</title>
      <dc:creator>Enmanuel Reynoso</dc:creator>
      <pubDate>Mon, 24 Feb 2025 07:52:39 +0000</pubDate>
      <link>https://dev.to/enmareynoso/how-i-blocked-ads-and-malware-on-my-home-network-using-a-dns-sinkhole-2m7i</link>
      <guid>https://dev.to/enmareynoso/how-i-blocked-ads-and-malware-on-my-home-network-using-a-dns-sinkhole-2m7i</guid>
      <description>&lt;h2&gt;
  
  
  How ads work with DNS?
&lt;/h2&gt;

&lt;p&gt;Before we block ads and malware, we need to understand how they work through DNS. When you visit a website, your device queries a DNS server to resolve domain names (like diariolibre.com) into IP addresses. However, websites also load third-party ads and trackers that require additional DNS lookups. The screenshots below illustrate this process: first, we see DNS queries sent from a client (10.0.0.162) to a local DNS resolver (10.0.0.1). The nslookup test confirms that diariolibre.com resolves to Amazon AWS IPs, but we also see multiple requests to advertising domains, like securepubads.g.doubleclick.net. By using a DNS sinkhole such as AdGuard Home, we can intercept and block these unwanted queries, preventing ads and trackers from loading across all devices on our network. In this guide, I’ll show you how I set up AdGuard Home on my home server to block ads and malware network-wide.&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.amazonaws.com%2Fuploads%2Farticles%2Ftlt2r4d4mka1kyufm06i.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.amazonaws.com%2Fuploads%2Farticles%2Ftlt2r4d4mka1kyufm06i.png" alt="Image description" width="693" height="649"&gt;&lt;/a&gt;&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.amazonaws.com%2Fuploads%2Farticles%2Fcpehidyrarbqaeteetj8.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.amazonaws.com%2Fuploads%2Farticles%2Fcpehidyrarbqaeteetj8.png" alt="Image description" width="800" height="189"&gt;&lt;/a&gt;&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.amazonaws.com%2Fuploads%2Farticles%2Fpgr71bp7mmawu5iymzd7.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.amazonaws.com%2Fuploads%2Farticles%2Fpgr71bp7mmawu5iymzd7.png" alt="Image description" width="800" height="40"&gt;&lt;/a&gt;&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.amazonaws.com%2Fuploads%2Farticles%2Fdjuka0v2wvc83a2yy1t8.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.amazonaws.com%2Fuploads%2Farticles%2Fdjuka0v2wvc83a2yy1t8.png" alt="Image description" width="494" height="302"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  How AdGuard will block ads?
&lt;/h2&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.amazonaws.com%2Fuploads%2Farticles%2Fifeyu3oqlkqs9oqasuqx.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.amazonaws.com%2Fuploads%2Farticles%2Fifeyu3oqlkqs9oqasuqx.png" alt="Image description" width="800" height="659"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;When you visit a website, your browser makes multiple DNS requests—not just for the main site, but also for third-party resources like advertisements, trackers, and analytics scripts. Normally, the DNS resolver returns the actual IP address of the requested domain, allowing your browser to load the content.&lt;/p&gt;

&lt;p&gt;However, with AdGuard Home acting as a DNS sinkhole, things work differently. When our browser requests an ad, instead of the resolver returning the IP address of a known ad domain, it returns 0.0.0.0. Essentially, it doesn’t tell us where the ad was supposed to go—it just throws it into a black hole. :)&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.amazonaws.com%2Fuploads%2Farticles%2Flpwoawubq5pv3gv6yuul.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.amazonaws.com%2Fuploads%2Farticles%2Flpwoawubq5pv3gv6yuul.png" alt="Image description" width="800" height="722"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Installing AdGuard on home server
&lt;/h2&gt;

&lt;p&gt;Usually, these types of projects are installed on a Raspberry Pi and use alternative DNS sinkholes like Pi-hole. However, in this case, I’ll be using a spare computer to act as my DNS sinkhole.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 1: Installing AdGuard Home on Ubuntu Server&lt;/strong&gt;&lt;br&gt;
I have Ubuntu Server installed on my home server, so I’ll be setting up AdGuard Home on Ubuntu Server 22.04.&lt;/p&gt;

&lt;p&gt;If you need help installing Ubuntu Server, you can refer to my other &lt;a href="https://dev.to/enmareynoso/deploying-a-cowrie-ssh-honeypot-on-a-home-server-7pi"&gt;blog&lt;/a&gt; section, where I cover the installation process in detail.&lt;/p&gt;

&lt;p&gt;After having ubuntu server setup run the following commands&lt;br&gt;
Firs update your list with&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo apt update
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then copy and paste this command to install adguard home:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;curl -s -S -L https://raw.githubusercontent.com/AdguardTeam/AdGuardHome/master/scripts/install.sh | sh -s -- -v
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;On output, we can see we can access a GUI at port 3000:&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.amazonaws.com%2Fuploads%2Farticles%2Fptixdjm01mmyc70d0fmu.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.amazonaws.com%2Fuploads%2Farticles%2Fptixdjm01mmyc70d0fmu.png" alt="Image description" width="799" height="592"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Next Steps after Accessing AdGuard Home GUI
&lt;/h2&gt;

&lt;p&gt;After you've successfully accessed your AdGuard Home web interface (usually at &lt;a href="http://your-adguard-ip:3000" rel="noopener noreferrer"&gt;http://your-adguard-ip:3000&lt;/a&gt;), you should follow these recommended steps to complete the setup:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 1: Complete the Initial Setup Wizard&lt;/strong&gt;&lt;br&gt;
Once logged in, AdGuard Home guides you through an easy setup wizard.&lt;/p&gt;

&lt;p&gt;Set your administrator username and strong password.&lt;br&gt;
Choose the network interface AdGuard Home should listen to (typically leave it as default).&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.amazonaws.com%2Fuploads%2Farticles%2Flq5gx1nl1wtcwid2257y.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.amazonaws.com%2Fuploads%2Farticles%2Flq5gx1nl1wtcwid2257y.png" alt="Image description" width="730" height="503"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 2: Configure Your Network to Use AdGuard Home&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Now that your AdGuard Home server is set up, direct your devices to use it as their DNS server:&lt;/p&gt;

&lt;p&gt;Recommended: Configure at the Router Level&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Access your router's settings.&lt;/li&gt;
&lt;li&gt;Navigate to the DHCP/DNS settings section.&lt;/li&gt;
&lt;li&gt;Enter your Ubuntu server IP address as the primary DNS server.&lt;/li&gt;
&lt;/ol&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.amazonaws.com%2Fuploads%2Farticles%2Fs3l24dan9yk164hvn03x.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.amazonaws.com%2Fuploads%2Farticles%2Fs3l24dan9yk164hvn03x.png" alt="Image description" width="664" height="497"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You need to use your Ubuntu Server's IP address (where AdGuard Home is actually installed and running) instead of the address you might be using to access the GUI, because your network devices rely directly on the server handling DNS queries, not on the GUI interface itself. The AdGuard GUI is simply a web-based administration panel that could be accessed through various network routes or IPs, especially in scenarios involving virtualization or NAT. However, the DNS functionality occurs directly at the server level, precisely at the Ubuntu server hosting AdGuard. Therefore, setting your router's primary DNS to the Ubuntu Server IP ensures all devices on your network forward their DNS requests to the correct location, allowing AdGuard Home to intercept and block ads properly at a network-wide level.&lt;/p&gt;

&lt;p&gt;Alternative:&lt;/p&gt;

&lt;p&gt;Set the DNS server manually on each individual device. (Not recommended, as it’s more tedious and less efficient.)&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 3: Add DNS Blocklists (Recommended)&lt;/strong&gt;&lt;br&gt;
AdGuard Home comes preloaded with a default blocklist. But to maximize ad and malware blocking:&lt;/p&gt;

&lt;p&gt;Click Filters → DNS Blocklists.&lt;br&gt;
Click on Add blocklist and use recommended blocklists&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.amazonaws.com%2Fuploads%2Farticles%2Fsnv2jtgemobhaqdtdtdt.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.amazonaws.com%2Fuploads%2Farticles%2Fsnv2jtgemobhaqdtdtdt.png" alt="Image description" width="495" height="448"&gt;&lt;/a&gt;&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.amazonaws.com%2Fuploads%2Farticles%2Fkjmme8o3y481pgzw8y8s.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.amazonaws.com%2Fuploads%2Farticles%2Fkjmme8o3y481pgzw8y8s.png" alt="Image description" width="418" height="336"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 4: Add DNS Upstream (Recommended)&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;AdGuard Home acts as a local DNS server, but it still forwards DNS queries to external servers, known as "upstream DNS servers." By default, DNS queries are unencrypted, meaning your browsing activity could be viewed by ISPs or anyone else monitoring your network. To enhance privacy and security, it's strongly recommended to use encrypted DNS, specifically DNS-over-HTTPS (DoH), which encrypts DNS queries, keeping your browsing activity private and secure.&lt;/p&gt;

&lt;p&gt;AdGuard provides a detailed list of &lt;a href="https://adguard-dns.io/kb/general/dns-providers/" rel="noopener noreferrer"&gt;recommended secure DNS providers&lt;/a&gt; that support DNS-over-HTTPS. Some of the most privacy-oriented and trusted providers on this list include AdGuard DNS, Cloudflare, and Quad9. I recommend using the following:&lt;/p&gt;

&lt;p&gt;To configure your secure DNS, log in to your AdGuard Home GUI, navigate to Settings → DNS settings, and go to the "Upstream DNS servers" section. Here, remove any existing default servers and input your preferred DNS-over-HTTPS server endpoint from the recommended list on the image below or from the list URL.&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.amazonaws.com%2Fuploads%2Farticles%2F31ayy4l0rjnnokmeexn5.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.amazonaws.com%2Fuploads%2Farticles%2F31ayy4l0rjnnokmeexn5.png" alt="Image description" width="517" height="348"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Testing AdGuard adblock capabilities
&lt;/h2&gt;

&lt;p&gt;Now that AdGuard is set as our DNS resolver, let's verify if it's successfully blocking ads and trackers. To confirm AdGuard's functionality, we'll conduct the following tests:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1. Visit a Website Known to Display Ads&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;We'll use CNET.com for this demonstration, as it's well-known for showing many ads.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Before enabling AdGuard Home (Ads visible):&lt;/strong&gt;&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.amazonaws.com%2Fuploads%2Farticles%2F67m4tdqcewek4oa444ps.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.amazonaws.com%2Fuploads%2Farticles%2F67m4tdqcewek4oa444ps.png" alt="Image description" width="658" height="475"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;After enabling AdGuard Home (Ads blocked):&lt;/strong&gt;&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.amazonaws.com%2Fuploads%2Farticles%2Fl22ilq80xh6im6l25osp.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.amazonaws.com%2Fuploads%2Farticles%2Fl22ilq80xh6im6l25osp.png" alt="Image description" width="571" height="189"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;As you can see, the ads on the page are no longer present, indicating that AdGuard Home is effectively blocking ad domains.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. Running Dedicated Ad-block Tests&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;To further validate the effectiveness, let's run dedicated tests with specialized tool [&lt;a href="https://superadblocktest.com/" rel="noopener noreferrer"&gt;superadblocktest&lt;/a&gt;]:&lt;/p&gt;

&lt;p&gt;Results with AdGuard active:&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.amazonaws.com%2Fuploads%2Farticles%2Fmyus2oh72fr1mfk9hdj1.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.amazonaws.com%2Fuploads%2Farticles%2Fmyus2oh72fr1mfk9hdj1.png" alt="Image description" width="401" height="335"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;AdGuard Query Log showing blocked domains:&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.amazonaws.com%2Fuploads%2Farticles%2Ftg8ypqyrdcvvs6zkvv6k.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.amazonaws.com%2Fuploads%2Farticles%2Ftg8ypqyrdcvvs6zkvv6k.png" alt="Image description" width="549" height="306"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Using Artem &lt;a href="https://artem-sherbachuk.github.io/toolz/adblock" rel="noopener noreferrer"&gt;Sherbachuk’s Adblock Test&lt;/a&gt;&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.amazonaws.com%2Fuploads%2Farticles%2Fefd2jjtpeon1osojpt8p.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.amazonaws.com%2Fuploads%2Farticles%2Fefd2jjtpeon1osojpt8p.png" alt="Image description" width="800" height="280"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;In this guide, we've successfully set up AdGuard Home as a DNS sinkhole on an Ubuntu server, providing effective ad-blocking and protection against tracking and malicious domains across your entire home network. Feel free to customize your blocklists and DNS rules to further enhance your privacy and security. Happy browsing! 🌐&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Homomorphic Encryption: Unlocking Privacy Without Losing Utility</title>
      <dc:creator>Enmanuel Reynoso</dc:creator>
      <pubDate>Mon, 24 Feb 2025 05:32:24 +0000</pubDate>
      <link>https://dev.to/enmareynoso/homomorphic-encryption-unlocking-privacy-without-losing-utility-2l2a</link>
      <guid>https://dev.to/enmareynoso/homomorphic-encryption-unlocking-privacy-without-losing-utility-2l2a</guid>
      <description>&lt;p&gt;Current encryption technologies play a crucial role in today's digital world. They support the secure functioning of the Internet, form the foundation of Web3, and enable individuals to safeguard their personal information. Yet, traditional encryption methods have a significant drawback—data typically must be decrypted before it can be analyzed or processed. Unfortunately, decrypting sensitive data to perform computations exposes it to third parties, defeating the purpose of encryption.&lt;/p&gt;

&lt;p&gt;Homomorphic encryption addresses this problem by allowing computations to occur on encrypted data itself. This means cloud providers and web-based services can process your data without ever having direct access to the underlying sensitive information. For organizations and individuals concerned about privacy, homomorphic encryption provides enhanced functionality while maintaining robust data security.&lt;/p&gt;




&lt;h2&gt;
  
  
  What Is Homomorphic Encryption?
&lt;/h2&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.amazonaws.com%2Fuploads%2Farticles%2Fr8z5divfaf6l4d10nzu0.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.amazonaws.com%2Fuploads%2Farticles%2Fr8z5divfaf6l4d10nzu0.png" alt="Image description" width="633" height="512"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Outsource the computation of a function f(x) on data x to a server, without revealing the data to the server.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Imagine being able to securely analyze sensitive data—such as your medical history, financial records, or personal details—without ever showing it directly to third parties.&lt;/p&gt;

&lt;p&gt;Homomorphic encryption is an innovative cryptographic method that allows computations to be performed on encrypted data, eliminating the need to decrypt it first. This means your data stays protected and encrypted, even as external services analyze it.&lt;/p&gt;

&lt;p&gt;Here's why that's exciting: Suppose you want insights from your genetic data. Currently, using genetic testing services typically involves sharing highly sensitive information. With homomorphic encryption, these services could analyze your encrypted DNA without ever directly accessing your genetic sequences—providing valuable insights while protecting your privacy.&lt;/p&gt;

&lt;p&gt;Though first proposed in 1978 by Rivest, Adleman, and Dertouzos, homomorphic encryption became practical only in 2009, thanks to computer scientist Craig Gentry.&lt;/p&gt;

&lt;p&gt;Gentry describes the idea vividly, comparing homomorphic encryption to having a "sealed glove box":&lt;/p&gt;

&lt;blockquote&gt;
&lt;h2&gt;
  
  
  &lt;em&gt;“Imagine you have a sealed glove box containing sensitive materials. Anyone can slide their hands into the gloves attached to the outside, manipulate and rearrange the objects inside the box—but they can never remove or directly access what’s inside. When the work is complete, only the owner with the key can unlock the box and retrieve the processed information.”&lt;/em&gt;
&lt;/h2&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Homomorphic Encryption Use Cases
&lt;/h2&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.amazonaws.com%2Fuploads%2Farticles%2Fym13ch1wv4e8vknpof4q.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.amazonaws.com%2Fuploads%2Farticles%2Fym13ch1wv4e8vknpof4q.png" alt="Image description" width="800" height="375"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Computing AI algorithms on encrypted data is possible thanks to homomorphic encryption.&lt;/em&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Diagram By Chainlink&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;strong&gt;Secure Artificial Intelligence/Machine Learning&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Artificial Intelligence thrives on vast amounts of data. But often, the most valuable datasets—such as medical records or financial data—remain inaccessible due to privacy concerns. Homomorphic encryption solves this by enabling AI models to learn from encrypted data, never needing access to the raw information.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Example:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Imagine an AI startup wants to develop a powerful predictive model that can accurately forecast financial risks, fraud, and creditworthiness based on spending patterns and bank transaction histories. Naturally, banks have strict privacy regulations and cannot simply share sensitive customer transactions and financial details directly with an external AI company.&lt;/p&gt;

&lt;p&gt;Traditionally, such collaboration would be impossible without exposing private data—something banks and customers alike would never accept. But with homomorphic encryption, banks can securely share encrypted financial transaction data with the AI startup. The AI company can then run its predictive algorithms on these encrypted records without ever actually seeing individual transaction details.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. Secure Cloud Computing&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Traditionally, cloud providers must have direct access to your data to perform computations, creating significant privacy risks. Homomorphic encryption changes the game entirely, allowing cloud providers to process encrypted data without ever decrypting it.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3. Regulatory Compliance&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Businesses worldwide face increasing regulatory requirements like GDPR, emphasizing stringent privacy standards. Homomorphic encryption helps companies comply with these regulations while still offering innovative digital services.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;4. Secure and Transparent Voting Systems&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Homomorphic encryption provides an ideal solution for confidential, transparent, and verifiable voting systems. Votes remain encrypted and anonymous, while still being accurately checked and auditable by external entities.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;5. Enhancing Supply Chain Security&lt;/strong&gt;**&lt;/p&gt;

&lt;p&gt;Supply chains involve sharing sensitive data across multiple partners, including vendors, logistics providers, and contractors. This shared data creates vulnerabilities and potential entry points for cyberattacks. Homomorphic encryption can eliminate these vulnerabilities by encrypting &lt;br&gt;
sensitive information end-to-end.&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;Homomorphic encryption isn’t just a technical curiosity. It's a fundamental shift in how we balance the power of data analytics with the necessity of data privacy.&lt;/p&gt;

&lt;p&gt;As more organizations and individuals prioritize privacy, homomorphic encryption offers an exciting path forward: harnessing the full value of data without compromising confidentiality. This isn't merely encryption as usual; it's the future of secure collaboration and trust.&lt;/p&gt;

</description>
      <category>cryptography</category>
      <category>security</category>
      <category>cybersecurity</category>
    </item>
    <item>
      <title>Deploying a Cowrie SSH Honeypot on a home server. 🍯</title>
      <dc:creator>Enmanuel Reynoso</dc:creator>
      <pubDate>Sun, 23 Feb 2025 03:27:02 +0000</pubDate>
      <link>https://dev.to/enmareynoso/deploying-a-cowrie-ssh-honeypot-on-a-home-server-7pi</link>
      <guid>https://dev.to/enmareynoso/deploying-a-cowrie-ssh-honeypot-on-a-home-server-7pi</guid>
      <description>&lt;h1&gt;
  
  
  Introduction
&lt;/h1&gt;

&lt;p&gt;&lt;strong&gt;What is a Honeypot?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;A honeypot is a deception security mechanism that mimics real systems to attract and analyze cyber threats. Threat actors interact with the honeypot, allowing security professionals to study their behavior.&lt;/p&gt;

&lt;p&gt;This guide will show you how to deploy a Cowrie SSH honeypot for logging attacker activity. You can choose to:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Run it on a VPS from any cloud provider (AWS, DigitalOcean, Linode, etc.).&lt;/li&gt;
&lt;li&gt;Set up a home server on any machine for centralized control.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;In this case, i’ll be using a refurbished HP ProDesk running Ubuntu Server as our dedicated honeypot machine. However, the steps will also work on a VPS.&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.amazonaws.com%2Fuploads%2Farticles%2F87m7ab503av6wvor09yu.jpg" 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.amazonaws.com%2Fuploads%2Farticles%2F87m7ab503av6wvor09yu.jpg" alt="Image description" width="800" height="1066"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  1️⃣ Hardware Requirements
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Option 1: HP ProDesk (or Similar Home Server)&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;x86_64-based system with at least:&lt;/strong&gt;&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;CPU: Dual-core or better
RAM: 4GB+ (8GB recommended)
Storage: 20GB+ SSD/HDD
Ethernet connection for stable logging
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;&lt;strong&gt;Option 2: VPS from Any Cloud Provider&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Any VPS running Ubuntu Server 22.04+&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Providers: AWS, Linode, DigitalOcean, Hetzner, etc&lt;/li&gt;
&lt;li&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Minimum recommended specs:
1 vCPU
2GB RAM
20GB SSD
&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;A public IP address to allow remote access&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Configurations&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Open port 2222 for honeypot SSH&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  2️⃣ Software Requirements
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Ubuntu Server 22.04 LTS (or newer)&lt;/strong&gt;&lt;br&gt;
Download from: &lt;a href="https://ubuntu.com/download/server" rel="noopener noreferrer"&gt;Ubuntu Server Download&lt;/a&gt;&lt;br&gt;
Installed with SSH access enabled&lt;br&gt;
Set up with a non-root user (sudo enabled)&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Basic Linux &amp;amp; Networking Knowledge&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Familiarity with SSH, systemctl, and firewalls&lt;/p&gt;
&lt;h2&gt;
  
  
  Installation
&lt;/h2&gt;

&lt;p&gt;Before setting up Cowrie, you need to install Ubuntu Server on your machine. You can install it in two ways:&lt;/p&gt;

&lt;p&gt;1️⃣ On a physical machine using a bootable USB (e.g., HP ProDesk).&lt;br&gt;
2️⃣ Inside a virtual machine using VirtualBox (which we’ll use in this guide)&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Option 1: Install Ubuntu Server with a Bootable USB&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;If you’re installing on a physical machine (like HP ProDesk), follow this guide&lt;/p&gt;

&lt;p&gt;Steps:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Download Ubuntu Server LTS from Ubuntu Server Download.&lt;/li&gt;
&lt;li&gt;Create a bootable USB using Rufus (Windows) or balenaEtcher (Mac/Linux).&lt;/li&gt;
&lt;li&gt;Boot from the USB and follow the installation steps.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;🎥 Watch this &lt;a href="https://www.youtube.com/watch?v=vu-NvH34PZY" rel="noopener noreferrer"&gt;video tutorial&lt;/a&gt; for creating a bootable USB &amp;amp; installing Ubuntu Server&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Option 2: Install Ubuntu Server on a Virtual Machine (VirtualBox)&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;In this guide, I’ll be installing Ubuntu Server on a Virtual Machine (VM) using VirtualBox.&lt;br&gt;
**&lt;br&gt;
&lt;strong&gt;Step 1: Download &amp;amp; Install VirtualBox&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Download VirtualBox from: &lt;a href="https://www.virtualbox.org/" rel="noopener noreferrer"&gt;https://www.virtualbox.org/&lt;/a&gt;&lt;br&gt;
Install VirtualBox for your OS.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 2: Create a New Virtual Machine&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;1️⃣ Open VirtualBox and click "New".&lt;br&gt;
2️⃣ Set the name as Ubuntu_Honeypot.&lt;br&gt;
3️⃣ Select Type: Linux, Version: Ubuntu.&lt;br&gt;
4️⃣ Allocate at least 2048MB (2GB) RAM (4GB recommended).&lt;br&gt;
5️⃣ Create a 20GB (or more) virtual hard disk &lt;br&gt;
6️⃣ Click "Create" to finish setting up the VM.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 3: Configure VM Settings&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Before starting the VM, tweak a few settings for better performance:&lt;/p&gt;

&lt;p&gt;1️⃣ Go to "Settings" → "System" → "Processor" → Set at least 2 CPUs.&lt;br&gt;
2️⃣ Enable Network Bridging:&lt;/p&gt;

&lt;p&gt;Go to Settings → Network → Change "Attached to" Bridged Adapter (to make the VM accessible on your local network).&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.amazonaws.com%2Fuploads%2Farticles%2Fx8wtj4j9hhq0uq4q0z5p.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.amazonaws.com%2Fuploads%2Farticles%2Fx8wtj4j9hhq0uq4q0z5p.png" alt="Image description" width="754" height="465"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  Deploying Cowrie Using Docker
&lt;/h2&gt;

&lt;p&gt;Cowrie can be easily deployed using a Docker container, making setup and management much simpler. Below is how you can quickly get Cowrie running inside Docker.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1️⃣ Install Docker (If Not Installed)&lt;/strong&gt;&lt;br&gt;
First, install Docker on your system:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo apt update &amp;amp;&amp;amp; sudo apt install -y docker.io
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Enable and start the Docker service:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo systemctl enable --now docker
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Check if Docker is running:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;docker --version
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;2️⃣ Run Cowrie with Docker&lt;/strong&gt;&lt;br&gt;
To quickly start Cowrie using a pre-built Docker image, run:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo docker run -p 2222:2222 cowrie/cowrie:latest
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;-p 2222:2222&lt;/code&gt; → Exposes port 2222 on the host, forwarding it to the container.&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.amazonaws.com%2Fuploads%2Farticles%2Fxacr67fs29nytw4xwku4.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.amazonaws.com%2Fuploads%2Farticles%2Fxacr67fs29nytw4xwku4.png" alt="Image description" width="715" height="137"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3️⃣ Connect to the Cowrie Honeypot&lt;/strong&gt;&lt;br&gt;
Once the container is running, you can test SSH access:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;nmap -p 2222 -sV &amp;lt;server-ip&amp;gt;
&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.amazonaws.com%2Fuploads%2Farticles%2Fdgy8hto4escyfpoas68c.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.amazonaws.com%2Fuploads%2Farticles%2Fdgy8hto4escyfpoas68c.png" alt="Image description" width="800" height="246"&gt;&lt;/a&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;ssh -p 2222 root@localhost
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If using another machine on the same network, replace localhost with the server’s IP:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;ssh -p 2222 root@&amp;lt;server-ip&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Exposing Cowrie Running in Docker to the Internet
&lt;/h2&gt;

&lt;p&gt;In this section we will be doing the following:&lt;/p&gt;

&lt;p&gt;✅ Expose Cowrie (running in Docker) to the internet so real attackers can interact with it.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1️⃣ Expose Cowrie to the Internet&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;By default, Docker containers run in an isolated network. To make Cowrie publicly accessible, we need to:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Ensure the correct port is mapped&lt;/li&gt;
&lt;li&gt;Forward the port from your router&lt;/li&gt;
&lt;li&gt;Allow traffic through the firewall (UFW)&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;Step 1: Run Cowrie with Port Mapping&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;If your container is already running, stop and remove it first:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;docker stop cowrie &amp;amp;&amp;amp; docker rm cowrie
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now, restart Cowrie with proper port forwarding:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;docker run -d --name cowrie -p 2222:2222 cowrie/cowrie:latest
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now, test SSH access from another computer:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;ssh root@your-server-ip -p 2222
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If this works, move to the next step.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 2: Allow SSH Traffic in UFW (Firewall)&lt;/strong&gt;&lt;br&gt;
Make sure your firewall allows incoming SSH connections:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo ufw allow 2222/tcp
sudo ufw reload
sudo ufw status numbered

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;em&gt;Now, your server should allow SSH traffic on port 2222.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 3: Set Up Port Forwarding on Your Router (For Public Access)&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;To make your honeypot publicly accessible, you need to forward port 2222 on your router.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Log into your router settings (usually at 192.168.1.1).&lt;/li&gt;
&lt;li&gt;Find Port Forwarding / NAT Settings.&lt;/li&gt;
&lt;li&gt;Add a rule:&lt;/li&gt;
&lt;/ul&gt;

&lt;ol&gt;
&lt;li&gt; External Port: 2222&lt;/li&gt;
&lt;li&gt; Internal Port: 2222&lt;/li&gt;
&lt;li&gt; Protocol: TCP&lt;/li&gt;
&lt;li&gt;Destination IP: Your server’s local IP (e.g., 192.168.1.100).&lt;/li&gt;
&lt;/ol&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.amazonaws.com%2Fuploads%2Farticles%2F0hjje9mis4fvnujc89r1.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.amazonaws.com%2Fuploads%2Farticles%2F0hjje9mis4fvnujc89r1.png" alt="Image description" width="800" height="581"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Save the changes and restart your router.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Playing around with honeypot
&lt;/h2&gt;

&lt;p&gt;After running the previous Docker command to start Cowrie, our server is now actively accepting SSH connections.&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.amazonaws.com%2Fuploads%2Farticles%2F1nsx7kdu7hb3kd0pphef.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.amazonaws.com%2Fuploads%2Farticles%2F1nsx7kdu7hb3kd0pphef.png" alt="Image description" width="735" height="566"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Interacting with the Fake SSH Server&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Let’s test the honeypot by logging in from another machine:&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.amazonaws.com%2Fuploads%2Farticles%2Fh79nrfy113554b225cr9.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.amazonaws.com%2Fuploads%2Farticles%2Fh79nrfy113554b225cr9.png" alt="Image description" width="800" height="370"&gt;&lt;/a&gt;&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.amazonaws.com%2Fuploads%2Farticles%2Fxn0fgxl25nt2mkkyiz2c.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.amazonaws.com%2Fuploads%2Farticles%2Fxn0fgxl25nt2mkkyiz2c.png" alt="Image description" width="800" height="228"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Once connected, you’ll notice that Cowrie presents a fully interactive fake filesystem designed to mimic a real Linux server.&lt;/p&gt;

&lt;p&gt;Cowrie tricks attackers by allowing them to execute commands, navigate directories, and even try to download malicious tools.&lt;/p&gt;

</description>
      <category>cybersecurity</category>
      <category>honeypot</category>
      <category>sideprojects</category>
      <category>ubuntu</category>
    </item>
  </channel>
</rss>
