time base restriction with iptables ?

Taking care of your Linux box.
Post Reply
kashif
Naib Subedar
Posts: 305
Joined: Wed Oct 15, 2003 2:44 am
Location: Okara

time base restriction with iptables ?

Post by kashif »

aoa,

I am able to restrict the squid traffic through time base ACL in squid.

I am not using masquerade and forwarding per ip like

Code: Select all


-A FORWARD -s 17x.x.53.54 -p tcp -m tcp --dport 443 -j ACCEPT

-A FORWARD -s 17x.x.53.54 -p tcp -m tcp --dport 1863 -j ACCEPT

-A FORWARD -s 17x.x.53.54 -p tcp -m tcp --dport 5190 -j ACCEPT
.
.
.
.

and at end

-A FORWARD -p tcp -m tcp --dport 443 -j DROP 
-A FORWARD -p tcp -j DROP 
-A FORWARD -p udp -j DROP

Now problem is that I want to allow above mentioned traffic from 9 to 5 pm only, and should be restricted for rest of the hours.


How to accomplish this task?
**********************************************

As-Salaatu was-Salaamu Alaika Ya Sayyidi Ya Rasool ALLAH

**********************************************
osama
Havaldaar
Posts: 117
Joined: Fri Aug 22, 2008 9:08 am

Post by osama »

You should create 2 scripts and call those scripts through cron at required times.
Or create one script with if-else statements checking time then call that script in cron at required times
Post Reply