of AS numbers assigned to Switzerland and Liechtenstein according to the RIPE NCC's database (ie delegated-ripencc-latest) Added class 250 for the asn I lines, and inserted them in users.conf This also obsoletes the update_ilines.sh shell script, replaced by the ilines_update.cron which will be run manually for a little while and then cronned every month/quarter or so. git-svn-id: svn+ssh://svn.ipng.nl/usr/share/subversion/repositories/ircnet.ipng.ch@34 c5d60b8d-fdcb-4146-b734-af4215e9eb71
79 lines
2.0 KiB
Plaintext
79 lines
2.0 KiB
Plaintext
NAME="ilines_update"
|
|
AUTHOR="Pim van Pelt"
|
|
MAILTO="pim@ipng.nl"
|
|
ESCALATE_MAILTO="pim@ipng.nl"
|
|
MASTERLOG="/home/ircd/cronscripts/logs/${NAME}.log"
|
|
|
|
PATH=/usr/local/bin:/usr/bin:/bin:/home/ircd/bin
|
|
|
|
INPUT_DELEGATED="/home/ircd/ircd/etc/ripedb/delegated-ripencc-latest"
|
|
OUTPUT_ROOT="/home/ircd/ircd/etc"
|
|
|
|
do_country()
|
|
# $1=country $2=class $3=threshold
|
|
{
|
|
delegated_ilines.py -i $INPUT_DELEGATED -o ilines.$1.$$ -c $1 -y $2
|
|
[ ! -r ilines.$1.$$ ] && return -1
|
|
[ `wc -l ilines.$1.$$ | awk '{ print $1 }'` -lt $3 ] && {
|
|
warning "$1: File too short, less than $3 lines"
|
|
rm -f -- ilines.$1.$$
|
|
return -2
|
|
}
|
|
mv ilines.$1.$$ $OUTPUT_ROOT/include/ilines.$1.conf
|
|
return 0
|
|
}
|
|
|
|
do_asn()
|
|
# $1=asn(s) $2=class $3=threshold
|
|
{
|
|
asset_ilines.py -a '' -o ilines.asn.$$ -l $1 -y $2
|
|
[ ! -r ilines.asn.$$ ] && return -1
|
|
[ `wc -l ilines.asn.$$ | awk '{ print $1 }'` -lt $3 ] && {
|
|
warning "$1: File too short, less than $3 lines"
|
|
rm -f -- ilines.asn.$$
|
|
return -2
|
|
}
|
|
mv ilines.asn.$$ $OUTPUT_ROOT/include/ilines.asn.conf
|
|
return 0
|
|
}
|
|
|
|
do_asset()
|
|
# $1=as-set(s) $2=class $3=threshold
|
|
{
|
|
asset_ilines.py -l '' -o ilines.as-set.$$ -a $1 -y $2
|
|
[ ! -r ilines.as-set.$$ ] && return -1
|
|
[ `wc -l ilines.as-set.$$ | awk '{ print $1 }'` -lt $3 ] && {
|
|
warning "$1: File too short, less than $3 lines"
|
|
rm -f -- ilines.as-set.$$
|
|
return -2
|
|
}
|
|
mv ilines.as-set.$$ $OUTPUT_ROOT/include/ilines.as-set.conf
|
|
return 0
|
|
}
|
|
|
|
function bitcron_main()
|
|
{
|
|
cd /home/ircd/ircd/etc || fatal "No config directory"
|
|
|
|
echo "Gathering I-Lines for countries"
|
|
do_country ch 200 1000
|
|
do_country li 202 15
|
|
|
|
echo "Gathering I-Lines for AS numbers"
|
|
ASN_LIST=$(awk -F'|' '$2=/(CH|LI)/ {
|
|
if ($3 == "asn") {
|
|
n++;
|
|
if (n>1) { printf "," };
|
|
printf $4
|
|
}
|
|
}' < $INPUT_DELEGATED )
|
|
do_asn $ASN_LIST 250 1000
|
|
|
|
echo "Gathering I-Lines for AS-SETs"
|
|
do_asset AS-IP-MAN-PEERING-TIX,AS-IP-MAN-PEERING-CIXP,AS-IP-MAN-PEERING-SWISSIX 300 1000
|
|
|
|
# svn commit -m "Automatic I-lines update by ilines_update.cron"
|
|
# pkill -HUP ircd
|
|
|
|
}
|