Instalando MyDNS y el panel de control MyDNSConfig en CentOS 5.1
En este tutorial, describiré cómo instalar y configurar MyDNS y MyDNSConfig en CentOS 5.1. MyDNS es un servidor DNS que utiliza una base de datos MySQL como backend en lugar de archivos de configuración como, por ejemplo, Bind o djbdns. La ventaja es que MyDNS simplemente lee los registros de la base de datos y no tiene que reiniciarse/recargarse cuando cambian los registros DNS o se crean/editan/eliminan zonas. Se puede configurar fácilmente un servidor de nombres secundario instalando una segunda instancia de MyDNS que acceda a la misma base de datos o, para ser más redundante, use las funciones de replicación maestro/esclavo de MySQL para replicar los datos en el servidor de nombres secundario.
MyDNSConfig es una interfaz web fácil de usar para MyDNS. MyDNSConfig puede crear todos los tipos de registros DNS que están disponibles en MyDNS y agrega funciones como administración de usuarios y privilegios de acceso.
¡No emito ninguna garantía de que esto funcione para usted!
1 nota preliminar
En este tutorial utilizo el nombre de host server1.example.com con la dirección IP 192.168.0.100. Estas configuraciones pueden diferir para usted, por lo que debe reemplazarlas cuando corresponda.
2 Instalación de los requisitos previos
Primero habilitamos el repositorio RPMforge en nuestro sistema CentOS ya que algunos de los paquetes que vamos a instalar en el transcurso de este tutorial no están disponibles en los repositorios oficiales de CentOS 5.1:
rpm -Uhv http://apt.sw.be/packages/rpmforge-release/rpmforge-release-0.3.6-1.el5.rf.i386.rpm
MyDNSConfig es una interfaz basada en web para MyDNS escrita en PHP. Esto requiere un servidor web con PHP habilitado y el servidor de base de datos MySQL. Si ya tiene Apache, PHP y MySQL instalados, puede omitir este paso. También instalamos phpMyAdmin aquí para que tenga una interfaz web para la base de datos MySQL en caso de que la necesite:
yum install httpd mysql-server php php-mysql php-mbstring phpmyadmin
Inicie MySQL:
chkconfig --niveles 235 mysqld en
/etc/init.d/mysqld start
Luego establezca contraseñas para la cuenta raíz de MySQL:
mysqladmin -u contraseña raíz sucontraseñarootsql
mysqladmin -h server1.example.com -u contraseña raíz sucontraseñarootsql
Ahora configuramos phpMyAdmin. Cambiamos la configuración de Apache para que phpMyAdmin permita conexiones no solo desde localhost (comentando la stanza
vi /etc/httpd/conf.d/phpmyadmin.conf
# # Web application to manage MySQL # #<Directory "/usr/share/phpmyadmin"> # Order Deny,Allow # Deny from all # Allow from 127.0.0.1 #</Directory> Alias /phpmyadmin /usr/share/phpmyadmin Alias /phpMyAdmin /usr/share/phpmyadmin Alias /mysqladmin /usr/share/phpmyadmin |
[...] /* Authentication type */ $cfg['Servers'][$i]['auth_type'] = 'http'; [...] |
<?php /* Copyright (c) 2005, Till Brehm, Falko Timme, projektfarm Gmbh All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of ISPConfig nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ ini_set('register_globals',0); $conf["app_title"] = "MyDNSConfig"; $conf["app_version"] = "1.1.0"; $conf["rootpath"] = "/usr/share/mydnsconfig"; $conf["fs_div"] = "/"; // File system divider, \\ on windows and / on linux and unix $conf["classpath"] = $conf["rootpath"].$conf["fs_div"]."lib".$conf["fs_div"]."classes"; $conf["temppath"] = $conf["rootpath"].$conf["fs_div"]."temp"; /* Database Settings */ $conf["db_type"] = 'mysql'; $conf["db_host"] = 'localhost'; $conf["db_database"] = 'mydns'; $conf["db_user"] = 'mydns'; $conf["db_password"] = 'mydnspassword'; /* External programs */ $conf["programs"]["wput"] = $conf["rootpath"]."/tools/wput/wput"; /* Themes */ $conf["theme"] = 'grey'; $conf["html_content_encoding"] = 'text/html; charset=iso-8859-1'; $conf["logo"] = 'themes/default/images/mydnsconfig_logo.gif'; /* Default Language */ $conf["language"] = 'en'; /* Auto Load Modules */ $conf["start_db"] = true; $conf["start_session"] = true; /* DNS Settings */ $conf["auto_create_ptr"] = 1; // Automatically create PTR records? $conf["default_ns"] = 'ns1.example.com.'; // must be set if $conf['auto_create_ptr'] is 1. Don't forget the trailing dot! $conf["default_mbox"] = 'admin.example.com.'; // Admin email address. Must be set if $conf['auto_create_ptr'] is 1. Replace "@" with ".". Don't forget the trailing dot! $conf["default_ttl"] = 86400; $conf["default_refresh"] = 28800; $conf["default_retry"] = 7200; $conf["default_expire"] = 604800; $conf["default_minimum_ttl"] = 86400; ?> |
## ## /etc/mydns.conf ## Wed Jan 18 17:18:48 2006 ## For more information, see mydns.conf(5). ## # DATABASE INFORMATION db-host = localhost # SQL server hostname db-user = mydns # SQL server username db-password = mydnspassword # SQL server password database = mydns # MyDNS database name # GENERAL OPTIONS user = nobody # Run with the permissions of this user group = nobody # Run with the permissions of this group listen = * # Listen on these addresses ('*' for all) no-listen = # Do not listen on these addresses # CACHE OPTIONS zone-cache-size = 1024 # Maximum number of elements stored in the zone cache zone-cache-expire = 60 # Number of seconds after which cached zones expires reply-cache-size = 1024 # Maximum number of elements stored in the reply cache reply-cache-expire = 30 # Number of seconds after which cached replies expire # ESOTERICA log = LOG_DAEMON # Facility to use for program output (LOG_*/stdout/stderr) pidfile = /var/run/mydns.pid # Path to PID file timeout = 120 # Number of seconds after which queries time out multicpu = 1 # Number of CPUs installed on your system recursive = 213.191.92.86 # Location of recursive resolver allow-axfr = yes # Should AXFR be enabled? allow-tcp = yes # Should TCP be enabled? allow-update = no # Should DNS UPDATE be enabled? ignore-minimum = no # Ignore minimum TTL for zone? soa-table = soa # Name of table containing SOA records rr-table = rr # Name of table containing RR data soa-where = # Extra WHERE clause for SOA queries rr-where = # Extra WHERE clause for RR queries |