<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Pki on Mohamed Raid TechBlog</title><link>https://mraid.in/tags/pki/</link><description>Recent content in Pki on Mohamed Raid TechBlog</description><generator>Hugo -- gohugo.io</generator><language>en</language><lastBuildDate>Thu, 11 Jun 2026 18:08:34 -0400</lastBuildDate><atom:link href="https://mraid.in/tags/pki/index.xml" rel="self" type="application/rss+xml"/><item><title>BasicServerSetup</title><link>https://mraid.in/posts/basicserversetup/</link><pubDate>Wed, 17 Jun 2026 20:30:48 -0400</pubDate><guid>https://mraid.in/posts/basicserversetup/</guid><description>&lt;p&gt;In this article I will cover the first steps you should do when booting up a fresh new (Cloud VM, VPS, Bare Metal Server, etc.), I will be referring to this article in the future.&lt;/p&gt;
&lt;p&gt;The steps are simple but very important to guard the security of your online resources. Nobody wants to fall victim to a simple bot crawling the internet and bombarding sites with basic exploits or even password spraying attacks!! So let&amp;rsquo;s dive right in.&lt;/p&gt;
&lt;h3 id="log-in-as-root"&gt;Log in as ROOT&lt;/h3&gt;
&lt;p&gt;Just &lt;strong&gt;ssh&lt;/strong&gt; to your IP and log in to your root account&lt;/p&gt;
&lt;h3 id="create-a-non-root-user-with-sudo-privileges"&gt;Create a non-root user with &lt;strong&gt;sudo&lt;/strong&gt; privileges&lt;/h3&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;adduser MY-NEW-USER
usermod -aG sudo MY-NEW-USER
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Give your new user a nice long password with letters, characters, numbers. Or just use a password generator.&lt;/p&gt;
&lt;h3 id="setup-ssh-for-new-user"&gt;Setup SSH for new user&lt;/h3&gt;
&lt;p&gt;On your local machine generate a key pair&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;ssh-keygen -t ed25519
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;this will create two files: a private and a public key.
Go ahead and copy the contents of the public key then login to the remote server create the (~/.ssh/authorized_keys) file then paste the contents there.
Try logging in as the newly created user with the ssh. If succeded close the window where you&amp;rsquo;re logged in root.&lt;/p&gt;
&lt;h3 id="most-cloud-providers-will-just-prompt-you-for-a-username-and-password-while-resource-provisioning-this-user-will-have-sudo-privileges-and-the-root-account-would-be-disabled-by-default-if-you-want-to-change-the-root-password-just"&gt;Most Cloud Providers will just prompt you for a username and password while resource provisioning, this user will have sudo privileges and the root account would be disabled by default. If you want to change the root password just&lt;/h3&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;sudo passwd root
&lt;/code&gt;&lt;/pre&gt;&lt;h3 id="enhancing-the-security"&gt;Enhancing the Security&lt;/h3&gt;
&lt;p&gt;let&amp;rsquo;s disable password login for ssh, this is really important to fend off password spraying attacks. Just edit the /etc/ssh/sshd_config file by setting the &lt;strong&gt;PasswordAuthentication no&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;disable the root Login by setting &lt;strong&gt;PermitRootLogin no&lt;/strong&gt; then reload the ssh daemon.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;sudo systemctl reload sshd
&lt;/code&gt;&lt;/pre&gt;&lt;h4 id="change-the-default-ssh-port-now-this-will-not-protect-you-against-ai-bots-but-it-will-limit-scanning"&gt;change the default ssh port, now this will not protect you against AI bots but it will limit scanning.&lt;/h4&gt;
&lt;h4 id="i-recommend-using-your-cloud-provider-firewall-to-limit-ip-ranges-that-can-connect-to-your-server"&gt;I recommend using your cloud provider firewall to limit IP ranges that can connect to your server.&lt;/h4&gt;
&lt;h3 id="setting-up-a-firewall"&gt;Setting up a firewall&lt;/h3&gt;
&lt;p&gt;install &lt;strong&gt;UFW&lt;/strong&gt; if it is not already installed then allow the Openssh service and enable the firewall&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;ufw allow OpenSSH
ufw enable
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>SetupOPENVPN</title><link>https://mraid.in/posts/setupopenvpn/</link><pubDate>Thu, 11 Jun 2026 18:08:34 -0400</pubDate><guid>https://mraid.in/posts/setupopenvpn/</guid><description>&lt;p&gt;During a slow morning I decided to Setup an Openvpn Server following this &lt;a href="https://digitalocean.com/community/tutorials/how-to-set-up-and-configure-an-openvpn-server-on-ubuntu-20-04"&gt;tutorial&lt;/a&gt;.
This is going to be a long article but it is very rich and will help me understand a lot about networking, server setup, pki, and security.&lt;/p&gt;
&lt;p&gt;I am going to be using Azure today.
Let&amp;rsquo;s boot up the first vm, this will be the Openvpn server you won&amp;rsquo;t need something powerful 2gigs of ram is very fine.&lt;/p&gt;
&lt;p&gt;&lt;img src="https://mraid.in/Openvpn/Azure-Dashboard.png" alt="Azure Portal"&gt;&lt;/p&gt;
&lt;h3 id="basic-server-hygiene"&gt;Basic server Hygiene&lt;/h3&gt;
&lt;p&gt;I chose ubuntu server 24.04.4 LTS, the firsstep you need to do after logging in is to disable root ssh login and only login with a non root user. This is done automatically in Azure if you chose the ssh auth during setup, you just have to set PasswordAuthentication to no in the /etc/ssh/sshd_config file then restart ssh.&lt;/p&gt;
&lt;p&gt;Now go ahead and update system then install necessary packages.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;sudo apt upgrade &amp;amp;&amp;amp; sudo apt update
sudo apt install openvpn easy-rsa
&lt;/code&gt;&lt;/pre&gt;&lt;h3 id="configure-easyrsa"&gt;Configure easyrsa&lt;/h3&gt;
&lt;p&gt;after installing easy rsa make a directory then create a symlink from the /usr/share/easy-rsa/* to that directory, you can just copy then contents there instead of the symlink then restrict the access to that directory using the chomd command.&lt;/p&gt;
&lt;h5 id="creating-a-pki-infra"&gt;Creating a pki infra&lt;/h5&gt;
&lt;p&gt;we need to set up easy-rsa to use the elleptic curve Cryptography this will use a shorter keys thus better performance.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;set_var EASYRSA_ALGO &amp;#34;ec&amp;#34;
set_var EASYRSA_DIGEST &amp;#34;sha512&amp;#34;
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;then initiate easy-rsa&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;./easyrsa init-pki
&lt;/code&gt;&lt;/pre&gt;&lt;h3 id="setting-up-the-ca"&gt;Setting up the CA&lt;/h3&gt;
&lt;p&gt;boot up another vm, this will be used as the CA which is going to verify each client request.&lt;/p&gt;
&lt;p&gt;&lt;img src="https://mraid.in/Openvpn/CreateCA.png" alt="Setup CA"&gt;.&lt;/p&gt;
&lt;h3 id="generate-a-csr-request-and-a-private-key"&gt;Generate a CSR request and a private key&lt;/h3&gt;
&lt;p&gt;On your Openvpn server, navigate to the easy-rsa directory then generate a csr with this command and then copy the key to then openvpn config directory.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;./easyrsa gen-req server nopass
sudo cp /home/USERNAME/easy-rsa/pki/private/server.key /etc/openvpn/server/
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;the &amp;ldquo;server&amp;rdquo; is our CN (common name).&lt;/p&gt;
&lt;h3 id="sign-the-server-csr-request-with-the-ca"&gt;Sign The server CSR request with the CA&lt;/h3&gt;
&lt;p&gt;transmit the files from the openvpn server to the CA server&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;scp /home/USERNAME/easy-rsa/pki/reqs USERNAME@CASERVERIP:/tmp
cd ~/easy-rsa
./easyrsa import-req /tmp/server.req server
./easyrsa sign-req server server
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;&lt;img src="https://mraid.in/Openvpn/importrequest.png" alt="importing the request"&gt;
&lt;img src="https://mraid.in/Openvpn/SignCSR.png" alt="Signing the request"&gt;&lt;/p&gt;
&lt;p&gt;after signing the CSR transfer back the certificates to Openvpn server, then transfer them to /etc/openvpn/server&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;scp pki/issued/server.crt USERNAME@VPNSERVERIP:/tmp
scp pki/ca.crt USERNAME@VPNSERVERIP:/tmp
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;create a shared secret key that&amp;rsquo;ll be used by both the client and the server if a packet is signed with this key it&amp;rsquo;ll be trusted, if it is not it can be discarded.
generate it in the easy-rsa directory then transfer it to the /etc/openvpn/server&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;openvpn --genkey --secret ta.key
sudo cp ta.key /etc/openvpn/server
&lt;/code&gt;&lt;/pre&gt;&lt;h3 id="generating-client-certificates"&gt;Generating Client Certificates&lt;/h3&gt;
&lt;p&gt;Create a directory that&amp;rsquo;ll hold client configs, keys etc &amp;hellip;
Restrict access for that directory for better security&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;mkdir -p ~/client-configs/keys
chmod -R 700 ~/client-configs
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Go back to the easy-rsa directory and generate a CSR just like we did before, then transfer the key to the keys folder and the request to the CA server
&lt;img src="https://mraid.in/Openvpn/clientkeyCertificateGen.png" alt="generating the request"&gt;&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;cp pki/private/client1.key ~/client-configs/keys/
scp pki/reqs/client1.req USERNAME@CASERVERIP:/tmp
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Import the request and sign it
&lt;img src="https://mraid.in/Openvpn/signing-client-certificate.png" alt="Sign the request"&gt;
transfer back the signed certificate to the vpn server and put it in the keys directory, then copy the CA certificate and the shared key to the client-configs/keys/ .&lt;/p&gt;
&lt;h4 id="configure-the-openvpn"&gt;Configure the Openvpn&lt;/h4&gt;
&lt;p&gt;copy the sample config to your Openvpn directory&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;sudo cp /usr/share/doc/openvpn/examples/sample-config-files/server.conf.gz /etc/openvpn/server/
sudo gunzip /etc/openvpn/server/server.conf.gz
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;edit the /etc/openvpn/server/server.conf and add these basic configs&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;;tls-auth ta.key 0 # This file is secret
tls-crypt ta.key
;cipher AES-256-CBC
cipher AES-256-GCM
auth SHA256
;dh dh2048.pem
dh none
user nobody
group nogroup
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;&lt;img src="https://mraid.in/Openvpn/editopenvpnconfig.png" alt="OpenVpn Config"&gt;&lt;/p&gt;
&lt;h3 id="edit-the-port-forwarding-config"&gt;Edit the Port Forwarding config&lt;/h3&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;sudo nano /etc/sysctl.conf
net.ipv4.ip_forward = 1
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;then write this command sudo sysctl -p if the output is 1 . then you&amp;rsquo;re ok .
this is very important any misconfiguration will cause tunneling issues later.&lt;/p&gt;
&lt;h3 id="firewall-configuration"&gt;Firewall Configuration&lt;/h3&gt;
&lt;p&gt;get the name of your interface, now let&amp;rsquo;s edit the /etc/ufw/before.rules file. By adding these commands, keep in mind that eth0 is interface name yours may be different.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;# START OPENVPN RULES
# NAT table rules
*nat
:POSTROUTING ACCEPT [0:0]
# Allow traffic from OpenVPN client to eth0 (change to the interface you discovered!)
-A POSTROUTING -s 10.8.0.0/8 -o eth0 -j MASQUERADE
COMMIT
# END OPENVPN RULES
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Edit the /etc/default/ufw file by setting DEFAULT_FORWARD_POLICY to ACCEPT.&lt;/p&gt;
&lt;p&gt;allow the openvpn port and openssh service. I&amp;rsquo;ve kept the default port&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;sudo ufw allow 1194/udp
sudo ufw allow OpenSSH
sudo ufw disable
sudo ufw enable
&lt;/code&gt;&lt;/pre&gt;&lt;h3 id="starting-the-server"&gt;Starting the Server&lt;/h3&gt;
&lt;p&gt;Go Ahead and start the server
&lt;img src="https://mraid.in/Openvpn/Startopenvpnserver.png" alt="Start the Server"&gt;&lt;/p&gt;
&lt;h3 id="creating-the-client-configurations"&gt;Creating the Client Configurations&lt;/h3&gt;
&lt;p&gt;We will create a files directory inside the client configs directory where we will make a base configuration and an automating script that&amp;rsquo;ll make it easy in case of creating multiple users.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;cp /usr/share/doc/openvpn/examples/sample-config-files/client.conf ~/client-configs/base.conf
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;the create the base config file which will serve as a config blueprint ~/client-configs/base.conf&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;. . .
# The hostname/IP and port of the server.
# You can have multiple remote entries
# to load balance between the servers.
remote your_server_ip 1194
. . .
proto udp
# Downgrade privileges after initialization (non-Windows only)
user nobody
group nogroup
# SSL/TLS parms.
# See the server config file for more
# description. It&amp;#39;s best to use
# a separate .crt/.key file pair
# for each client. A single ca
# file can be used for all clients.
;ca ca.crt
;cert client.crt
;key client.key
# If a tls-auth key is used on the server
# then every client must also have the key.
;tls-auth ta.key 1
cipher AES-256-GCM
auth SHA256
key-direction 1
; script-security 2
; up /etc/openvpn/update-resolv-conf
; down /etc/openvpn/update-resolv-conf
; script-security 2
; up /etc/openvpn/update-systemd-resolved
; down /etc/openvpn/update-systemd-resolved
; down-pre
; dhcp-option DOMAIN-ROUTE .
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Now for the automation script ~/client-configs/make_config.sh&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;#!/bin/bash
# First argument: Client identifier
KEY_DIR=~/client-configs/keys
OUTPUT_DIR=~/client-configs/files
BASE_CONFIG=~/client-configs/base.conf
cat ${BASE_CONFIG} \
&amp;lt;(echo -e &amp;#39;&amp;lt;ca&amp;gt;&amp;#39;) \
${KEY_DIR}/ca.crt \
&amp;lt;(echo -e &amp;#39;&amp;lt;/ca&amp;gt;\n&amp;lt;cert&amp;gt;&amp;#39;) \
${KEY_DIR}/${1}.crt \
&amp;lt;(echo -e &amp;#39;&amp;lt;/cert&amp;gt;\n&amp;lt;key&amp;gt;&amp;#39;) \
${KEY_DIR}/${1}.key \
&amp;lt;(echo -e &amp;#39;&amp;lt;/key&amp;gt;\n&amp;lt;tls-crypt&amp;gt;&amp;#39;) \
${KEY_DIR}/ta.key \
&amp;lt;(echo -e &amp;#39;&amp;lt;/tls-crypt&amp;gt;&amp;#39;) \
&amp;gt; ${OUTPUT_DIR}/${1}.ovpn
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;restrict the rights of the file for better security.&lt;/p&gt;
&lt;h3 id="generate-the-ovpn-config-file"&gt;Generate the .ovpn config file&lt;/h3&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;cd ~/client-configs
./make_config.sh client1
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;transfer back the .ovpn file to the client and import it and thaaaaat&amp;rsquo;s it.&lt;/p&gt;
&lt;h3 id="testing"&gt;Testing&lt;/h3&gt;
&lt;p&gt;Before
&lt;img src="https://mraid.in/Openvpn/myipbefore.png" alt="Ip Before"&gt;
After
&lt;img src="https://mraid.in/Openvpn/myipafter.png" alt="Ip After"&gt;&lt;/p&gt;</description></item><item><title>SplunkBasics Did You Siem Room</title><link>https://mraid.in/posts/splunkbasics-did-you-siem-room/</link><pubDate>Thu, 28 May 2026 18:56:58 -0400</pubDate><guid>https://mraid.in/posts/splunkbasics-did-you-siem-room/</guid><description>&lt;p&gt;a while ago I&amp;rsquo;ve found this room on tryhack me and since it&amp;rsquo;s an introduction to splunk I decided to do it . I&amp;rsquo;m increasingly more interested in splunk and soon I&amp;rsquo;ll be building a local
lab and using it as the siem solution.&lt;/p&gt;
&lt;p&gt;The room&amp;rsquo;s story is about a company TBFG gets attacked with a ransomware while preparing for Christmas, you being part of the SOC team are tasked to use Splunk to investigate the breach and trace the attack chains to save the day !!&lt;/p&gt;
&lt;p&gt;The Guide is full of information from the Dashboard components like the search Query bar to the time dropdown. it also gives you scenarios and examples of queries you&amp;rsquo;ll use. So let&amp;rsquo;s get started !&lt;/p&gt;
&lt;p&gt;Question 1: What is the IP attacking the Web Server?&lt;/p&gt;
&lt;p&gt;For this we need to set the sourcetype to web_traffic then narrowing the search by execluding the usual and normal clients and browser using the useragent field, next we need set a count and get the top five(example), because a suspicious IP will be making a BIG number of calls to the server.&lt;/p&gt;
&lt;p&gt;The command will look like this :&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;sourcetype=web_traffic user_agent!=*Mozilla* user_agent!=*Chrome* user_agent!=*Safari* user_agent!=*Firefox* | stats count by client_ip | sort -count | head 5
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;&lt;img src="https://mraid.in/SplunkBasics/SuspiciousClientIP.png" alt="*"&gt;
Answer will be 198.51.100.55&lt;/p&gt;
&lt;p&gt;Question 2: Which day saw the peak traffic in the logs?&lt;/p&gt;
&lt;p&gt;We will funnel the logs to the timechart command and use the span of 1 day and the reverse the order to get the most traffic in one day&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;index=main sourcetype=web_traffic | timechart span=1d count | sort by count | reverse
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;&lt;img src="https://mraid.in/SplunkBasics/eventsbyday.png" alt="*"&gt;
Answer is 2025-10-12&lt;/p&gt;
&lt;p&gt;Question 3: Count the Havij user_agent found in the logs&lt;/p&gt;
&lt;p&gt;Since we got the Ip of the attacker we can just set it as one of the fields in our query together with the given useragent and then count everything&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;sourcetype=web_traffic client_ip=198.51.100.55 user_agent=&amp;#34;*Havij*&amp;#34; | stats count
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Answer is 993&lt;/p&gt;
&lt;p&gt;Question 4: How many path traversal attempts to acces sensitive files?&lt;/p&gt;
&lt;p&gt;So path traversal attempts can be recongnised when the attacker adds ../../ in the paths of his queries (for example), we will also include the redirects&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;sourcetype=web_traffic client_ip=198.51.100.55 AND path=&amp;#34;*..\/..\/*&amp;#34; OR path=&amp;#34;*redirect*&amp;#34; | stats count by path
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Answer is 658&lt;/p&gt;
&lt;p&gt;Question 5: How many bytes transferred to the C2 server based on the firewall logs&lt;/p&gt;
&lt;p&gt;First thing is to change the sourcetype to the firewall logs, we need to focus on the allowed actions and set the destination ip as the attacker&amp;rsquo;s ip determined earlier the pipe the results to the sum function&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;sourcetype=firewall_logs src_ip=&amp;#34;10.10.1.5&amp;#34; AND dest_ip&amp;#34;198.51.100.55&amp;#34; AND action=&amp;#34;ALLOWED&amp;#34; | stats sum(bytes_transferred) by src_ip
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;&lt;img src="https://mraid.in/SplunkBasics/Mark.png" alt="*"&gt;
In this Lab I&amp;rsquo;ve learned about investigations with splunk and using some SPL keywords, it is a very powerful tool with a simple dashboard I&amp;rsquo;m looking forward to learn and experience more with it&lt;/p&gt;</description></item><item><title>Setting up PIHOLE as a recursive DNS with UNBOUND</title><link>https://mraid.in/posts/pihole-dns/</link><pubDate>Sat, 16 May 2026 13:36:41 -0400</pubDate><guid>https://mraid.in/posts/pihole-dns/</guid><description>&lt;p&gt;this is a small project that i did in a weekend a while ago to experiment with the dns protocol , it is based on guide by &lt;a href="https://youtube.com/@CraftComputing"&gt;Craft Computing&lt;/a&gt; , you can check
him out .&lt;/p&gt;
&lt;h1 id="dns-"&gt;DNS :&lt;/h1&gt;
&lt;p&gt;Essentially Dns helps you translate domain names such as (google.com , youtube.com) into IP-addresses (A and AAAA) records that computers actually understand , of course dns provide additional informations which you can find in the other records but this is outside the scope of this tutorial.&lt;/p&gt;
&lt;h1 id="recursive-dns-"&gt;Recursive DNS :&lt;/h1&gt;
&lt;p&gt;There are multiple types of Dns servers , an &lt;strong&gt;authoritative server&lt;/strong&gt; this is the server that actually holds the info about your domain , &lt;strong&gt;Recursive server&lt;/strong&gt; this server when queried will check if it holds data in case of absense it will call the root server get the info about &lt;strong&gt;the TLD SERVER&lt;/strong&gt; of your domain then it will ask the tld server about the info of your authoritative server finally it will query it about the IP-address that corresponds to that domain , most recursive dns servers are ran by &lt;strong&gt;ISPs , Big operators&lt;/strong&gt; but anyone can set tis own recursive server like we will be doing !!&lt;/p&gt;
&lt;p&gt;let&amp;rsquo;s get to know &lt;strong&gt;PIHOLE&lt;/strong&gt; : pihole is a network-wide DNS-based AD blocking sinkhole where you define a list of domains that you want to block in your network, it is very easy to set-up as we will see.&lt;/p&gt;
&lt;h1 id="installation-"&gt;Installation :&lt;/h1&gt;
&lt;p&gt;For this tutorial I&amp;rsquo;ve installed a debian server on a virtual machine , I then proceeded to install pi-hole it is very easy just follow the &lt;a href="https://github.com/pi-hole/pi-hole/#one-step-automated-install"&gt;installation guide&lt;/a&gt; , after downloading go ahead with the defaults we will configure it later &lt;img src="https://mraid.in/pihole-unbound/download.png" alt="downloading pihole"&gt;&lt;/p&gt;
&lt;p&gt;After the installation make sure to change the default password of pi-hole with the command pihole -a -p &amp;ldquo;newpassword&amp;rdquo;, login to your dashboard and let&amp;rsquo;s start the configurations.&lt;/p&gt;
&lt;p&gt;Go ahead and install unbound &lt;img src="https://mraid.in/pihole-unbound/INSTALLUNBOUND.png" alt="install unbound"&gt; , we are going to change the config file so there will be no port confusion between unbound and pihole you can follow this &lt;a href="https://docs.pi-hole.net/guides/dns/unbound"&gt;guide&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;after finishing that go to the dashboard and change the dns server of pihole from google to custom &lt;img src="https://mraid.in/pihole-unbound/settingpiholeforunbound.png" alt="config unbound for pihole"&gt; then type the address and port , then change the dns server of your &lt;strong&gt;system&lt;/strong&gt; to be pihole by editing the /etc/resolv.conf file .&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;VOILA we&amp;rsquo;re finished&lt;/strong&gt; open up a browser and try accessing a website that&amp;rsquo;s rich in ads , first time it will take some time because the dns server has an empty cache .&lt;/p&gt;
&lt;p&gt;I also set up a light vm i used &lt;strong&gt;alpine&lt;/strong&gt; for this then went ahead and gave the debian machine a static IP , since i&amp;rsquo;m on debian I edited /etc/network/interfaces file then I restarted the networking service , then I set the dns server of alpine to be the IP of the debian machine and voila it works.&lt;/p&gt;
&lt;p&gt;pihole blocks a wide list of ads by default but you can widen this list by adding lists from the internet, this is a &lt;a href="https://raw.githubusercontent.com/vermaden/scripts/master/unbound-blacklist-fetch-huge.sh"&gt;script&lt;/a&gt; that automatically downloads a list for you.&lt;/p&gt;
&lt;p&gt;or you can ban websites that you don&amp;rsquo;t like example &lt;img src="https://mraid.in/pihole-unbound/testingblockeddomain1.png" alt="banned a website"&gt; &lt;img src="https://mraid.in/pihole-unbound/browsertestpihole.png" alt="browser result"&gt;&lt;/p&gt;
&lt;h3 id="i-hope-this-benefitted-someone-"&gt;I hope this benefitted someone !!&lt;/h3&gt;</description></item></channel></rss>