#!/bin/bash # Copyright 2010-2013 Frank Liepold / 1&1 Internet AG # # Email: frank.liepold@1und1.de # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License # as published by the Free Software Foundation; either version 2 # of the License, or (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. ##################################################################### ## defaults for module net ## array containing the shell commands manipulating the network connection ## The string remote_host must be replaced by the actual host name at runtime declare -g -A net_impact_cmd net_impact_cmd=(\ ["on"]="iptables -I INPUT -s remote_host -j DROP && iptables -I OUTPUT -d remote_host -j DROP" \ ["off"]="iptables -D INPUT -s remote_host -j DROP && iptables -D OUTPUT -d remote_host -j DROP" \ ["check_on"]="ping -c1 -W5 remote_host" \ ["check_on_rc"]=1 \ ["check_off"]="ping -c1 -W5 remote_host" \ ["check_off_rc"]=0 \ ) ## time to let the data device writer run net_time_data_dev_writer=3 ## time for which the amount of data to apply must be constant to declare ## the apply process as having stopped net_time_constant_apply=5 ## time for which the amount of data to fetch must be constant to declare ## the fetch process as having stopped net_time_constant_fetch=20 ## maxtime to wait for apply to stop (after pause-apply) net_maxtime_apply=60 ## maxtime to wait for fetch to stop (after pause-fetch) net_maxtime_fetch=300