LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 11-13-2010, 09:17 AM   #1
scolesworthy
LQ Newbie
 
Registered: Nov 2010
Posts: 1

Rep: Reputation: 0
Question how to make a URL available only during certain times of day


Hello,

Does someone know of a tool that can be used to that will produce this result:

When navigating to specific URL M-F 8 am to 5 pm any computer will receive an error message or be re-routed to a static site that something such as, "This site is only available during these hours."

When navigating to that same URL during the other hours it will work as intended.

The function needs to work with no intervention needed to the browsing computer or network.
 
Old 11-13-2010, 09:24 AM   #2
GrapefruiTgirl
LQ Guru
 
Registered: Dec 2006
Location: underground
Distribution: Slackware64
Posts: 7,594

Rep: Reputation: 556Reputation: 556Reputation: 556Reputation: 556Reputation: 556Reputation: 556
Here's a brief article about "iptables - match by day/time of day", which is the method I would pursue if I were looking into this:
http://www.cyberciti.biz/tips/iptabl...me-of-day.html

You could implement the iptables rule on the outermost firewall, or on the very machine which you are controlling access to.

I'm not sure about returning a specific "Page not found" error - to go that route, you may need to do something right within apache, and I am not familiar with how to do that at all. Someone else may have an idea. Or, perhaps during the "off" time of day, requests are simply forwarded to your special "During business hours only.." message (again using iptables, not apache. One rule for the good hours, forwards as expected, and a second rule for the bad hours, forwarded to the "we're closed" page.).

Googling for "iptables time of day" also returns loads of results. And, the iptables manpage and main site ( http://www.netfilter.org/ ) should also be of help.

Once you have your rule(s) written, if they aren't working as expected, show us what you've got and perhaps someone can help you debug.

Cheers & good luck!

Last edited by GrapefruiTgirl; 11-13-2010 at 09:28 AM.
 
Old 11-13-2010, 10:00 AM   #3
TobiSGD
Moderator
 
Registered: Dec 2009
Location: Germany
Distribution: Whatever fits the task best
Posts: 17,148
Blog Entries: 2

Rep: Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886
I think the iptables approach is only suitable if there is only one site hosted on the machine (maybe I misunderstand that).
Wouldn't this be a simple copy job using cron?
 
Old 11-13-2010, 10:13 AM   #4
GrapefruiTgirl
LQ Guru
 
Registered: Dec 2006
Location: underground
Distribution: Slackware64
Posts: 7,594

Rep: Reputation: 556Reputation: 556Reputation: 556Reputation: 556Reputation: 556Reputation: 556
I don't believe it would matter how many sites were hosted on a given machine. The time of day rule would just act on traffic FROM internet, TO <whatever destination(s)>, so it could be done for a single site, or many.

But, you're right, a cronjob might be another way to do this also. Perhaps a cron that adds and removes iptables rules (or rulesets) at the specified times - is this what you're thinking TobiSGD? IMO slightly clunkier than using iptables alone, plus it potentially interrupts the network momentarily during the ruleset change, but it could work...
 
Old 11-13-2010, 02:55 PM   #5
never say never
Member
 
Registered: Sep 2009
Location: Indiana, USA
Distribution: SLES, SLED, OpenSuse, CentOS, ubuntu 10.10, OpenBSD, FreeBSD
Posts: 195

Rep: Reputation: 37
Squid setup as a transparent proxy will allow you to do what you want.

Requires no changes to end users browser or computer, simply routes all HTTP requests through the proxy.
 
Old 11-13-2010, 03:01 PM   #6
TobiSGD
Moderator
 
Registered: Dec 2009
Location: Germany
Distribution: Whatever fits the task best
Posts: 17,148
Blog Entries: 2

Rep: Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886
Quote:
Originally Posted by GrapefruiTgirl View Post
Perhaps a cron that adds and removes iptables rules (or rulesets) at the specified times - is this what you're thinking TobiSGD?
No, that was not what I was thinking of, but it is a much more intelligent approach. I was thinking of copying a "Sorry, this service is only available between ..."-site to the www-folder and copying the original index.html back at given times. But this will not work with bookmarks set to subpages.
 
Old 11-13-2010, 08:55 PM   #7
allend
LQ 5k Club
 
Registered: Oct 2003
Location: Melbourne
Distribution: Slackware64-15.0
Posts: 6,371

Rep: Reputation: 2750Reputation: 2750Reputation: 2750Reputation: 2750Reputation: 2750Reputation: 2750Reputation: 2750Reputation: 2750Reputation: 2750Reputation: 2750Reputation: 2750
If you are connecting to the internet using a modem/router, then you are likely to find this functionality available in the firewall rules setup for the modem/router.
 
  


Reply



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 On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Having To Restart Ubuntu Several Times A Day! = FAIL! Sumguy Linux - Newbie 38 08-24-2010 01:40 PM
Squid and Dansguardian in use, but users to bypass proxy on certain times of the day codenjanod Linux - Server 1 09-25-2009 11:47 AM
System freezes a couple of times a day Fugazi Fedora 12 01-02-2009 05:44 PM
squid + bandwidth cutoff at specific times of day avirup dasgupta Linux - Networking 2 09-01-2005 02:42 AM
iptables : Restrict access at certain times of day J-Ben Linux - Newbie 1 03-28-2004 09:38 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 04:31 PM.

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
Open Source Consulting | Domain Registration