[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

script para config bind9



El siguiente script tiene algunos errores se los mando a ver si alguien me puede ayudan a arreglarlo,

/#!/bin/bash/
/if [ "`whoami`" != "root" ];/
/then/
/clear/
/echo -e ” 33[1;31m################################################################################/ /# A T E N C I O N : Este Script solo se ejecuta con privilegio de root. #/
/################################################################################33[0;0m"/
/sleep 4/
/clear/
/exit/
/fi/

/clear/
/while [ "$OPCION" != 6 ]/
/do/
/echo -e ” 33[1;34m########################################################################/
/#               C O N F I G U R A R   D N S                     #/
/########################################################################33[0;0m"/
/echo ""/
/echo -e " 33[1;34m#########################/
/#   Menú de Opciones    #/
/#########################33[0;0m"/
/echo -e "33[1;31m[1] Configurar Forwarders”/
/echo -e “———————————–”/
/echo -e “[2] Agregar Zonas”/
/echo -e “[3] Eliminar Zonas”/
/echo -e “———————————–”/
/echo -e “[4] Agregar Alias”/
/echo -e “[5] Eliminar Alias”/
/echo -e “———————————–”/
/echo -e “[6] Regresar33[0;0m"/
/echo ""/
/read -p "Ingrese una opción: " OPCION/
/case ""$OPCION in/

/1)clear/
/echo -e "33[1;34m##########################/
/#  Configurar Forwarders #/
/##########################33[0;0m"/
/echo/
/echo -ne "DNS Primario: "/
/read DNSP/
/echo -ne "DNS Secundario: "/
/read DNSS/

/echo -ne "options {/
/directory \"/var/cache/bind\";/

/// If there is a firewall between you and nameservers you want/
/// to talk to, you may need to fix the firewall to allow multiple/
/// ports to talk.  See http://www.kb.cert.org/vuls/id/800113/

/// If your ISP provided one or more IP addresses for stable/
/// nameservers, you probably want to use them as forwarders./
/// Uncomment the following block, and insert the addresses replacing/
/// the all-0's placeholder./

/forwarders {/
/$DNSP;/
/$DNSS;/
/};/

/auth-nxdomain no;    # conform to RFC1035/
/listen-on-v6 { any; };/
/};/

/" >/etc/bind/named.conf.options/
/clear/
/echo -e " 33[1;31m Los Forwarders se han configurado./
/Presione Enter para continuar33[0;0m"/
/read Enter/
/sleep 1/
/;;/

/2) echo -n " "/
/clear/
/echo -e "33[1;34m#################/
/#  Agregar Zona #/
/#################33[0;0m"/
/echo/
/echo -ne "Nombre de la Zona: "/
/read NombreZona/
/file=`ls /var/cache/bind | grep -iw $NombreZona`/
/if [ -e $file ]; then/
/echo -n ” “/
/echo -e “33[1;34m#####################################/
/#  Agregar Zonas $NombreZona/
/#####################################33[0;0m"/
/echo/
/echo -ne "Nombre del Servidor: "/
/read NombrePC/
/echo -ne "IP para la Red LAN: "/
/read IPLan/

/echo -ne "/
/zone \"$NombreZona\" { type master; file \"/var/cache/bind/$NombreZona\"; };/ /zone \"$NombreZona.in-addr.arpa\" { type master; file \"/var/cache/bind/$NombreZona.in-addr.arpa\"; };/

/" >>/etc/bind/named.conf.local/

/echo -ne "\$ORIGIN $NombreZona./
/\$TTL 86400/
/@ 21600 IN SOA $NombrePC.$NombreZona. root.$NombreZona. ( 2009030801 3600 3600 3600000 86400 )/
/21600    IN    NS    $NombrePC.$NombreZona./

/$NombrePC    21600    IN    A    $IPLan/

/" >/var/cache/bind/$NombreZona/

/echo -ne "\$ttl 86400/
/@    IN    SOA    $NombrePC.$NombreZona. root.$NombreZona. (/
/2009030801/
/3600/
/3600/
/604800/
/1200 )/
/@    IN    NS    $NombrePC.$NombreZona./

/@    IN    PTR    $NombrePC.$NombreZona./
/" >/var/cache/bind/$NombreZona.in-addr.arpa/

/clear/
/echo -e " 33[1;31m La Zona $NombreZona se agregado correctamente./
/Presione Enter para continuar 33[0;0m"/
/read Enter/
//etc/init.d/bind9 restart/
/else/
/clear/
/echo -e " 33[1;31m La Zona $NombreZona ya esta Agregado./
/Presione Enter para continuar 33[0;0m"/
/read Enter/
/fi/

/clear/
/sleep 1/
/;;/

/3)echo -n " "/
/clear/
/echo -e "33[1;34m#########################/
/#  Eliminar Zonas #/
/#########################33[0;0m"/
/echo/
/echo -ne "Nombre de la Zona: "/
/read ElimNombreZona/
/file=`ls /var/cache/bind | grep -iw $ElimNombreZona`/
/if [ -e $file ]; then/
/clear/
/echo -e ” 33[1;31m La Zona $ElimNombreZona no esta Agregado./
/Presione Enter para continuar33[0;0m"/
/read Enter/
/else/
/rm /var/cache/bind/$ElimNombreZona*/

/busq=`grep -v "^zone \"$ElimNombreZona\" { type master; file \"/var/cache/bind/$ElimNombreZona\"; };/ /zone \"$ElimNombreZona.in-addr.arpa\" { type master; file \"/var/cache/bind/$ElimNombreZona.in-addr.arpa\"; };" /etc/bind/named.conf.local`/

/echo "$busq" > /etc/bind/named.conf.local.tmp/
/rm /etc/bind/named.conf.local/
/mv /etc/bind/named.conf.local.tmp /etc/bind/named.conf.local/
/clear/
/echo -e " 33[1;31m la Zona $ElimNombreZona fue eliminado./
/Presione Enter para continuar33[0;0m"/
/read Enter/
//etc/init.d/bind9 restart/
/fi/

/clear/
/;;/

/4) echo -n " "/
/clear/
/echo -e "33[1;34m##################/
/#  Agregar alias #/
/##################33[0;0m"/
/echo/
/echo -ne "Nombre de la Zona: "/
/read NombreDom/
/file=`ls /var/cache/bind/ | grep -iw $NombreDom`/
/if [ -e $file ]; then/
/echo -n ” “/
/clear/
/echo -e ” 33[1;31m La Zona $NombreDom no existe./
/Presione Enter para continuar 33[0;0m"/
/read Enter/
/else/
/clear/
/echo -e "33[1;34m########################################/
/#  Agregar Alias al Dominio $NombreDom/
/########################################33[0;0m"/
/echo -ne "Nombre del alias: "/
/read NombreAlias/
/file=`less /var/cache/bind/$NombreDom | grep $NombreAlias`/
/if [ -e $file ]; then/
/echo -ne “Nombre del Servidor: “/
/read NombreSer/
/echo -ne “/
/$NombreAlias 21600 IN CNAME $NombreSer” >>/var/cache/bind/$NombreDom/
/clear/
/echo -e ” 33[1;31m El alias $NombreAlias se agregado correctamente./
/Presione Enter para continuar 33[0;0m"/
/read Enter/
//etc/init.d/bind9 restart/
/else/
/clear/
/echo -e " 33[1;31m El alias $NombreAlias ya esta Agregado./
/Presione Enter para continuar 33[0;0m"/
/read Enter/
/fi/
/fi/
/clear/
/sleep 1/
/;;/

/5)echo -n " "/
/clear/
/echo -e "33[1;34m###################/
/#  Eliminar Alias #/
/###################33[0;0m"/
/echo/
/echo -ne "Nombre de la Zona: "/
/read NombreDomi/

/file=`ls /var/cache/bind | grep -iw $NombreDomi`/
/if [ -e $file ]; then/
/echo -n ” “/
/clear/
/echo -e ” 33[1;31m La Zona $NombreDomi no existe./
/Presione Enter para continuar 33[0;0m"/
/read Enter/
/else/
/clear/
/echo -e "33[1;34m########################################/
/#  Eliminar Alias al Dominio $NombreDomi/
/########################################33[0;0m"/
/echo -ne "Nombre del Alias a eliminar: "/
/read uftp/
/EXIST=`less /var/cache/bind/$NombreDomi | grep $uftp`/
/if [ -z "$EXIST" ]; then/
/clear/
/echo -e ” 33[1;31m El alias $uftp no existe./
/Presione Enter para continuar33[0;0m"/
/read Enter/
/echo ""/
/fi/

/if [ -n "$EXIST" ] ; then/
/busq1=`grep -v “^$uftp” /var/cache/bind/$NombreDomi`/
/clear/
/echo -e ” 33[1;31m El alias $uftp se elimino correctamente./
/Presione Enter para continuar33[0;0m”/
/read Enter/
/echo “$busq1″ > /var/cache/bind/$NombreDomi.tmp/
/rm /var/cache/bind/$NombreDomi/
/mv /var/cache/bind/$NombreDomi.tmp /var/cache/bind/$NombreDomi/
//etc/init.d/bind9 restart/
/else/
/clear/

/fi/
/fi/
/clear/
/sleep 1/
/;;/

/6);;/
/*) echo “Opción ingresada invalida, intente de nuevo”/
/clear ;;/
/esac/
/done/
/clear/
/exit 0/


--
Armando Felipe Fuentes Denis
Administrador de Red, Programador Web()
Joven Club de Computación y Electrónica Regla I
Marti 372 e/ Aranguren y 27 de Noviembre
Regla. Habana. Cuba.
Telef: (07) 797-8787
(07) 7944814
Linux User: 549846
Ecured: www.ecured.cu/index.php/Usuario:Armando.cha.jc
Web: www.livego.com www.lacubanada.com
Facebook: www.facebook.com/CubaRed
e-mail: armandofelipe1992@gmail.com
danny.ernesto@cha.jovenclub.cu


Reply to: