Developers Documentation

×

Warning

0 error for file:https://clearos.com/dokuwiki2/lib/exe/css.php?t=dokuwiki&tseed=82873f9c9a1f5784b951644363f20ef8

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/activatepolicy1.sh
#!/bin/bash
/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/activatepolicy2.sh
#!/bin/bash
/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:

/root/support/contentfilter/activatepolicy1.sh
/root/support/contentfilter/activatepolicy2.sh

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/activatepolicy1.sh
0       17      *       *       *       /root/support/contentfilter/activatepolicy2.sh
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

https://clearos.com/dokuwiki2/lib/exe/indexer.php?id=content%3Aen_us%3Akb_o_setting_up_the_content_filter_to_apply_different_rules_at_different_times&1568668241