#!/bin/bash # (c) IP-Exchange.de # written by Igor Kov && Milan Berger if [ $# -lt 1 ] then echo "usage: $0 domainlist" else for FQDN in $(cat $1 ); do if $(dig NS $FQDN | grep sec-dns -q) then echo -e "$FQDN \t\t\t aus altem DNS Interface geloescht" >> `date +%d-%m-%Y`.log DOMAIN=$(echo $FQDN | awk -F . '{ printf $1 }' ) TLD=$(echo $FQDN | awk -F . '{ printf $2 }' ) DOMAINID=$(curl -s --user username@ip-partner.de:passwort --insecure "https://intranet.ip-exchange.de/dns/domain_such_ergebnis.php?typ=Domainname&value=$FQDN" | egrep domainid\=[[:digit:]] | awk -F "=" '{ printf $5 }' | awk '{ printf $1 "\n"}') echo curl -s --user username@ip-partner.de:passwort --insecure "https://intranet.ip-exchange.de/dns/domain_del_sql.php?Domainname=$DOMAIN&Toplevel=$TLD&userid=USERID_muss_angepasst_werden&domainid=$DOMAINID" 1> /dev/null elif $(dig NS $FQDN | grep ip-exchange.de -q) then echo -e "$FQDN \t\t\t aus neuem DNS Interface geloescht" >> `date +%d-%m-%Y`.log ZONEID=$(curl -s -k --digest --user noc:passwort "https://dnsql01.ip-exchange.de/admin/index.php?action=search&query=$FQDN" | egrep -om1 zone\"\ value.*\" | awk -F \" '{ printf $3 }') echo curl -s -k --digest --user noc:passwort "https://dnsql01.ip-exchange.de/admin/index.php" -d 'action=Really+delete+zone' -d zone=$ZONEID -d query=$FQDN. 1> /dev/null else echo -e "$FQDN \t\t\t nicht in unserem DNS" >> `date +%d-%m-%Y`.log fi done fi