#!/bin/sh

. caterva-alterator.sh
. verborum-caterva-valtable

print_network()
{
    print_info "Adding source network $label"
    echo "acl our_networks src ${address}    # $label"
    def_val SQ_our_networks yes
}

metalterator-cmdline /squid/networks action "list" \
address "address" \
comment "label" \
| on_object print_network

if [ -n "$(read_val SQ_our_networks)" ] && [ "$(read_val SQ_our_networks)" = "yes" ]; then
    cat <<EOF
# Deny access not form one of "our" IP networks
http_access deny !our_networks
EOF
    print_info "Deny access not form one of \"our\" IP networks"
fi
