Просмотр Исходного

В статье описано как "пожизненно" заблокировать доступ в интернет определённой подсети абонентов.

Это не связано с интеграцией биллинга и Carbon Reductor 8, никаких синхронизаций в таком случае выполняться не будет.

Хук: {color:#000000}/app/reductor/cfg/userinfo/hooks/billing_redirect.sh{color}

{code}
#!/bin/bash

ipset_prepare() {
if [ "${billing['negbal']}" = '1' ]; then
if [ -n "${billing['subnet']}" ]; then
ipset create auth bitmap:ip,mac range "${billing['subnet']}" 2>/dev/null || true
else
ipset create auth iphash 2>/dev/null || true
fi
ipset flush auth
for ipset in negbal blocked; do
ipset create $ipset hash:net 2>/dev/null || true
ipset flush $ipset
done
while read net; do
ipset add negbal $net || true
done < /cfg/userinfo/hooks/negbal.list || true
fi
}
{code}

{code}
chmod a+x /app/reductor/cfg/userinfo/hooks/billing_redirect.sh
{code}
Список сетей для блокировки:&nbsp;{color:#000000}/app/reductor/cfg/userinfo/hooks/negbal.list{color}\\

{code}
10.30.30.0/24
{code}
Маски шире /16 не поддерживаются, разбейте сеть на более мелкие.

Опции для работы в конфиге /app/reductor/cfg/config :
{code}
declare -A billing
billing['negbal']='1'
billing['ip']=''
billing['negbal_ip']='10.50.140.73'
billing['negbal_dns_ip']='10.50.140.73'
billing['negbal_url']='http://10.50.140.73/'
billing['blocked_ip']=''
billing['blocked_dns_ip']=''
billing['blocked_url']=''
billing['noauth_ip']=''
billing['noauth_dns_ip']=''
billing['noauth_url']=''
billing['subnet']='10.30.30.0/24'
billing['nocheckauth']='1'
billing['justsync']='0'
billing['other_traffic']='1'
{code}10.50.140.73 - IP адрес заглушки настроенной по статье:&nbsp;[http://docs.carbonsoft.ru/pages/viewpage.action?pageId=68354279]