Monday, April 16, 2012

Active Directory with Samba 4 part 1

Samba 4 is developed to be a replacement of Microsoft Active Directory, it provides kerberos and directory service.With samba 4, you will have a free copy of Microsoft Active Directory.

Please remember that Samba 4 is still in alpha stage, so use it with your own risk.

Installation


Before you follow installation procedure from Samba 4 wiki, I suggest you to install bind (DNS Server) first, here is the steps:

Bind9 Installation


It is recommended to use bind 9.8 installed in the server. In debian 6, the current bind version included in the distribution is bind 9.7.3, so you need to compile new version of bind. Download a latest bind 9.8 version and then compile it.
apt-get install libkrb5-dev libssl-dev
wget ftp://ftp.freenet.de/pub/ftp.isc.org/isc/bind9/cur/9.8/bind-9.8.0-P1.tar.gz
tar -zxvf bind-9.8.0-P1.tar.gz
cd bind-9.8.0-P1
./configure --with-gssapi=/usr/include/gssapi  --with-dlopen=yes
make
make install
This will install bind9 in the /usr/local directory.

Create the Bind user and group:
groupadd named
useradd -d /var/named -g named -s /bin/false named
Create the Bind run directory:
mkdir -p /var/named
chown -R named:named /var/named
chmod -R 755 /var/named
Create /usr/local/etc/named.conf:
logging {
        channel "querylog" {
          file "/var/named/log/query.log";
          print-time yes;
        };
        channel default_log {
          file "/var/named/log/named.log";
          print-time yes;
        };
        category queries { querylog; };
        category default { default_log; default_debug; };
        category lame-servers { null; };
};

options {
        directory "/var/named";
        version "no thankyou";
        notify no;
#        tkey-gssapi-keytab "/usr/local/samba/private/dns.keytab";
};

#include "/usr/local/samba/private/named.conf";
Only uncomment the red line after you installed samba 4.

Create the Bind startup script bind9:
#! /bin/sh

NAMED_ROOT="/usr/local"

case "$1" in
    start)
        echo -n "Starting named... "
        $NAMED_ROOT/sbin/named -u named -c $NAMED_ROOT/etc/named.conf && echo OK
        ;;
    stop)
        echo -n "Stopping named... "
        kill -15 `cat /var/run/named/named.pid` && echo OK
        ;;
    restart|reload)
        $0 stop  &&  $0 start
        ;;
    *)
        echo "Usage: $0 {start|stop|restart|reload}"
        exit 1
esac
exit 0
Start bind9:
chmod +x bind9
./bind9

References:
http://linux-sxs.org/internet_serving/bind9.html
http://www.toddsmith.org/wordpress/server-technology/compile-bind-9-on-ubuntu-debian/

Next >>

No comments: