Servidor_de_comunicacions_Institut_les_Planes
$ sudo apt-get install ldap2zone ldap-utils
# Configuration file for automatic deployment of ldap2zone generated zones to bind # Should we run the cronjob # DEFAULT: "false" RUN_DEPLOY="true" LDAP_HOST_PARAM="192.168.59.1" LDAP_BASE_DN="dc=inslesplanes,dc=santabarbara,dc=cat" # How the LDAP server can be accessed # DEFAULT: "ldap://localhost" LDAP_URI="ldap://$LDAP_HOST_PARAM/$LDAP_BASE_DN" # Where the zonefiles are located # DEFAULT: "/etc/bind" BIND_DIR="/etc/bind" # Time to live value for a and ptr records # DEFAULT: 500 Seconds TTL="500" # Prefix for zone definition files # DEFAULT: "db." # The zone definition file for 0.168.192.in-addr.arpa is stored as 'db.0.168.192.in-addr.arpa' PREFIX="db." # Allow Updates from these networks (semicolon separated and ended) # DEFAULT: Don't allow updates #ALLOW_UPDATE="192.168.0.0/24;" # Allow Transfer to zones (semicolon separated and ended) # DEFAULT: Dont allow zone transfer #ALLOW_TRANSFER=192.168.0.0;"
#!/bin/sh [ -r /etc/default/ldap2zone ] && . /etc/default/ldap2zone case "$LDAP_URI" in ldap://*|ldaps://*) ;; *) LDAP_URI="ldap://${LDAP_URI}" ;; esac LDAPSEARCH=`which ldapsearch` if [ -z "${LDAPSEARCH}" ]; then echo "ldapsearch program not in $PATH. Exiting..." exit 1 fi LDAP_URI_PARAM=${LDAP_URI:+"-H $LDAP_URI"} if [ "$ALLOW_UPDATE" ]; then ALLOW_UPDATE_PARAM="allow-update {$ALLOW_UPDATE}"; else ALLOW_UPDATE_PARAM=; fi if [ "$ALLOW_TRANSFER" ]; then ALLOW_TRANSFER_PARAM="allow-transfer {$ALLOW_TRANSFER}"; else ALLOW_TRANSFER_PARAM=; fi ZONES=`ldapsearch -LLL $LDAP_HOST_PARAM -x "(objectClass=dNSZone)" zoneName -b $LDAP_BASE_DN | grep zoneName: |$ ldap2zone=`which ldap2zone` rndc=`which rndc` if [ -z "${ZONES}" ]; then echo "No domains configured. Exiting..." exit 0 fi if [ -z "${rndc}" ]; then echo "rndc program not in $PATH. Exiting..." exit 1 fi if [ -z "${ldap2zone}" ]; then echo "ldap2zone program not in $PATH. Exiting..." exit 1 fi if [ ! -d $BIND_DIR ]; then echo "The directory specified as BIND_DIR does not exist. Exiting..." exit 1 fi if [ -w $BIND_DIR/named.conf.ldap2zone ]; then >${BIND_DIR}/named.conf.ldap2zone for domain in $ZONES; do cat << EOF >> ${BIND_DIR}/named.conf.ldap2zone zone "${domain}" { type master; notify yes; file "${BIND_DIR}/${PREFIX}${domain}"; $ALLOW_UPDATE_PARAM $ALLOW_TRANSFER_PARAM }; EOF done $rndc reconfig fi for domain in $ZONES; do if $ldap2zone $domain $LDAP_URI $TTL > /tmp/$domain; then lines=$(cat /tmp/$domain | wc -l) [ $lines -gt 1 ] && mv /tmp/$domain $BIND_DIR/${PREFIX}${domain} fi result=$($rndc reload $domain 2>&1) if [ $? -ne 0 ]; then printf "Reloading the zone '$domain' failed: $result\n" 1>&2 else printf "Reloading the zone '$domain' was successful\n" 1>&2 fi done
# /usr/sbin/ldap2bind Reloading the zone '59.168.192.in-addr.arpa.' was successful Reloading the zone 'inslesplanes.santabarbara.cat.' was successful
include "/etc/bind/named.conf.ldap2zone";
# cat /etc/default/ldap2zone
RUN_DEPLOY="true"
# cat /etc/cron.d/ldap2zone PATH=/sbin:/bin:/usr/sbin:/usr/bin @reboot bind /usr/sbin/ldap2bind @hourly bind /usr/sbin/ldap2bind
Aquí tenim la informació del DNS del servidor.
Les zones creades son les següents: