Configurazione di Bind con due View DNS pubblico e DNS Privato

From RVM Wiki
Jump to navigation Jump to search

Un server DNS pubblico Autoritativo, non deve rispondere a query per altri domini per esigenze di sicurezza. Per fare in modo che dal lato wan il DNS serva solo le zone configurate, e dal lato Lan servale zone e risolva anche gli altri nomi, occorre configurare due VIEW differenti. La configurazione è ottimizzata per Debian Etch.

Disabilitazione della discolusre della versione

Per esigenze di sicurezza, è utile non informare della versione in uso.

sudoedit named.conf.options
version "not currently available";

Rimozione delle zone locali dalla configurazione di base

Se si usano le view, tutte le zone devono essere incluse in una view.

Commentare quindi tutte le zone da named.conf.

// This is the primary configuration file for the BIND DNS server named.
//
// Please read /usr/share/doc/bind9/README.Debian.gz for information on the 
// structure of BIND configuration files in Debian, *BEFORE* you customize 
// this configuration file.
//
// If you are just adding zones, please do that in /etc/bind/named.conf.local

include "/etc/bind/named.conf.options";

// prime the server with knowledge of the root servers
// zone "." {
//      type hint;
//      file "/etc/bind/db.root";
// };

// be authoritative for the localhost forward and reverse zones, and for
// broadcast zones as per RFC 1912

// zone "localhost" {
//      type master;
//      file "/etc/bind/db.local";
// };
// 
// zone "127.in-addr.arpa" {
//      type master;
//      file "/etc/bind/db.127";
// };
// 
// zone "0.in-addr.arpa" {
//      type master;
//      file "/etc/bind/db.0";
// };
// 
// zone "255.in-addr.arpa" {
//      type master;
//      file "/etc/bind/db.255";
// };

// zone "com" { type delegation-only; };
// zone "net" { type delegation-only; };

// From the release notes:
//  Because many of our users are uncomfortable receiving undelegated answers
//  from root or top level domains, other than a few for whom that behaviour
//  has been trusted and expected for quite some length of time, we have now
//  introduced the "root-delegations-only" feature which applies delegation-only
//  logic to all top level domains, and to the root domain.  An exception list
//  should be specified, including "MUSEUM" and "DE", and any other top level
//  domains from whom undelegated responses are expected and trusted.
// root-delegation-only exclude { "DE"; "MUSEUM"; };

include "/etc/bind/named.conf.local";

Creazione del file con le zone pubbliche

  • Creare un file con tutte le zone pubbliche da includere nelle view:
sudoedit /etc/bind/named.conf.publiczones
zone "leman.it" {
        type slave;
        file "/etc/bind/leman.it.db";
        masters {
                89.96.171.169;
                };
};
......

Creazione della view privata

La view LAN è quella per i client della lan e per la risoluzione locale. Bisogna inserire tutte le zone locali e i dns root per fare forwarding.

sudoedit /etc/named.conf.local
view "lan" { 
        match-clients {  
                127.0.0.1/8; 
                192.168.100.0/24; 
        }; 
        recursion yes; 
        // required zone for recursive queries 
        zone "." { 
                type hint; 
                file "/etc/bind/db.root"; 
        }; 
 
        zone "localhost" { 
                type master; 
                file "/etc/bind/db.local"; 
        }; 
         
        zone "127.in-addr.arpa" { 
                type master; 
                file "/etc/bind/db.127"; 
        }; 
         
        zone "0.in-addr.arpa" {
                type master; 
                file "/etc/bind/db.0"; 
        }; 
         
        zone "255.in-addr.arpa" { 
                type master; 
                file "/etc/bind/db.255"; 
        }; 
 
        include "/etc/bind/named.conf.publiczones"; 
}; 

Notare che bisogna inserire ANCHE tutte le zone pubbliche, altrimenti non verranno risolte.

Creazione della view pubblica

Questa view serve tutti gli altri indirizzi, e risponde solo a query delle zone autoritative configurate:

view "wan" { 
        match-clients { any; }; 
        recursion no; 
 
        include "/etc/bind/named.conf.publiczones"; 
};

Test della configurazione

Testare la configurazione

sudo named-checkconf

Riavviare bind

sudo /etc/init.d/bind9 restart

Testare la risoluzione dei nomi delle zone pubbliche e di altri nomi dalla lan.

Testare dal alto wan che si possano risolvere solo le zone pubbliche ospitate.

Eventualmente testare con Squishywishywoo: complete dns traversal checking

Riferimenti