How to block domains that match a keyword?

Login or Register for Dates, Times and to Reply

Thread Tools Search this Thread
# 1  
How to block domains that match a keyword?

I want to know, for internet access, if there is an easy way to filter domain names, on your Linux box, that match certain key(s) without using squid. For example, if you want to block you add the following lines in your /etc/hosts file:

this will only block the domain However,
Code:  *ample*  *ample*
::0      *ample*
::0      *ample*

won't work. I am basically trying to block all domains which contain specific keywords which I provide. Is there a way to get this keyword-match domain filtering work without using squid? Thanks.
# 2  
Have you tried TCP wrappers?

Last edited by Scrutinizer; 12-24-2017 at 03:09 AM..
# 3  
Originally Posted by milhan
For example, if you want to block you add the following lines in your /etc/hosts file:
What you need is a firewall, like the one Scrutinizer has suggested.

Notice that the way you describe you do NOT "block" any domain, you just make sure that the name associated with the domain cannot be reliably translated into an IP-address any more. This is more like painting over a certain name in the telephone book with a black marker: you cannot look up the name and its associated number any more, but everybody who knows the telephone number (or has other means to find it out) could still call it.

I hope this helps.

Login or Register for Dates, Times and to Reply

Previous Thread | Next Thread
Thread Tools Search this Thread
Search this Thread:
Advanced Search

Test Your Knowledge in Computers #23
Difficulty: Easy
One Terabyte (1 TB) is equal to 1000 GB.
True or False?

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

awk to match keyword and return matches and unique fields

Trying to use awk to find a keyword and return the matches in the row, but also $1 and $2, which are the unique id's, but they only appear once. Thank you :). file name 31 Index Chromosomal Position Gene Inheritance 122 2106725 TSC2 AD 124 2115481 TSC2 AD 121 2105400 TSC2 AD... (6 Replies)
Discussion started by: cmccabe
6 Replies

2. IP Networking

VLANs and their domains

Hey everyone. I work in a data center, and I'm working on getting my CCNA. Now when I read articles on the idea of VLAN's it makes sense. Especially if you have multiple switches daisy chained in multiple locations. My two main questions though are that most of these examples use PC's as examples... (2 Replies)
Discussion started by: Lost in Cyberia
2 Replies

3. Shell Programming and Scripting

Search for a Keyword in file and replace another keyword or add at the end of line

Hi I want to implement something like this: if( keyword1 exists) then check if(keyword2 exists in the same line) then replace keyword 2 with New_Keyword else Add New_Keyword at the end of line end if eg: Check for Keyword JUNGLE and add/replace... (7 Replies)
Discussion started by: dashing201
7 Replies

4. Shell Programming and Scripting

Using sed to pattern match within a particular multiline block and take action

Hi all, This is my first post, so please go easy if I broke some rules. Not accustomed to posting in forums... :) I'm looking for help on pattern matching within a multiline block and looking to highlight blocks/block-ids that do NOT contain a particular pattern. For example an input file... (5 Replies)
Discussion started by: tirodad
5 Replies

5. UNIX for Dummies Questions & Answers

Sub domains from report

Hi, I have a report containing severals organization's email address. The address contain several sub domains, and i need to pull those out. mail domain ( .................. The report column contain mail address in this format : (2 Replies)
Discussion started by: john_prince
2 Replies

6. Shell Programming and Scripting

SED, match a line block

Hello, I want to do a simple substitution using sed but I can't find a solution. Basically, from a Apache conf file, I would like to remove everything included between the <VirtualHost> and </VirtualHost> e.g SSLMutex file:/var/run/ssl_mutex <VirtualHost _default_:443> # A lot of config that... (5 Replies)
Discussion started by: RobertFord
5 Replies

7. Shell Programming and Scripting

delete block of lines when pattern does not match

I have this input file that I need to remove lines which represents more than 30 days of processing. Input file: On 11/17/2009 at 12:30:00, Program started processing...argc=7 Total number of bytes in file being processed is 390 Message buffer of length=390 was allocated successfully... (1 Reply)
Discussion started by: udelalv
1 Replies

8. UNIX for Advanced & Expert Users

Different Nameservers for Different Domains?

I have a system that is connected to a private network with its own DNS (call it "privnet."), and is also connected to the Internet on a separate interface. Is it possible to convince this server to query the private nameserver for the private network's domain (e.g. "host foo.privnet."), and the... (2 Replies)
Discussion started by: vertigo23
2 Replies

9. Shell Programming and Scripting

Match keyword on string and substitute under vi

Hi guys, with sed when I need to make a substitution inside a line containing a specific keyword, I usually use: sed '/keyword/ s/cat/dog/g' This will substitute "cat" with "dog" on those lines containing "keyword". Now I want to use this inside vi, for several reason that I cannot... (2 Replies)
Discussion started by: lycaon
2 Replies

10. UNIX for Dummies Questions & Answers

creating domains

ok i am setting up dns or going to do it with solaris 9 once u setup the domain what file can u look @ to see if it setup or not (4 Replies)
Discussion started by: rmuhammad
4 Replies

Featured Tech Videos