ClearOS Documentation



301 error for file:

User Tools

Site Tools

Setting up the Content Filter to apply different rules at different times

ClearOS has the ability to turn off ALL access or to turn on access to the Internet at different times but if you need different content filters to function at different times, you will need to look elsewhere. Never fear, this howto exists.

Setting up different filter policies

Basically, you will set up the content filter how you want it for a specific time period. Start by making your content filter policy work the way you want it. Once you have all your profiles in place and your policies defined, we will back them up:

mkdir /root/support /root/support/contentfilter /root/support/contentfilter/policy1
yum -y install rsync
rsync -av /etc/dansguardian-av/* /root/support/contentfilter/policy1/

Next, make your second policy the way you want it for your second timeslot:

mkdir /root/support/contentfilter/policy2
rsync -av /etc/dansguardian-av/* /root/support/contentfilter/policy2/

Then we create a script that activates the one configuration and another which activates the other. This simply entails making a copy of the one configuration to replace the /etc/dansguardian-av directory from the master and reloading the content filter service.

The script will look something like this:

nano /root/support/contentfilter/
/usr/bin/rsync -a /root/support/contentfilter/policy1/* /etc/dansguardian-av/
/sbin/service dansguardian-av reload

The other script will look like this:

nano /root/support/contentfilter/
/usr/bin/rsync -a /root/support/contentfilter/policy2/* /etc/dansguardian-av/
/sbin/service dansguardian-av reload

Now make these executable:

chmod +x /root/support/contentfilter/activatepolicy[12].sh

Try then out:


Once you are satisfied with how they work you merely need to make a schedule for how they operate. For example, let us say that your company needs to use policy1 between the hours of 8 and 5 every workday but afterhours and on weekends policy2 should run. We will need to edit the crontab to put that rule into effect. For this you need to know 'vi'.

crontab -e

Add these entries for the above scenario:

0       8       *       *       1-5     /root/support/contentfilter/
0       17      *       *       *       /root/support/contentfilter/
content/en_us/kb_o_setting_up_the_content_filter_to_apply_different_rules_at_different_times.txt · Last modified: 2016/07/20 09:06 by dloper