Security ยท Network

Security Through Obscurity

Why relying on secrecy alone is insufficient, plus practical tools for monitoring and responding to security threats.

๐Ÿ“… November 1, 2021 โฑ 15 min ๐Ÿ“Š Intermediate ๐Ÿ”„ Updated April 2026
๐Ÿ“– Also read: Practical Cybersecurity for Self-Hosters โ€” principles-first security guide with a tiered baseline checklist for 2026.

โš ๏ธ Security Experts' Position

"In security engineering, security through obscurity (or security by obscurity) is the reliance on the secrecy of the design or implementation as the main method of providing security for a system or component of a system. Security experts have rejected this view as far back as 1851, and advise that obscurity should never be the only security mechanism."

https://en.wikipedia.org/wiki/Security_through_obscurity

We often rely on our security being through some sort of obscurity. "If they don't know about it, they can't use it to get in." Common household door locks only have so many combinations, yet we can rely on the lock of our front doors because we know that a thief would have to try every combination or break-the-door-down. However, on the Internet, who is watching your front door, so a thief cannot try every combination?

Fortunately, our web-server has an access.log file that is automatically updated and archived for us.

Is anyone trying to gain access?

Terminal
cd /var/log/apache2/
zcat access.log* | awk '{print $1}' | sort -n | uniq -c | sort -nr | head -20

The output should be a list with two columns โ€” one containing the number of entries counted, and the second column is the IP address associated with each web request made. The easiest way to get the most information from a reverse IP lookup is by using the following command:

Terminal
# Example: Look up a suspicious IP
curl ipinfo.io/185.220.101.42
{
"ip": "185.220.101.42",
"city": "Moscow",
"region": "Moscow",
"country": "RU",
"org": "AS209797 Yandex LLC"
}

Rather than rely on an external web service, you can do some digging after you install some tools that are not included by default with the Pi:

Terminal
# Install geoip tools
sudo apt-get install geoip-bin
# Look up IP geographically
geoiplookup 185.220.101.42
GeoIP Database: Country Edition
185.220.101.42: RU, Russian Federation

โ˜… More Advanced Digging

Install dnsutils for DNS queries:

# Install DNS tools
sudo apt-get install dnsutils
# Reverse DNS lookup
dig -x 185.220.101.42
;; ANSWER SECTION:
101.220.185.in-addr.arpa. 3600 IN PTR 185-220-101-42.ip.infonow.ru.

Does the location seem suspicious? Try grepping for the activity โ€” the zgrep command includes compressed files:

Terminal
# Search access logs for a suspicious IP
zgrep '185.220.101.42' access.log* -1
access.log.1:185.220.101.42 - - [01/Nov/2016:14:23:45 +0000] "GET /wp-admin HTTP/1.1" 404 586
access.log.1:185.220.101.42 - - [01/Nov/2016:14:23:46 +0000] "GET /phpmyadmin HTTP/1.1" 404 591
access.log.1:185.220.101.42 - - [01/Nov/2016:14:23:47 +0000] "GET /admin HTTP/1.1" 404 578

By looking at the web requests that were made from the IP address, you can determine whether the activity is suspicious. Typically, you will find that these IP addresses are from bots looking for vulnerabilities in your security. You can manually block IP addresses to your blacklist or you can just deny all and allow select IP addresses. If you haven't already, you'll want to install and setup a firewall.

โš ๏ธ Modern Alternative: Automated Banning

Instead of manually blocking IPs, use fail2ban to automatically ban attackers. See Hardening a Self-Hosted Server for complete setup instructions.

Automated Protection with fail2ban

fail2ban monitors log files and automatically bans IPs showing malicious behavior. Here's a quick setup for Apache:

Terminal
# Install fail2ban
sudo apt-get install fail2ban
# Enable the Apache jail
sudo ln -s /etc/fail2ban/jail.conf /etc/fail2ban/jail.local
sudo systemctl enable fail2ban && sudo systemctl start fail2ban
# Check status
sudo fail2ban-client status apache-auth
Status for the jail: apache-auth
|- Currently banned: 3
|- Total banned: 47

After one week of running fail2ban on my server, it had automatically banned 47 IPs attempting to brute-force WordPress and phpMyAdmin โ€” none of which I would have caught manually.

More Info

โ† Back to Guides

Did this guide help?

Your answers shape what we write next.

Join the conversation.

Questions, experiences, or ideas โ€” we're listening.