LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 01-05-2012, 07:02 PM   #1
sabresong
Member
 
Registered: Feb 2011
Location: Asheville, NC, USA
Distribution: Fedora 19
Posts: 36
Blog Entries: 1

Rep: Reputation: 2
Blocking domains at specific times


I'm trying to block access to specific domains during certain times of day. I know that can be done in the firewall using iptables rules, but the list of blocked domains may need to evolve over time. It seems the hosts file would be best, but is there a way to specify an alternate hosts file to be used between certain hours?
 
Old 01-05-2012, 07:29 PM   #2
pljvaldez
LQ Guru
 
Registered: Dec 2005
Location: Somewhere on the String
Distribution: Debian Wheezy (x86)
Posts: 6,094

Rep: Reputation: 272Reputation: 272Reputation: 272
You could write a script that could be run as a cronjob which replaces the hosts file twice a day.
 
Old 01-05-2012, 07:58 PM   #3
sabresong
Member
 
Registered: Feb 2011
Location: Asheville, NC, USA
Distribution: Fedora 19
Posts: 36

Original Poster
Blog Entries: 1

Rep: Reputation: 2
I actually thought about using crontab to copy a blocklist file to /etc/hosts.deny in the morning and a default in the evening, but when I tested the copy command
Code:
cp blocklist /etc/hosts.deny
both as a normal user and as root, nothing seemed to get copied. I checked with
Code:
less /etc/hosts.deny
. I'm new to this aspect of using Linux, but I've spent the day reading as much as I could find. Am I going about this wrong, or missing something?

EDIT: When I logged in this morning and tried again, the copy seemed to work fine, so that problem is solved. Don't know what caused it, but it's gone now.

Last edited by sabresong; 01-06-2012 at 07:21 AM. Reason: Something new has happened
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Blocking mail to specific domain from specific user orko Linux - Server 0 03-26-2009 03:18 PM
Allowing only certain hosts / domains while blocking the rest using IPTables? lolmannz Linux - Networking 2 10-19-2008 01:16 PM
Blocking mails from specific email addresses/domains in postfix jomy Linux - Networking 1 07-15-2008 09:32 PM
Limit Browser to specific domains whayford Linux - General 5 05-31-2006 08:49 AM
EXIM blocking domains n3r0 Debian 3 09-22-2004 09:23 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 04:01 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration