http:///https:///api.php?action=feedcontributions&user=Intruder0815&feedformat=atomSambaWiki - User contributions [en]2024-03-28T20:30:25ZUser contributionsMediaWiki 1.39.5https://wiki.samba.org/index.php?title=Setting_up_Samba_as_an_Active_Directory_Domain_Controller&diff=7111Setting up Samba as an Active Directory Domain Controller2012-12-09T12:06:14Z<p>Intruder0815: /* NTP */ - added permissions for ntp (otherwise, ntpd won't be able to read the socket file!)</p>
<hr />
<div>= HOWTO to set up a AD DC =<br />
<br />
This document explains how to setup a simple Samba4<br />
server. This is aimed at people who are already familiar with Samba3<br />
and wish to participate in Samba4 development or test the alpha<br />
releases of Samba4. This is not aimed at general production use of<br />
Samba4, although some brave sites are running Samba4 in production<br />
based on these instructions.<br />
<br />
== Video Demonstrations of This HOWTO ==<br />
<br />
A set of [[samba4/videos|demonstration videos]] is available that<br />
may provide a useful overview of the contents of this HOWTO.<br />
<br />
== A Note on Alpha/Beta/RC Versions ==<br />
<br />
Samba4 is developing very rapidly. This HOWTO is frequently updated to reflect the latest changes in the Samba git repository. Please see the Samba4 [[Samba4/Status|Status]] Wiki for more specifics on project status.<br />
<br />
== Samba 4 OS Requirements ==<br />
<br />
Because of the constantly changing and ever expanding nature of Linux, the '''OS Requirements for Samba4 have been moved''' from Step 2, to [[Samba_4/OS_Requirements]]<br />
This not only includes the required packages for a successful Samba4 deployment, but also the required file system features. Please consider that page as a prerequisite to a successful Samba4 setup.<br />
<br />
== Step 1: Download Samba4 ==<br />
<br />
Currently, there are three methods to download the current Samba4 sources, in order of preference: via git, rsync, or as a tarball from the samba.org website. We strongly recommend using the git method for downloading Samba, as it makes getting updates easier, and also allows you to integrate test patches from Samba developers more easily in case of problems. <br />
<br />
In the following examples we will assume that your top-level source is named <tt>samba-master</tt>. If you downloaded a tarball this will instead be based on the name of the tarball downloaded (e.g. <tt>samba-4.0.0alpha13</tt> for the tarball samba-4.0.0alpha13.tar.gz). Also note that in the <tt>master</tt> branch the<br />
samba4 code in our current git tree is now located in the top level directory.<br />
<br />
=== Downloading via git ===<br />
<br />
Git allows you to download the source tree via either the <tt>git</tt> or <tt>http</tt>protocols. In general, the <tt>git</tt> protocol is the preferred choice since it compresses the data being transferred. To download the source tree via <tt>git</tt>, run the following command:<br />
<br />
$ git clone git://git.samba.org/samba.git samba-master<br />
<br />
Alternatively, if you prefer to use the <tt>http</tt> protocol, run the following command:<br />
<br />
$ git clone http://gitweb.samba.org/samba.git samba-master<br />
<br />
Either command will create a directory called <tt>samba-master</tt> in the current<br />
directory.<br />
<br />
=== Updating via git ===<br />
<br />
If you already have downloaded the source tree via <tt>git</tt> and want to update the tree to the latest version, run the following command in your <tt>samba-master</tt> directory:<br />
<br />
$ git pull<br />
<br />
If you get an error like this:<br />
fatal: Unable to create '[...]/samba_master/.git/index.lock': File exists.<br />
Run the command below to reset your tree.<br />
<br />
If you are having trouble compiling the source, it may be due to stale files. You can reset your <tt>git</tt> tree to correct these errors. To reset your <tt>git</tt> tree, run the following command in your <tt>samba-master</tt> directory:<br />
<br />
$ git clean -x -f -d<br />
<br />
=== Downloading via rsync ===<br />
<br />
If <tt>git</tt> is not available to you, <tt>rsync</tt> is the next best choice. To download the source tree via <tt>rsync</tt>, run the following command:<br />
<br />
$ rsync -avz samba.org::ftp/unpacked/samba_4_0_test/ samba-master<br />
<br />
This command will create a directory called <tt>samba-master</tt> in the current directory, containing a checked out <tt>git</tt> repository. If you plan on using <tt>git</tt> to manage the tree, you will need to run the following commands in your <tt>samba-master</tt> directory:<br />
<br />
$ cd samba-master/<br />
$ rm .git/refs/tags/*<br />
$ rm -r .git/refs/remotes/<br />
$ git config remote.origin.url git://git.samba.org/samba.git<br />
$ git config --add remote.origin.fetch +refs/tags/*:refs/tags/* (this line is optional)<br />
$ git fetch<br />
<br />
Note you can ignore this error from <tt>git fetch</tt>:<br />
error: refs/heads/master does not point to a valid object!<br />
<br />
Refer to the [[#Updating via git|Updating via git]] instructions on how to manage the source tree with <tt>git</tt>.<br />
<br />
=== Downloading a tarball ===<br />
<br />
If both <tt>git</tt> and <tt>rsync</tt> are not available, you can download the latest Samba 4.0 Release Candidate tarball from [http://ftp.samba.org/pub/samba/rc/ the Samba website]<br />
<br />
== Step 2: Compile Samba4 ==<br />
<br />
To build Samba4, run the following command in your <tt>samba-master</tt> directory:<br />
<br />
$ cd samba-master<br />
$ ./configure --enable-debug --enable-selftest<br />
$ make<br />
<br />
The above command will setup Samba4 to install in <tt>/usr/local/samba</tt>. If you want Samba to install in a different directory, then you should use the <tt>--prefix</tt> option to <tt>configure</tt>.<br />
<br />
The reason we recommend using <tt>--enable-debug --enable-selftest</tt> for Samba is that it will include extra debug information that will help us diagnose problems in case of failures, and will also allow you to run our selftest <tt>make test</tt> to validate that Samba can behave correctly on your platform. Both of these are however, entirely '''optional'''.<br />
<br />
'''Profiling with google-perftools'''<br />
<br />
If you want to enable profiling support, change the configure command above to the following:<br />
$ LDFLAGS="-ltcmalloc -lprofiler" ./configure.developer<br />
:''(This also works for CFLAGS)''<br />
<br />
== Step 3: Install Samba4 ==<br />
<br />
To install Samba4, run the following command in your <tt>samba-master</tt> directory:<br />
<br />
$ make install<br />
<br />
Note that this must be run as a user who has permission to write to the install directory, which defaults to <tt>/usr/local/samba</tt>. See [[#Step 2: Compile Samba4|Step 2: Compile Samba4]] for instructions on how to change the install directory.<br />
<br />
For the rest of this HOWTO we will assume that you have installed<br />
Samba4 in the default location. All future Samba commands will stem from the <tt>/usr/local/samba/sbin</tt> and <tt>/usr/local/samba/bin</tt> directories.<br />
<br />
Please review the [[Samba4#Previous_Releases|Release Notes]] for the version you have installed, it may contain important information not yet reflected in this HOWTO.<br />
<br />
=== Upgrading ===<br />
<br />
If you are upgrading from a previous release of Samba4, be sure to review all the [[Samba4#Previous_Releases|Release Notes]] for the new version, as well as the notes for all the interim versions.<br />
<br />
== Step 4: Provision Samba4 ==<br />
<br />
The provision step sets up a basic user database, and is used when you are setting up your Samba4<br />
server in its own domain. If you instead want to setup your Samba4 server as an additional domain controller<br />
in an existing domain, then please see the [[#Joining a Windows Domain Controller as an Additional DC in a Domain|Joining a Windows Domain Controller as an Additional DC in a Domain]] section on this page. If you want to migrate an existing Samba3 domain to Samba4, see the [[#Migrating an Existing Samba3 Domain to Samba4|Migrating an Existing Samba3 Domain to Samba4]] section on this page.<br />
<br />
For the rest of the HOWTO we will assume that your DNS domain name is<br />
<tt>samdom.example.com</tt>, your short (also known as NT4) domain name is<br />
<tt>samdom</tt>, your Samba server's hostname is <tt>samba</tt>, and the IP Address of your Samba server is <tt>192.168.1.2</tt>.<br />
<br />
The provision step must be run as a user with permission to write to the install directory.<br />
<br />
# /usr/local/samba/bin/samba-tool domain provision \<br />
--realm=samdom.example.com --domain=SAMDOM \<br />
--adminpass='p4$$word' --server-role=dc<br />
<br />
If you run the previous command with a user who does not have write permission to the install directory, you will get an error similar to this:<br />
tdb_open_ex: could not open file /usr/local/samba/private/sam.ldb.d/DC=SAMDOM,DC=EXAMPLE,DC=COM. ldb: Permission denied<br />
<br />
There are many other options you can pass to the <tt>samba-tool domain provision</tt> command. You can run it with the <tt>--help</tt> option to see a list of them.<br />
<br />
*Note: As of September 11, 2012 (Samba4.0.0RC1) the provision command now uses Samba4's internal DNS server, if you would like the older behavior, add <tt>--dns-backend=BIND9_DLZ</tt> to the above provision command.<br />
*Note: You may need to remove the <tt>/usr/local/samba/etc/smb.conf</tt> file if you are re-running the provision command.<br />
<br />
== Step 5: Starting Samba4 ==<br />
<br />
If you are planning to run Samba4 as a production server, then just run the <tt>samba</tt> binary as root<br />
<br />
# /usr/local/samba/sbin/samba<br />
<br />
That will run Samba4 in 'standard' mode, which is suitable for<br />
production use. Samba4 doesn't yet have init scripts included<br />
for each platform, but making one for your platform should not be<br />
difficult. There are some example scripts (for RedHat/Fedora, Debian and Ubuntu) on the [[Samba4/InitScript]] page.<br />
<br />
If you are running Samba4 as a developer you may find<br />
the following more useful:<br />
<br />
# /usr/local/samba/sbin/samba -i -M single<br />
<br />
This will start <tt>samba</tt> with all log messages printed to stdout, and restricting it to a<br />
single process. That mode of operation makes debugging <tt>samba</tt> with <tt>gdb</tt><br />
easier. If you want to launch it under <tt>gdb</tt>, run <tt>samba</tt> as follows:<br />
<br />
# gdb --args /usr/local/samba/sbin/samba -i -M single<br />
<br />
Note that if you are running any Samba3 <tt>smbd</tt> or <tt>nmbd</tt> processes<br />
they need to be stopped before starting <tt>samba</tt> from Samba4.<br />
<br />
Take care when running Samba4 commands if you also have a previous version of Samba installed. To avoid inadvertently running the wrong version, you should consider putting the <tt>/usr/local/samba/bin</tt> and <tt>/usr/local/samba/sbin</tt> directories in the beginning of your <tt>PATH</tt> variable.<br />
<br />
You can see what version of Samba, if any, is in your <tt>PATH</tt> variable by running the following:<br />
# samba -V<br />
<br />
*Note: In older developer versions of Samba4 <tt>samba</tt> was still called <tt>smbd</tt>.<br />
<br />
== Step 6: Testing Samba4 ==<br />
<br />
First check you have the right version of <tt>smbclient</tt> by running the following command:<br />
<br />
$ /usr/local/samba/bin/smbclient --version<br />
<br />
This should show you a version starting with "Version 4.0.XXXXX". <br />
<br />
Now run this command to list the shares on your Samba4 server:<br />
<br />
$ /usr/local/samba/bin/smbclient -L localhost -U%<br />
<br />
The output of the command should be similar to what is shown below:<br />
<br />
Sharename Type Comment<br />
--------- ---- -------<br />
netlogon Disk<br />
sysvol Disk<br />
IPC$ IPC IPC Service (Samba 4.0.0alpha12-GIT-5e755e9)<br />
ADMIN$ Disk DISK Service (Samba 4.0.0alpha12-GIT-5e755e9)<br />
<br />
The <tt>netlogon</tt> and <tt>sysvol</tt> shares are basic shares needed for Active Directory server<br />
operation. <br />
<br />
If the command failed, restart samba by running the following:<br />
<br />
# killall samba<br />
# rm -v -- /usr/local/samba/var/run/smbd-fileserver.conf.pid<br />
# /usr/local/samba/sbin/samba<br />
<br />
To test that authentication is working, you should try to connect to the <tt>netlogon</tt> share<br />
using the Administrator password you set earlier:<br />
<br />
$ smbclient //localhost/netlogon -UAdministrator%'p4$$word' -c 'ls'<br />
<br />
The output of the command should be similar to what is shown below:<br />
<br />
Domain=[SAMDOM] OS=[Unix] Server=[Samba 4.0.0beta9-GIT-e4677e3]<br />
. D 0 Wed Sep 12 21:00:36 2012<br />
.. D 0 Wed Sep 12 21:02:28 2012<br />
<br />
== Step 7: Configure DNS ==<br />
<br />
A working DNS setup is essential to the correct operation of<br />
Samba4. Without the right DNS entries, Kerberos won't work, which in<br />
turn means that many of the basic features of Samba4 won't work.<br />
<br />
It is worth spending some extra time to ensure your DNS setup is correct, as debugging problems caused by mis-configured DNS can take a<br />
lot of time later on.<br />
<br />
=== DNS Server ===<br />
==== Samba's Internal DNS Server ====<br />
<br />
If you specified <tt>--dns-backend=SAMBA_INTERNAL</TT> or did not specify any backend at all when you provisioned, there is no further setup required for the DNS server. However, you still need to configure your <tt>/etc/resolv.conf</tt> as shown in [[#Configure /etc/resolv.conf|Configure /etc/resolv.conf]]<br />
<br />
If you want the internal DNS server to forward requests it isn't responsible for, then add the following to your smb.conf:<br />
dns forwarder = {IP-Address of the DNS you want to forward to}<br />
<br />
==== Bind 9.8.0 or newer ====<br />
<br />
If using BIND, the next step to get a working DNS setup for Samba4 is to start<br />
with the DNS configuration file that is created by the<br />
[[#Step 4: Provision Samba4|provision step]] or if you are using any of the other samba-tool options (classicupgrade for example) you can specify --dns-backend=BIND9_DLZ or --dns-backend=BIND9_FLATFILE.<br />
<br />
You can<br />
activate the configuration that the provision has created by including this configuration file in bind's named configuration file. This file is typically located in the <tt>/etc/bind</tt> directory, please refer to your distribution documentation for the location of this file on your system. Once located, add the following line to the configuration file:<br />
<br />
include "/usr/local/samba/private/named.conf";<br />
<br />
Edit that file to uncomment the correct dlz plugin line, based on your version of bind. Open the <tt>/usr/local/samba/private/named.conf</tt> file in a text editor and follow the instructions inside.<br />
<br />
After adding that line you should restart your Bind server and check<br />
in the system logs for any problems. If available, you can run <tt>named-checkconf</tt> to help you fix any problems with your named configuration.<br />
<br />
==== Bind 9.7.x ====<br />
<br />
Users of bind-9.7.x are strongly encouraged to upgrade to bind-9.8 or bind-9.9. If this is not possible, refer to the section [[#Step 9: Configure Kerberos DNS Dynamic Updates|Configure Kerberos DNS Dynamic Updates]] for instructions on configuring bind-9.7.<br />
<br />
==== Bind (All Versions) ====<br />
<br />
A common problem you may encounter is that many modern Linux distributions activate<br />
'Apparmor' or 'SELinux' by default, and these may be configured to<br />
deny access to Bind for your the <tt>named.conf</tt> and zone files created in<br />
the provision. If your Bind logs show that Bind is getting a access<br />
denied error accessing these files, please see your local system<br />
documentation for how to enable access to these files in Bind (hint:<br />
for Apparmor systems such as Ubuntu, the command <tt>aa-logprof</tt> may be<br />
useful).<br />
<br />
*Note: On Debian systems, the zone auto-generation might detect and use <tt>127.0.1.1</tt> as the domain controller's IP address. This will cause problems when trying to connect to the server from client machines. To fix this, you will need to adjust <tt>/usr/local/samba/private/named.conf</tt> by changing <tt>127.0.1.1</tt> to reflect the actual IP address of the server you're setting up.<br />
*Note: On Debian SID (bind9 package), <tt>/etc/bind/named.conf.options</tt> is missing and this will cause the <tt>named</tt> daemon to fail to start. To fix this either create an empty file, or comment out corresponding line in <tt>/etc/bind/named.conf</tt>. See your syslog messages for more information.<br />
<br />
=== Configure /etc/resolv.conf ===<br />
<br />
For all the local DNS lookups to resolve correctly, we need to modify the server's <tt>/etc/resolv.conf</tt> file. The following example should be sufficient to have DNS resolve properly:<br />
<br />
domain samdom.example.com<br />
nameserver 192.168.1.2<br />
<br />
*Note: Remember to change the IP Address to your Samba server's IP Address<br />
*Note: If your server is set up to receive its IP configuration via DHCP, the <tt>/etc/resolv.conf</tt> file might be automatically updated. Refer to your distribution's documentation on how to stop this behavior.<br />
<br />
=== Testing DNS ===<br />
<br />
To test that DNS is working properly, run the following commands and compare the output to what is shown:<br />
<br />
$ host -t SRV _ldap._tcp.samdom.example.com.<br />
_ldap._tcp.samdom.example.com has SRV record 0 100 389 samba.samdom.example.com.<br />
<br />
$ host -t SRV _kerberos._udp.samdom.example.com.<br />
_kerberos._udp.samdom.example.com has SRV record 0 100 88 samba.samdom.example.com.<br />
<br />
$ host -t A samba.samdom.example.com.<br />
samba.samdom.example.com has address 10.0.0.1<br />
<br />
The answers you get should be similar to the ones above (adjusted for your DNS domain name and hostname). If you get any errors, <br />
carefully check your system logs to locate the problem.<br />
<br />
== Step 8: Configure Kerberos ==<br />
<br />
Kerberos configuration is handled by the <tt>krb.conf</tt> file. This file is typically located in the <tt>/etc</tt> directory, please refer to your distribution documentation for the location of this file on your system. Replace the existing file, if any, with the sample from <tt>/usr/local/samba/share/setup/krb5.conf</tt>. Edit the file and replace <tt>${REALM}</tt> with the value you chose for the <tt>--realm</tt> parameter of the provision command above, make sure to enter the realm in '''uppercase letters''':<br />
<br />
[libdefaults]<br />
default_realm = SAMDOM.EXAMPLE.COM<br />
dns_lookup_realm = false<br />
dns_lookup_kdc = true<br />
<br />
=== Testing Kerberos ===<br />
<br />
The simplest test is to use the <tt>kinit</tt> command as follows:<br />
<br />
$ kinit administrator@SAMDOM.EXAMPLE.COM<br />
Password:<br />
<br />
*Note: You must specify your domain realm <tt>SAMDOM.EXAMPLE.COM</tt> in '''uppercase letters'''<br />
<br />
<tt>kinit</tt> will not give you any output. To verify that Kerberos is working, and that you received a ticket, run the following:<br />
<br />
$ klist<br />
Ticket cache: FILE:/tmp/krb5cc_1000<br />
Default principal: administrator@SAMDOM.EXAMPLE.COM<br />
<br />
Valid starting Expires Service principal<br />
02/10/10 19:39:48 02/11/10 19:39:46 krbtgt/SAMDOM.EXAMPLE.COM@SAMDOM.EXAMPLE.COM<br />
<br />
If either <tt>kinit</tt> or <tt>klist</tt> do not exist on your system, refer to [[Samba_4_OS_Requirements]] on how to install the necessary packages.<br />
<br />
You can also test Kerberos form a remote client, but you must first configure the client's <tt>krb5.conf</tt> and <tt>resolve.conf</tt> as shown previously.<br />
<br />
*Note: If you are using a client behind NAT then you have to add the following to the <tt>krb5.conf</tt> on the domain controller server:<br />
<br />
[kdc]<br />
check-ticket-addresses = false<br />
<br />
== Step 9: Configure DNS Dynamic Updates via Kerberos ==<br />
<br />
Samba4 has the capability to automatically update the bind zone files via Kerberos. While this step is optional, it is highly recommended. If you are using Samba's internal DNS server, no configuration is needed, and you can skip this step.<br />
<br />
To setup dynamic DNS updates you need to have a recent version of bind installed. It is highly recommended that you install at least version 9.8.0 as that version includes a set of patches from the Samba Team to make dynamic DNS updates much more robust and easier to configure. In the instructions below we give instructions for both bind 9.7.2 and 9.8.0, but please use 9.8.0 or later if at all possible.<br />
<br />
You can tell what version of bind you have using the command <tt>/usr/sbin/named -V</tt>. If your OS does not have bind-9.8.0 or later, then please consider getting it from a package provided by a 3rd party (for example, on Ubuntu there is a ppa available with the newer versions of bind).<br />
<br />
=== Bind 9.8.0 or Later ===<br />
<br />
When using bind-9.8.0 or later you need to add the following to the options section of your bind config:<br />
options {<br />
[...]<br />
tkey-gssapi-keytab "/usr/local/samba/private/dns.keytab";<br />
[...]<br />
};<br />
<br />
This file is typically located in the <tt>/etc/bind</tt> directory, please refer to your distribution documentation for the location of this file on your system.<br />
<br />
=== Bind 9.7.x ===<br />
<br />
If you have bind-9.7.x (specifically 9.7.2 or later), then first determine if you can <br />
at all possibly run bind-9.8. You will have far fewer problems. Otherwise, follow these instructions.<br />
<br />
The Samba provision will have created a custom <tt>/usr/local/samba/private/named.conf.update</tt> configuration file. You need to include this file in your master <tt>named.conf</tt> to allow Samba/Kerberos DNS updates to automatically take place. Be advised that if you include this file in Bind versions that don't support it, Bind will fail to start.<br />
<br />
You additionally need to set two environment variables when using bind-9.7.x:<br />
<br />
KEYTAB_FILE="/usr/local/samba/private/dns.keytab"<br />
KRB5_KTNAME="/usr/local/samba/private/dns.keytab"<br />
export KEYTAB_FILE<br />
export KRB5_KTNAME<br />
<br />
These should be put in your settings file for bind. On Debian based<br />
systems (including Ubuntu) this is in <tt>/etc/default/bind9</tt>. On RedHat and SUSE derived systems it is<br />
in <tt>/etc/sysconfig/named</tt>, please refer to your distribution documentation for the correct location to set these environment variables. Strictly speaking you only either need<br />
<tt>KEYTAB_FILE</tt> or <tt>KRB5_KTNAME</tt>, but which you need depends on your distribution,<br />
so it's easier to just set both.<br />
<br />
The <tt>dns.keytab</tt> must be readable by the bind server process. Generally, this is accomplished by executing:<br />
$ chown named:named /usr/local/samba/private/dns.keytab<br />
<br />
(the provision should have setup these permissions for you automatically).<br />
<br />
Finally, you need to add the following to the options section of your bind config:<br />
options {<br />
[...]<br />
tkey-gssapi-credential "DNS/server.samdom.example.com";<br />
tkey-domain "SAMDOM.EXAMPLE.COM";<br />
[...]<br />
};<br />
<br />
The last part of the credential in the first line must match the dns name of the server you have set up. This file is typically located in the <tt>/etc/bind</tt> directory, please refer to your distribution documentation for the location of this file on your system.<br />
<br />
=== Testing/Debugging Dynamic DNS Updates ===<br />
<br />
The way the automatic DNS update in Samba works is that the provision<br />
will create a file <tt>/usr/local/samba/private/dns_update_list</tt>, which<br />
contains a list of DNS entries that Samba will try to dynamically<br />
update at startup and every 10 minutes thereafter using <tt>samba_dnsupdate</tt> utility.<br />
Updates will only happen if the DNS entries do not already exist.<br />
Remember that you need <tt>nsupdate</tt> utility from bind the distribution<br />
for all these to work.<br />
<br />
If you want to test or debug this process, then please run this as root:<br />
<br />
/usr/local/samba/sbin/samba_dnsupdate --verbose --all-names<br />
<br />
The command line options specified will force an update of all records in the <tt>dns_update_list</tt>, as well as output detailed information on what is being done.<br />
<br />
=== Interaction With Apparmor or SELinux ===<br />
<br />
If you are using Apparmor or SELinux, you have to ensure that the bind process has read access to the <tt>/usr/local/samba/private/dns.keytab</tt> file, the<br />
<tt>/usr/local/samba/private/named.conf</tt> file as well as read-write access to the <tt>/usr/local/samba/private/dns</tt> directory and it's own zone file. The Samba provision tries to setup the permissions<br />
correctly for these files, but you may find you need to make changes<br />
in your Apparmor or SELinux configuration if you are running either of<br />
those. If you are using Apparmor then the <tt>aa-logprof</tt> command may help<br />
you add any missing permissions you need to add after you start Samba<br />
and bind for the first time after configuring them.<br />
<br />
Please refer to [[#Step 11: Permissions, SELinux Labeling and Policy|Step 11: Permissions, SELinux Labeling and Policy]] for more information.<br />
<br />
== Step 10: Configure NTP (Optional) ==<br />
<br />
You require a recent ntpd version (=>4.2.6) that supports signed ntp. E. g. the version sipped with RHEL6 and Ubuntu < 11.04 are to old.<br />
<br />
1. Download ntpd from ntp.org (verify md5 sum) and compile it (add additionals ./configure parameters, if needed):<br />
<br />
$ tar -zxvf ntp-4.x.x.tar.gz<br />
$ cd ntp-4.x.x<br />
$ ./configure --enable-ntp-signd<br />
$ make<br />
$ make install<br />
<br />
2a. If you already have a supported ntpd version and ntp.conf, you have to add/adjust only the following lines for minimal:<br />
ntpsigndsocket /usr/local/samba/var/lib/ntp_signd/<br />
restrict default mssntp<br />
<br />
2b. If a minimal/simple ntp.conf is fine for you, then fill the file with the following:<br />
server 127.127.1.0<br />
fudge 127.127.1.0 stratum 12<br />
ntpsigndsocket /usr/local/samba/var/lib/ntp_signd/<br />
restrict default mssntp<br />
<br />
2c. A more complex ntp.conf is the following:<br />
server 127.127.1.0<br />
fudge 127.127.1.0 stratum 10<br />
server 0.pool.ntp.org iburst prefer<br />
server 1.pool.ntp.org iburst prefer<br />
driftfile /var/lib/ntp/ntp.drift<br />
logfile /var/log/ntp<br />
ntpsigndsocket /usr/local/samba/var/lib/ntp_signd/<br />
restrict default kod nomodify notrap nopeer mssntp<br />
restrict 127.0.0.1<br />
restrict 0.pool.ntp.org mask 255.255.255.255 nomodify notrap nopeer noquery<br />
restrict 1.pool.ntp.org mask 255.255.255.255 nomodify notrap nopeer noquery<br />
For explanation: This config allows clients to receive time from this NTP host, localhost<br />
doesn't have any restrictions, and the servers we receive the time from ,are not allowed<br />
to do anything else than providing the time to us. For mor information about ntpd<br />
access controll, see<br />
http://support.ntp.org/bin/view/Support/AccessRestrictions<br />
<br />
3. On members of the domain you don't have to configure anything. Per default they will receive<br />
the time from the DC that has the FSMO role PDC.<br />
<br />
== Step 11: Permissions, SELinux Labeling and Policy ==<br />
<br />
These instructions are intended for RedHat 6.X, but may serve as a guide for other distributions/versions.<br />
<br />
There is still more work to be done in regards of creating a Samba4 specific SELinux policy but for now you should be<br />
able to have everything working '''without''' disabling SELinux.<br />
<br />
For all the commands below, make sure you have set the following environment variable:<br />
MYREALM="samdom.example.com"<br />
<br />
=== Bind ===<br />
<br />
Set Permissions:<br />
chown named:named /usr/local/samba/private/dns<br />
chgrp named /usr/local/samba/private/dns.keytab<br />
chmod g+r /usr/local/samba/private/dns.keytab<br />
chmod 775 /usr/local/samba/private/dns<br />
<br />
Label files:<br />
chcon -t named_conf_t /usr/local/samba/private/dns.keytab<br />
chcon -t named_conf_t /usr/local/samba/private/named.conf.update<br />
chcon -t named_var_run_t /usr/local/samba/private/dns<br />
chcon -t named_var_run_t /usr/local/samba/private/dns/${MYREALM}.zone<br />
<br />
Set Label Persistence:<br />
semanage fcontext -a -t named_conf_t /usr/local/samba/private/dns.keytab<br />
semanage fcontext -a -t named_conf_t /usr/local/samba/private/named.conf<br />
semanage fcontext -a -t named_conf_t /usr/local/samba/private/named.conf.update<br />
semanage fcontext -a -t named_var_run_t /usr/local/samba/private/dns<br />
semanage fcontext -a -t named_var_run_t /usr/local/samba/private/dns/${MYREALM}.zone<br />
semanage fcontext -a -t named_var_run_t /usr/local/samba/private/dns/${MYREALM}.zone.jnl<br />
semanage fcontext -a -t ntpd_t /usr/local/samba/var/run/ntp_signd<br />
<br />
=== NTP ===<br />
Set Permissions:<br />
$ chgrp ntp /usr/local/samba/var/lib/ntp_signd<br />
<br />
Multiple attempts to set the context for ntp failed so the below policy was needed for windows clients time sync after joining the DOMAIN.<br />
$ chcon -u system_u -t ntpd_t /usr/local/samba/var/run/ntp_signd<br />
$ chcon -u system_u -t ntpd_t /usr/local/samba/var/run/<br />
$ chcon -t ntpd_t /usr/local/samba/var/run/ntp_signd/socket<br />
<br />
<tt>samba4.te</tt> policy:<br />
module samba4 1.0;<br />
<br />
<br />
require {<br />
type ntpd_t;<br />
type usr_t;<br />
type initrc_t;<br />
class sock_file write;<br />
class unix_stream_socket connectto;<br />
}<br />
<br />
#============= ntpd_t ==============<br />
allow ntpd_t usr_t:sock_file write;<br />
<br />
#============= ntpd_t ==============<br />
allow ntpd_t initrc_t:unix_stream_socket connectto;<br />
<br />
Check and load policy:<br />
$ checkmodule -M -m -o samba4.mod samba4.te <br />
$ semodule_package -o samba4.pp -m samba4.mod<br />
$ semodule -i samba4.pp<br />
<br />
== Step 12: Setup a File Share ==<br />
<br />
The provisioning will create a very simple <tt>/usr/local/samba/etc/smb.conf</tt> file with no non-system shares by<br />
default. For the server to be useful you, will need to update it to<br />
have at least one share. For example:<br />
<br />
[test]<br />
path = /data/test<br />
comment = Test Share<br />
read only = no<br />
<br />
*Note: In older alpha versions of Samba4 you need to restart Samba to make new shares visible.<br />
<br />
== Step 13: Setup a Printer share ==<br />
<br />
You can share any printers already configured with CUPS, keep in mind that Samba4 communicates with CUPS via sockets, so you don't need to set any configure any special permissions beyond a listen directive for the CUPS socket.<br />
<br />
=== Basic Print Sharing ===<br />
<br />
# Create a print spool directory, and set the permissions properly. This is where Samba will store temporary files related to print documents:<br />
mkdir /usr/local/samba/var/spool<br />
chmod 1777 /usr/local/samba/var/spool<br />
<br />
# Configure samba to use it, by adding the following to <tt>/usr/local/samba/etc/smb.conf</tt>:<br />
<br />
[printers]<br />
comment = All Printers<br />
path = /usr/local/samba/var/spool<br />
browseable = Yes<br />
read only = No<br />
printable = Yes<br />
<br />
=== Point and Print Drivers ===<br />
<br />
For the sake of convenience, Windows clients can query the server that is sharing a printer for a print driver. To enable this functionality in Samba, we have to create a special <tt>print$</tt> file share.<br />
<br />
# Create the print file share directory, and architecture sub-directories:<br />
<br />
mkdir -p /usr/local/samba/var/print/{COLOR,IA64,W32ALPHA,W32MIPS,W32PPC,W32X86,WIN40,x64}<br />
<br />
# Configure samba to use it, by adding the following to <tt>/usr/local/samba/etc/smb.conf</tt>:<br />
<br />
[print$]<br />
comment = Point and Print Printer Drivers<br />
path = /usr/local/samba/var/print<br />
read only = No<br />
<br />
# Log in as a Domain Administrator on a client computer<br />
# Click Start -> Run '\\samba\'<br />
# In the list of shares, Double-Click 'Printers and Faxes'<br />
# Click File -> Server Properties<br />
# On the Drivers Tab, Click 'Add...', then 'Next'<br />
#:[[Image:SambaServerDrivers.jpg]]<br />
# In the following prompts, choose the driver you would like to install, and click 'Next'<br />
#:[[Image:SambaServerChooseDriver.jpg]]<br />
# Choose the architectures you are installing the drivers for. Be aware if you choose an architecture that the client computer does not have the driver for you will be prompted to provide a disk with the drivers.<br />
#:[[Image:SambaServerChooseArch.jpg]]<br />
# Close the Server Driver Dialog box<br />
# Right-click on the printer the driver is for and choose Properties<br />
# On the Advanced tab, change the Driver drop-down box to the driver you just installed<br />
<br />
== Note: Filesystem Support ==<br />
<br />
This information has been included in the [[Samba_4_OS_Requirements#File_System_Support]]<br />
<br />
= Configure a Windows Client to join a Samba 4 Active Directory =<br />
<br />
Active Directory is a powerful administration service which enables an Administrator to centrally manage a network of Windows 2000, Windows XP Pro, Windows 2003, Windows Vista Business Edition, and Windows 7 Professional (and up) effectively. To test the real Samba4 capability, we use Windows XP Pro as testing environment (Windows XP Home doesn't include Active Directory functionality and won't work).<br />
<br />
To allow Samba 4 Active Directory or Microsoft Active Directory to manage a computer, we need to join the computer into the active directory.<br />
It involves:<br />
<br />
# Configuring DNS Settings<br />
# Configuring Date & Time and Time Zone<br />
# Joining the domain<br />
<br />
== Step 1: Configure DNS Setting for Windows ==<br />
<br />
Before we configure the DNS settings, verify that you are able to ping the server's IP address. If you are not able to ping the server, double check your IP address, firewall, routing, etc.<br />
<br />
Once you have verified network connectivity between the Samba server and client,<br />
<br />
# Right Click My Network Places, Select Properties<br />
# Right Click Local Area Network, Select Properties<br />
# Double click TCP/IP<br />
# Use a static DNS server, add the Samba4 server's IP address inside the primary DNS server column.<br />
#:[[Image:Samba4dnsclient.jpg]]<br />
# Press OK on all opened windows.<br />
# Open a command prompt, type 'ping samdom.example.com' (as per your provision).<br />
<br />
If you get replies, then it means that your Windows settings are correct for DNS, and the Samba4 server's DNS service is working as well.<br />
<br />
== Step 2: Configure Date & Time and Time Zone ==<br />
<br />
Active Directory uses Kerberos as the backend for authentication. Kerberos requires that the system clocks on the client and server be synchronized to within a few seconds of each other. If they are not synchronized, then authentication will fail for apparently no reason.<br />
<br />
=== Configure the Date & Time ===<br />
# Right-Click on the Time display in the system notification area, Select Adjust Date/Time.<br />
# Change the Date and Time so the client matches the server to the minute, and click OK<br />
#:[[Image:Samba4time.jpg]]<br />
<br />
=== Configure the Time Zone ===<br />
# Right-Click on the Time display in the system notification area, Select Adjust Date/Time.<br />
# Click on the Time Zone Tab<br />
# Change the Time Zone to match the Time Zone on the server.<br />
#:[[Image:Samba4timezone.jpg]]<br />
<br />
== Step 3: Joining Windows Clients to the Domain ==<br />
<br />
Now your Windows computer is ready to join the Active Directory (AD) domain,<br />
<br />
As an Administrator:<br />
<br />
# Right Click My Computer -> Properties<br />
# Choose the Computer Name tab, click Change...<br />
# Click option 'Domain', insert SAMDOM.EXAMPLE.COM. If this fails, try SAMDOM.<br />
#:[[Image:Samba4joindomain.jpg]]<br />
# When it requests a username and password, type '''Administrator''' as the username, and '''p4$$word''' as the password.<br />
# You should get a message box stating "Welcome to the SAMDOM.EXAMPLE.COM domain."<br />
# Click OK on this message box and the Properties window, and you will be instructed to restart your computer.<br />
# After restarting, you should be presented with the normal logon dialog.<br />
# Change the domain to SAMDOM and type '''Administrator''' as the username, and '''p4$$word''' as the password.<br />
#:[[Image:Samba4logindomain.jpg]]<br />
<br />
= Viewing Samba 4 Active Directory object from Windows =<br />
<br />
We need install Windows 2003 Adminpak into Windows XP in order to use<br />
GUI tools to manage the domain. Before you begin, make sure that the domain<br />
administrators have administrative rights to control your computer.(To<br />
give any user administrative rights in Windows XP Pro, right click My<br />
Computer, select Manage-> choose Groups-> double click Administrators<br />
and add members from domain into the member list. When you add<br />
members from Active Directory, it will prompt you to enter an<br />
Active Directory username and password).<br />
<br />
== Step 1: Installing Windows Remote Administration Tools onto Windows ==<br />
<br />
=== Windows 7/Vista ===<br />
<br />
#Download the Windows Remote Administration Tools from:<br />
#* http://www.microsoft.com/downloads/details.aspx?FamilyId=9FF6E897-23CE-4A36-B7FC-D52065DE9960&displaylang=en (Vista)<br />
#* http://www.microsoft.com/downloads/details.aspx?FamilyID=7D2F6AD7-656B-4313-A005-4E344E43997D&displaylang=en (Windows 7)<br />
#Follow the "Install RSAT" instructions<br />
<br />
=== Windows XP Pro ===<br />
<br />
==== Administration Tools Pack & Support Tools ====<br />
# Download adminpak and supporttools from:<br />
#* http://www.microsoft.com/downloads/en/details.aspx?FamilyID=86b71a4f-4122-44af-be79-3f101e533d95<br />
#* http://download.microsoft.com/download/3/e/4/3e438f5e-24ef-4637-abd1-981341d349c7/WindowsServer2003-KB892777-SupportTools-x86-ENU.exe<br />
#:If you installed an older version of the adminpak, you'll notice the dial-in tab is missing from property pages. Just follow the link above to get SP2 which does not have this issue.<br />
# Run through the installation.<br />
# Press start->run, type 'dsa.msc', if a window 'active directory users and computers' prompt up, it mean you had install adminpak it successfully. You can also find this at Start>Programs>Administrative Tools, which should have a lot more items now.<br />
# Go to c:\Program Files\Support Tools to check whether the support tools were installed correctly; if yes, then your XP workstation is ready to manage the Samba 4 Active Directory.<br />
<br />
==== Group Policy Management Console ====<br />
# You may also find the Group Policy Management Console useful. You can download it from<br />
#* http://www.microsoft.com/downloads/details.aspx?FamilyId=0A6D4C24-8CBD-4B35-9272-DD3CBFC81887&displaylang=en<br />
#:This is primarily useful when you have larger installs and are managing many machines. You may need to download the .NET Framework first.<br />
<br />
== Step 2: Viewing Samba4 Active Directory Content ==<br />
<br />
# When logged on as a Domain Administrator, start the Active Directory Users and Computers Snap-In, either by clicking Start -> Programs\Administrative Tools\Active Directory Users and Computers, or by clicking Start -> Run 'dsa.msc'<br />
# Expand the samdom.example.com tree to see existing objects in the domain.<br />
#:[[Image:Samba4dsa.msc.jpg]]<br />
<br />
= Managing Samba 4 Active Directory From a Windows Client =<br />
One of Samba4's goals is to integrate with (and replace) Active Directory as a system. At this point, if everything has worked correctly you should have an "Administrative Tools" menu under Programs. If, under Administrative Tools you have "Active Directory Users and Computers", that is a very good sign. Most times, if there is a configuration or bug in Samba4, the AD Users & Computers (among other interfaces) won't show up as an option. You can run it by hand (Start->Run->dsa.msc) but it's unlikely to work correctly.<br />
<br />
<br />
== Step 1: Adding Users into Samba 4 Active Directory ==<br />
Unlike Samba3, Samba4 does not require a local Unix user for each Samba user that is created.<br />
<br />
To create a Samba user, use the following command:<br />
<br />
/usr/local/samba/bin/samba-tool user add USERNAME<br />
<br />
To inspect the allocated user ID and SID, use the following command:<br />
<br />
$ /usr/local/samba/bin/wbinfo --name-to-sid USERNAME<br />
S-1-5-21-4036476082-4153129556-3089177936-1005 SID_USER (1)<br />
<br />
$ /usr/local/samba/bin/wbinfo --sid-to-uid S-1-5-21-4036476082-4153129556-3089177936-1005<br />
3000011<br />
<br />
If you want to change this mapping, then use <tt>ldbedit<tt> on the <tt>/usr/local/samba/private/idmap.ldb</tt>, as shown:<br />
<br />
$ ldbedit -e emacs -H /usr/local/samba/private/idmap.ldb objectsid=S-1-5-21-4036476082-4153129556-3089177936-1005<br />
<br />
*Note: You can replace <tt>emacs</tt> with your editor of choice.<br />
<br />
You will find records that look like this:<br />
<br />
# record 1<br />
dn: CN=S-1-5-21-4036476082-4153129556-3089177936-1005<br />
cn: S-1-5-21-4036476082-4153129556-3089177936-1005<br />
objectClass: sidMap<br />
objectSid: S-1-5-21-4036476082-4153129556-3089177936-1005<br />
type: ID_TYPE_BOTH<br />
xidNumber: 3000011<br />
distinguishedName: CN=S-1-5-21-4036476082-4153129556-3089177936-1005<br />
<br />
If you change the <tt>xidNumber</tt> attribute and save your editor then exit,<br />
then Samba will update the mapping to between the SID and the user<br />
ID. Updating group mappings works in the same way.<br />
<br />
*Note: You can also manage users using the normal Windows AD user management tools.<br />
<br />
= Setting Up Roaming Profiles =<br />
<br />
1. You will need to create a share for the profiles, typically named <tt>profiles</tt>. Edit the <tt>/usr/local/samba/etc/smb.conf</tt> to include:<br />
<br />
[profiles]<br />
path = /usr/local/samba/var/profiles<br />
read only = no<br />
<br />
2. Create the directory above using:<br />
<br />
$ sudo mkdir /usr/local/samba/var/profiles<br />
<br />
3. In Windows, start ''Active Directory Users and Computers'', select all the users, right click, and hit properties<br />
<br />
4. Under the profile tab, in the ''Profile path'', type the path to your share along with %USERNAME% as follows:<br />
<br />
\\sambaserver.samdom.example.com\profiles\%USERNAME%<br />
<br />
5. click OK, logout and login as one of those users. When you logout again, you should see that the profile has been synced onto the samba server.<br />
<br />
*Note: An excellent walk-through on configuring Roaming Profiles and Folder Redirection is available [http://www.grouppolicy.biz/2010/08/best-practice-roaming-profiles-and-folder-redirection-a-k-a-user-virtualization/ here.]<br />
<br />
= Adding Organization Units (OU) Into a Samba4 Domain = <br />
<br />
The Organizational Unit (OU) is a powerful feature in Active<br />
Directory. This is a type of container which allows you to drag & drop<br />
users and/or computers into it.<br />
<br />
We can link several types of group policies to an OU, and the settings<br />
will push out to all users/computers that sit under the OU. Withing a single domain,<br />
you can have as many OUs and sub-OUs as you'd like. The result is that<br />
it can greatly reduce administrative overhead since you are able to<br />
manage everything via an OU. The implementation of Group Policy will<br />
be discussed in the next chapter.<br />
<br />
Before we create an OU, we must know what one looks like. By default<br />
we can see a sample OU called 'Domain Controllers', which uses a different<br />
icon in the Windows management tools than the 'users' and 'computers'<br />
containers. We can deploy Group Policy to the users or the computers container.<br />
<br />
# To create an OU as the Domain Administrator, click Start -> Run -> dsa.msc<br />
# Right click your domain.<br />
# Select New -> Organizational Unit<br />
# Type 'OU Demo'<br />
# You will see a new OU appear, with the name 'OU Demo'.<br />
# You can drag the user 'demo' into the new OU (Don't move other users! Unless you want to get stuck!).<br />
# Right click 'OU Demo', A sub-OU can be created with New -> Organizational Unit.<br />
<br />
Normally OUs are created according to the department setup of your<br />
organization. Be careful not to confuse Groups and OUs. Groups are<br />
used to control permissions, OUs are used for deploying settings to<br />
all users/computers within the OU.<br />
<br />
= Implementing Group Policies (GPO) in A Samba4 Domain =<br />
<br />
Samba4 Active Directory has support for group policies, and can create<br />
the group policy on the fly. The basic idea of group policies is:-<br />
<br />
# Group Policies have two kinds of settings: computers and users.<br />
# Computer settings apply to computers, while user settings apply to users.<br />
# We link the group policy to a particular OU, and the group policy will effect all computers/users under the OU.<br />
# To add a group policy, right click 'OU Demo' OU->properties.<br />
# Choose group policy.<br />
# Press new, and name it as 'GP Demo'.<br />
# Press edit to modify the policy.<br />
# Here will demonstrate how to block users from access to the control panel. Open the tree 'User Configuration'->'Administrative Templates'->'Control Panel'.<br />
# Double click on 'Prohibit access to the Control Panel'.<br />
# Press enabled and then press OK. Now the all users under 'OU Demo' won't able to access to the control panel.<br />
# Make sure that the user 'demo' is inside the 'OU Demo' (You can drag and drop it). <br />
# Logout and login as user 'demo'.<br />
# You'll find user demo is not able to access control panel.<br />
<br />
== Notes ==<br />
:User configuration will take effect once you logout and login.<br />
:Computer configuration will take effect when you restart the computer.<br />
:GPO Password Policies are not read by Samba when assigning passwords, to change the policy that Samba uses you must use '''samba-tool domain passwordsettings'''<br />
<br />
To learn more about managing and implementing organizational units, group policies, and Active Directory, try a web search for Google in Windows 2003 Active Directory implementation.<br />
<br />
= Joining a Windows Domain Controller as an Additional DC in a Domain =<br />
<br />
Once you have a Samba domain controller set up, you can choose to join<br />
additional domain controllers to the domain, whether they be<br />
additional Samba domain controllers, or additional Windows domain<br />
controllers.<br />
<br />
If you wish to join an additional Samba domain controller to a domain,<br />
then please see the [[Samba4/HOWTO/Join a domain as a DC|Joining a domain as a DC]] page. The instructions<br />
on that page are the same for joining Samba to a Windows domain as<br />
they are for joining Samba to an existing Samba domain.<br />
<br />
If you wish to join a new Windows domain controller to a Samba domain,<br />
then you should use the 'dcpromo' tool on the Windows machine. Please<br />
see the normal instructions for installing dcpromo on Windows, with<br />
the exception that you should not check the 'DNS server' option box<br />
when it is offered. Right now you should either use Windows for DNS,<br />
or use Samba and bind9 for DNS. Mixing the two can work, but it is an<br />
advanced topic that is beyond the scope of this howto.<br />
<br />
= Migrating an Existing Samba3 Domain to Samba4 =<br />
<br />
It is very likely that you already have a running Samba3 domain on your network. The question is, how do you migrate that domain and all of its users and machines over to a new Samba4 based domain without having to move every user profile and machine to the new domain? The answer is the [[Samba4/samba-tool/domain/classicupgrade/HOWTO|samba-tool domain classicupgrade]] function.<br />
<br />
= Connecting other services to your new/migrated Active Directory =<br />
<br />
If you finished setting up or migrating to Samba4, you maybe want to connect other services<br />
to your new Active Directory. Have a look at the [[Samba4/beyond|Beyond Samba]] page.<br />
<br />
= Report Your Success/Failure! =<br />
<br />
Samba4, as a replicating domain controller, is still developing rapidly.<br />
We'd like to hear from users about their successes and<br />
failures. While Samba4 is still in alpha release, we would encourage<br />
you to report both your successes and failures to the samba-technical<br />
mailing list on http://lists.samba.org<br />
<br />
Please be aware that Samba4 is not complete, and therefore, should be deployed carefully until it is ready for a stable release.</div>Intruder0815https://wiki.samba.org/index.php?title=Setting_up_Samba_as_an_Active_Directory_Domain_Controller&diff=7110Setting up Samba as an Active Directory Domain Controller2012-12-09T11:53:27Z<p>Intruder0815: fixed path of ntpsigndsocket - defaults to samba/var/lib/ntp_signd/ in recent RCs</p>
<hr />
<div>= HOWTO to set up a AD DC =<br />
<br />
This document explains how to setup a simple Samba4<br />
server. This is aimed at people who are already familiar with Samba3<br />
and wish to participate in Samba4 development or test the alpha<br />
releases of Samba4. This is not aimed at general production use of<br />
Samba4, although some brave sites are running Samba4 in production<br />
based on these instructions.<br />
<br />
== Video Demonstrations of This HOWTO ==<br />
<br />
A set of [[samba4/videos|demonstration videos]] is available that<br />
may provide a useful overview of the contents of this HOWTO.<br />
<br />
== A Note on Alpha/Beta/RC Versions ==<br />
<br />
Samba4 is developing very rapidly. This HOWTO is frequently updated to reflect the latest changes in the Samba git repository. Please see the Samba4 [[Samba4/Status|Status]] Wiki for more specifics on project status.<br />
<br />
== Samba 4 OS Requirements ==<br />
<br />
Because of the constantly changing and ever expanding nature of Linux, the '''OS Requirements for Samba4 have been moved''' from Step 2, to [[Samba_4/OS_Requirements]]<br />
This not only includes the required packages for a successful Samba4 deployment, but also the required file system features. Please consider that page as a prerequisite to a successful Samba4 setup.<br />
<br />
== Step 1: Download Samba4 ==<br />
<br />
Currently, there are three methods to download the current Samba4 sources, in order of preference: via git, rsync, or as a tarball from the samba.org website. We strongly recommend using the git method for downloading Samba, as it makes getting updates easier, and also allows you to integrate test patches from Samba developers more easily in case of problems. <br />
<br />
In the following examples we will assume that your top-level source is named <tt>samba-master</tt>. If you downloaded a tarball this will instead be based on the name of the tarball downloaded (e.g. <tt>samba-4.0.0alpha13</tt> for the tarball samba-4.0.0alpha13.tar.gz). Also note that in the <tt>master</tt> branch the<br />
samba4 code in our current git tree is now located in the top level directory.<br />
<br />
=== Downloading via git ===<br />
<br />
Git allows you to download the source tree via either the <tt>git</tt> or <tt>http</tt>protocols. In general, the <tt>git</tt> protocol is the preferred choice since it compresses the data being transferred. To download the source tree via <tt>git</tt>, run the following command:<br />
<br />
$ git clone git://git.samba.org/samba.git samba-master<br />
<br />
Alternatively, if you prefer to use the <tt>http</tt> protocol, run the following command:<br />
<br />
$ git clone http://gitweb.samba.org/samba.git samba-master<br />
<br />
Either command will create a directory called <tt>samba-master</tt> in the current<br />
directory.<br />
<br />
=== Updating via git ===<br />
<br />
If you already have downloaded the source tree via <tt>git</tt> and want to update the tree to the latest version, run the following command in your <tt>samba-master</tt> directory:<br />
<br />
$ git pull<br />
<br />
If you get an error like this:<br />
fatal: Unable to create '[...]/samba_master/.git/index.lock': File exists.<br />
Run the command below to reset your tree.<br />
<br />
If you are having trouble compiling the source, it may be due to stale files. You can reset your <tt>git</tt> tree to correct these errors. To reset your <tt>git</tt> tree, run the following command in your <tt>samba-master</tt> directory:<br />
<br />
$ git clean -x -f -d<br />
<br />
=== Downloading via rsync ===<br />
<br />
If <tt>git</tt> is not available to you, <tt>rsync</tt> is the next best choice. To download the source tree via <tt>rsync</tt>, run the following command:<br />
<br />
$ rsync -avz samba.org::ftp/unpacked/samba_4_0_test/ samba-master<br />
<br />
This command will create a directory called <tt>samba-master</tt> in the current directory, containing a checked out <tt>git</tt> repository. If you plan on using <tt>git</tt> to manage the tree, you will need to run the following commands in your <tt>samba-master</tt> directory:<br />
<br />
$ cd samba-master/<br />
$ rm .git/refs/tags/*<br />
$ rm -r .git/refs/remotes/<br />
$ git config remote.origin.url git://git.samba.org/samba.git<br />
$ git config --add remote.origin.fetch +refs/tags/*:refs/tags/* (this line is optional)<br />
$ git fetch<br />
<br />
Note you can ignore this error from <tt>git fetch</tt>:<br />
error: refs/heads/master does not point to a valid object!<br />
<br />
Refer to the [[#Updating via git|Updating via git]] instructions on how to manage the source tree with <tt>git</tt>.<br />
<br />
=== Downloading a tarball ===<br />
<br />
If both <tt>git</tt> and <tt>rsync</tt> are not available, you can download the latest Samba 4.0 Release Candidate tarball from [http://ftp.samba.org/pub/samba/rc/ the Samba website]<br />
<br />
== Step 2: Compile Samba4 ==<br />
<br />
To build Samba4, run the following command in your <tt>samba-master</tt> directory:<br />
<br />
$ cd samba-master<br />
$ ./configure --enable-debug --enable-selftest<br />
$ make<br />
<br />
The above command will setup Samba4 to install in <tt>/usr/local/samba</tt>. If you want Samba to install in a different directory, then you should use the <tt>--prefix</tt> option to <tt>configure</tt>.<br />
<br />
The reason we recommend using <tt>--enable-debug --enable-selftest</tt> for Samba is that it will include extra debug information that will help us diagnose problems in case of failures, and will also allow you to run our selftest <tt>make test</tt> to validate that Samba can behave correctly on your platform. Both of these are however, entirely '''optional'''.<br />
<br />
'''Profiling with google-perftools'''<br />
<br />
If you want to enable profiling support, change the configure command above to the following:<br />
$ LDFLAGS="-ltcmalloc -lprofiler" ./configure.developer<br />
:''(This also works for CFLAGS)''<br />
<br />
== Step 3: Install Samba4 ==<br />
<br />
To install Samba4, run the following command in your <tt>samba-master</tt> directory:<br />
<br />
$ make install<br />
<br />
Note that this must be run as a user who has permission to write to the install directory, which defaults to <tt>/usr/local/samba</tt>. See [[#Step 2: Compile Samba4|Step 2: Compile Samba4]] for instructions on how to change the install directory.<br />
<br />
For the rest of this HOWTO we will assume that you have installed<br />
Samba4 in the default location. All future Samba commands will stem from the <tt>/usr/local/samba/sbin</tt> and <tt>/usr/local/samba/bin</tt> directories.<br />
<br />
Please review the [[Samba4#Previous_Releases|Release Notes]] for the version you have installed, it may contain important information not yet reflected in this HOWTO.<br />
<br />
=== Upgrading ===<br />
<br />
If you are upgrading from a previous release of Samba4, be sure to review all the [[Samba4#Previous_Releases|Release Notes]] for the new version, as well as the notes for all the interim versions.<br />
<br />
== Step 4: Provision Samba4 ==<br />
<br />
The provision step sets up a basic user database, and is used when you are setting up your Samba4<br />
server in its own domain. If you instead want to setup your Samba4 server as an additional domain controller<br />
in an existing domain, then please see the [[#Joining a Windows Domain Controller as an Additional DC in a Domain|Joining a Windows Domain Controller as an Additional DC in a Domain]] section on this page. If you want to migrate an existing Samba3 domain to Samba4, see the [[#Migrating an Existing Samba3 Domain to Samba4|Migrating an Existing Samba3 Domain to Samba4]] section on this page.<br />
<br />
For the rest of the HOWTO we will assume that your DNS domain name is<br />
<tt>samdom.example.com</tt>, your short (also known as NT4) domain name is<br />
<tt>samdom</tt>, your Samba server's hostname is <tt>samba</tt>, and the IP Address of your Samba server is <tt>192.168.1.2</tt>.<br />
<br />
The provision step must be run as a user with permission to write to the install directory.<br />
<br />
# /usr/local/samba/bin/samba-tool domain provision \<br />
--realm=samdom.example.com --domain=SAMDOM \<br />
--adminpass='p4$$word' --server-role=dc<br />
<br />
If you run the previous command with a user who does not have write permission to the install directory, you will get an error similar to this:<br />
tdb_open_ex: could not open file /usr/local/samba/private/sam.ldb.d/DC=SAMDOM,DC=EXAMPLE,DC=COM. ldb: Permission denied<br />
<br />
There are many other options you can pass to the <tt>samba-tool domain provision</tt> command. You can run it with the <tt>--help</tt> option to see a list of them.<br />
<br />
*Note: As of September 11, 2012 (Samba4.0.0RC1) the provision command now uses Samba4's internal DNS server, if you would like the older behavior, add <tt>--dns-backend=BIND9_DLZ</tt> to the above provision command.<br />
*Note: You may need to remove the <tt>/usr/local/samba/etc/smb.conf</tt> file if you are re-running the provision command.<br />
<br />
== Step 5: Starting Samba4 ==<br />
<br />
If you are planning to run Samba4 as a production server, then just run the <tt>samba</tt> binary as root<br />
<br />
# /usr/local/samba/sbin/samba<br />
<br />
That will run Samba4 in 'standard' mode, which is suitable for<br />
production use. Samba4 doesn't yet have init scripts included<br />
for each platform, but making one for your platform should not be<br />
difficult. There are some example scripts (for RedHat/Fedora, Debian and Ubuntu) on the [[Samba4/InitScript]] page.<br />
<br />
If you are running Samba4 as a developer you may find<br />
the following more useful:<br />
<br />
# /usr/local/samba/sbin/samba -i -M single<br />
<br />
This will start <tt>samba</tt> with all log messages printed to stdout, and restricting it to a<br />
single process. That mode of operation makes debugging <tt>samba</tt> with <tt>gdb</tt><br />
easier. If you want to launch it under <tt>gdb</tt>, run <tt>samba</tt> as follows:<br />
<br />
# gdb --args /usr/local/samba/sbin/samba -i -M single<br />
<br />
Note that if you are running any Samba3 <tt>smbd</tt> or <tt>nmbd</tt> processes<br />
they need to be stopped before starting <tt>samba</tt> from Samba4.<br />
<br />
Take care when running Samba4 commands if you also have a previous version of Samba installed. To avoid inadvertently running the wrong version, you should consider putting the <tt>/usr/local/samba/bin</tt> and <tt>/usr/local/samba/sbin</tt> directories in the beginning of your <tt>PATH</tt> variable.<br />
<br />
You can see what version of Samba, if any, is in your <tt>PATH</tt> variable by running the following:<br />
# samba -V<br />
<br />
*Note: In older developer versions of Samba4 <tt>samba</tt> was still called <tt>smbd</tt>.<br />
<br />
== Step 6: Testing Samba4 ==<br />
<br />
First check you have the right version of <tt>smbclient</tt> by running the following command:<br />
<br />
$ /usr/local/samba/bin/smbclient --version<br />
<br />
This should show you a version starting with "Version 4.0.XXXXX". <br />
<br />
Now run this command to list the shares on your Samba4 server:<br />
<br />
$ /usr/local/samba/bin/smbclient -L localhost -U%<br />
<br />
The output of the command should be similar to what is shown below:<br />
<br />
Sharename Type Comment<br />
--------- ---- -------<br />
netlogon Disk<br />
sysvol Disk<br />
IPC$ IPC IPC Service (Samba 4.0.0alpha12-GIT-5e755e9)<br />
ADMIN$ Disk DISK Service (Samba 4.0.0alpha12-GIT-5e755e9)<br />
<br />
The <tt>netlogon</tt> and <tt>sysvol</tt> shares are basic shares needed for Active Directory server<br />
operation. <br />
<br />
If the command failed, restart samba by running the following:<br />
<br />
# killall samba<br />
# rm -v -- /usr/local/samba/var/run/smbd-fileserver.conf.pid<br />
# /usr/local/samba/sbin/samba<br />
<br />
To test that authentication is working, you should try to connect to the <tt>netlogon</tt> share<br />
using the Administrator password you set earlier:<br />
<br />
$ smbclient //localhost/netlogon -UAdministrator%'p4$$word' -c 'ls'<br />
<br />
The output of the command should be similar to what is shown below:<br />
<br />
Domain=[SAMDOM] OS=[Unix] Server=[Samba 4.0.0beta9-GIT-e4677e3]<br />
. D 0 Wed Sep 12 21:00:36 2012<br />
.. D 0 Wed Sep 12 21:02:28 2012<br />
<br />
== Step 7: Configure DNS ==<br />
<br />
A working DNS setup is essential to the correct operation of<br />
Samba4. Without the right DNS entries, Kerberos won't work, which in<br />
turn means that many of the basic features of Samba4 won't work.<br />
<br />
It is worth spending some extra time to ensure your DNS setup is correct, as debugging problems caused by mis-configured DNS can take a<br />
lot of time later on.<br />
<br />
=== DNS Server ===<br />
==== Samba's Internal DNS Server ====<br />
<br />
If you specified <tt>--dns-backend=SAMBA_INTERNAL</TT> or did not specify any backend at all when you provisioned, there is no further setup required for the DNS server. However, you still need to configure your <tt>/etc/resolv.conf</tt> as shown in [[#Configure /etc/resolv.conf|Configure /etc/resolv.conf]]<br />
<br />
If you want the internal DNS server to forward requests it isn't responsible for, then add the following to your smb.conf:<br />
dns forwarder = {IP-Address of the DNS you want to forward to}<br />
<br />
==== Bind 9.8.0 or newer ====<br />
<br />
If using BIND, the next step to get a working DNS setup for Samba4 is to start<br />
with the DNS configuration file that is created by the<br />
[[#Step 4: Provision Samba4|provision step]] or if you are using any of the other samba-tool options (classicupgrade for example) you can specify --dns-backend=BIND9_DLZ or --dns-backend=BIND9_FLATFILE.<br />
<br />
You can<br />
activate the configuration that the provision has created by including this configuration file in bind's named configuration file. This file is typically located in the <tt>/etc/bind</tt> directory, please refer to your distribution documentation for the location of this file on your system. Once located, add the following line to the configuration file:<br />
<br />
include "/usr/local/samba/private/named.conf";<br />
<br />
Edit that file to uncomment the correct dlz plugin line, based on your version of bind. Open the <tt>/usr/local/samba/private/named.conf</tt> file in a text editor and follow the instructions inside.<br />
<br />
After adding that line you should restart your Bind server and check<br />
in the system logs for any problems. If available, you can run <tt>named-checkconf</tt> to help you fix any problems with your named configuration.<br />
<br />
==== Bind 9.7.x ====<br />
<br />
Users of bind-9.7.x are strongly encouraged to upgrade to bind-9.8 or bind-9.9. If this is not possible, refer to the section [[#Step 9: Configure Kerberos DNS Dynamic Updates|Configure Kerberos DNS Dynamic Updates]] for instructions on configuring bind-9.7.<br />
<br />
==== Bind (All Versions) ====<br />
<br />
A common problem you may encounter is that many modern Linux distributions activate<br />
'Apparmor' or 'SELinux' by default, and these may be configured to<br />
deny access to Bind for your the <tt>named.conf</tt> and zone files created in<br />
the provision. If your Bind logs show that Bind is getting a access<br />
denied error accessing these files, please see your local system<br />
documentation for how to enable access to these files in Bind (hint:<br />
for Apparmor systems such as Ubuntu, the command <tt>aa-logprof</tt> may be<br />
useful).<br />
<br />
*Note: On Debian systems, the zone auto-generation might detect and use <tt>127.0.1.1</tt> as the domain controller's IP address. This will cause problems when trying to connect to the server from client machines. To fix this, you will need to adjust <tt>/usr/local/samba/private/named.conf</tt> by changing <tt>127.0.1.1</tt> to reflect the actual IP address of the server you're setting up.<br />
*Note: On Debian SID (bind9 package), <tt>/etc/bind/named.conf.options</tt> is missing and this will cause the <tt>named</tt> daemon to fail to start. To fix this either create an empty file, or comment out corresponding line in <tt>/etc/bind/named.conf</tt>. See your syslog messages for more information.<br />
<br />
=== Configure /etc/resolv.conf ===<br />
<br />
For all the local DNS lookups to resolve correctly, we need to modify the server's <tt>/etc/resolv.conf</tt> file. The following example should be sufficient to have DNS resolve properly:<br />
<br />
domain samdom.example.com<br />
nameserver 192.168.1.2<br />
<br />
*Note: Remember to change the IP Address to your Samba server's IP Address<br />
*Note: If your server is set up to receive its IP configuration via DHCP, the <tt>/etc/resolv.conf</tt> file might be automatically updated. Refer to your distribution's documentation on how to stop this behavior.<br />
<br />
=== Testing DNS ===<br />
<br />
To test that DNS is working properly, run the following commands and compare the output to what is shown:<br />
<br />
$ host -t SRV _ldap._tcp.samdom.example.com.<br />
_ldap._tcp.samdom.example.com has SRV record 0 100 389 samba.samdom.example.com.<br />
<br />
$ host -t SRV _kerberos._udp.samdom.example.com.<br />
_kerberos._udp.samdom.example.com has SRV record 0 100 88 samba.samdom.example.com.<br />
<br />
$ host -t A samba.samdom.example.com.<br />
samba.samdom.example.com has address 10.0.0.1<br />
<br />
The answers you get should be similar to the ones above (adjusted for your DNS domain name and hostname). If you get any errors, <br />
carefully check your system logs to locate the problem.<br />
<br />
== Step 8: Configure Kerberos ==<br />
<br />
Kerberos configuration is handled by the <tt>krb.conf</tt> file. This file is typically located in the <tt>/etc</tt> directory, please refer to your distribution documentation for the location of this file on your system. Replace the existing file, if any, with the sample from <tt>/usr/local/samba/share/setup/krb5.conf</tt>. Edit the file and replace <tt>${REALM}</tt> with the value you chose for the <tt>--realm</tt> parameter of the provision command above, make sure to enter the realm in '''uppercase letters''':<br />
<br />
[libdefaults]<br />
default_realm = SAMDOM.EXAMPLE.COM<br />
dns_lookup_realm = false<br />
dns_lookup_kdc = true<br />
<br />
=== Testing Kerberos ===<br />
<br />
The simplest test is to use the <tt>kinit</tt> command as follows:<br />
<br />
$ kinit administrator@SAMDOM.EXAMPLE.COM<br />
Password:<br />
<br />
*Note: You must specify your domain realm <tt>SAMDOM.EXAMPLE.COM</tt> in '''uppercase letters'''<br />
<br />
<tt>kinit</tt> will not give you any output. To verify that Kerberos is working, and that you received a ticket, run the following:<br />
<br />
$ klist<br />
Ticket cache: FILE:/tmp/krb5cc_1000<br />
Default principal: administrator@SAMDOM.EXAMPLE.COM<br />
<br />
Valid starting Expires Service principal<br />
02/10/10 19:39:48 02/11/10 19:39:46 krbtgt/SAMDOM.EXAMPLE.COM@SAMDOM.EXAMPLE.COM<br />
<br />
If either <tt>kinit</tt> or <tt>klist</tt> do not exist on your system, refer to [[Samba_4_OS_Requirements]] on how to install the necessary packages.<br />
<br />
You can also test Kerberos form a remote client, but you must first configure the client's <tt>krb5.conf</tt> and <tt>resolve.conf</tt> as shown previously.<br />
<br />
*Note: If you are using a client behind NAT then you have to add the following to the <tt>krb5.conf</tt> on the domain controller server:<br />
<br />
[kdc]<br />
check-ticket-addresses = false<br />
<br />
== Step 9: Configure DNS Dynamic Updates via Kerberos ==<br />
<br />
Samba4 has the capability to automatically update the bind zone files via Kerberos. While this step is optional, it is highly recommended. If you are using Samba's internal DNS server, no configuration is needed, and you can skip this step.<br />
<br />
To setup dynamic DNS updates you need to have a recent version of bind installed. It is highly recommended that you install at least version 9.8.0 as that version includes a set of patches from the Samba Team to make dynamic DNS updates much more robust and easier to configure. In the instructions below we give instructions for both bind 9.7.2 and 9.8.0, but please use 9.8.0 or later if at all possible.<br />
<br />
You can tell what version of bind you have using the command <tt>/usr/sbin/named -V</tt>. If your OS does not have bind-9.8.0 or later, then please consider getting it from a package provided by a 3rd party (for example, on Ubuntu there is a ppa available with the newer versions of bind).<br />
<br />
=== Bind 9.8.0 or Later ===<br />
<br />
When using bind-9.8.0 or later you need to add the following to the options section of your bind config:<br />
options {<br />
[...]<br />
tkey-gssapi-keytab "/usr/local/samba/private/dns.keytab";<br />
[...]<br />
};<br />
<br />
This file is typically located in the <tt>/etc/bind</tt> directory, please refer to your distribution documentation for the location of this file on your system.<br />
<br />
=== Bind 9.7.x ===<br />
<br />
If you have bind-9.7.x (specifically 9.7.2 or later), then first determine if you can <br />
at all possibly run bind-9.8. You will have far fewer problems. Otherwise, follow these instructions.<br />
<br />
The Samba provision will have created a custom <tt>/usr/local/samba/private/named.conf.update</tt> configuration file. You need to include this file in your master <tt>named.conf</tt> to allow Samba/Kerberos DNS updates to automatically take place. Be advised that if you include this file in Bind versions that don't support it, Bind will fail to start.<br />
<br />
You additionally need to set two environment variables when using bind-9.7.x:<br />
<br />
KEYTAB_FILE="/usr/local/samba/private/dns.keytab"<br />
KRB5_KTNAME="/usr/local/samba/private/dns.keytab"<br />
export KEYTAB_FILE<br />
export KRB5_KTNAME<br />
<br />
These should be put in your settings file for bind. On Debian based<br />
systems (including Ubuntu) this is in <tt>/etc/default/bind9</tt>. On RedHat and SUSE derived systems it is<br />
in <tt>/etc/sysconfig/named</tt>, please refer to your distribution documentation for the correct location to set these environment variables. Strictly speaking you only either need<br />
<tt>KEYTAB_FILE</tt> or <tt>KRB5_KTNAME</tt>, but which you need depends on your distribution,<br />
so it's easier to just set both.<br />
<br />
The <tt>dns.keytab</tt> must be readable by the bind server process. Generally, this is accomplished by executing:<br />
$ chown named:named /usr/local/samba/private/dns.keytab<br />
<br />
(the provision should have setup these permissions for you automatically).<br />
<br />
Finally, you need to add the following to the options section of your bind config:<br />
options {<br />
[...]<br />
tkey-gssapi-credential "DNS/server.samdom.example.com";<br />
tkey-domain "SAMDOM.EXAMPLE.COM";<br />
[...]<br />
};<br />
<br />
The last part of the credential in the first line must match the dns name of the server you have set up. This file is typically located in the <tt>/etc/bind</tt> directory, please refer to your distribution documentation for the location of this file on your system.<br />
<br />
=== Testing/Debugging Dynamic DNS Updates ===<br />
<br />
The way the automatic DNS update in Samba works is that the provision<br />
will create a file <tt>/usr/local/samba/private/dns_update_list</tt>, which<br />
contains a list of DNS entries that Samba will try to dynamically<br />
update at startup and every 10 minutes thereafter using <tt>samba_dnsupdate</tt> utility.<br />
Updates will only happen if the DNS entries do not already exist.<br />
Remember that you need <tt>nsupdate</tt> utility from bind the distribution<br />
for all these to work.<br />
<br />
If you want to test or debug this process, then please run this as root:<br />
<br />
/usr/local/samba/sbin/samba_dnsupdate --verbose --all-names<br />
<br />
The command line options specified will force an update of all records in the <tt>dns_update_list</tt>, as well as output detailed information on what is being done.<br />
<br />
=== Interaction With Apparmor or SELinux ===<br />
<br />
If you are using Apparmor or SELinux, you have to ensure that the bind process has read access to the <tt>/usr/local/samba/private/dns.keytab</tt> file, the<br />
<tt>/usr/local/samba/private/named.conf</tt> file as well as read-write access to the <tt>/usr/local/samba/private/dns</tt> directory and it's own zone file. The Samba provision tries to setup the permissions<br />
correctly for these files, but you may find you need to make changes<br />
in your Apparmor or SELinux configuration if you are running either of<br />
those. If you are using Apparmor then the <tt>aa-logprof</tt> command may help<br />
you add any missing permissions you need to add after you start Samba<br />
and bind for the first time after configuring them.<br />
<br />
Please refer to [[#Step 11: Permissions, SELinux Labeling and Policy|Step 11: Permissions, SELinux Labeling and Policy]] for more information.<br />
<br />
== Step 10: Configure NTP (Optional) ==<br />
<br />
You require a recent ntpd version (=>4.2.6) that supports signed ntp. E. g. the version sipped with RHEL6 and Ubuntu < 11.04 are to old.<br />
<br />
1. Download ntpd from ntp.org (verify md5 sum) and compile it (add additionals ./configure parameters, if needed):<br />
<br />
$ tar -zxvf ntp-4.x.x.tar.gz<br />
$ cd ntp-4.x.x<br />
$ ./configure --enable-ntp-signd<br />
$ make<br />
$ make install<br />
<br />
2a. If you already have a supported ntpd version and ntp.conf, you have to add/adjust only the following lines for minimal:<br />
ntpsigndsocket /usr/local/samba/var/lib/ntp_signd/<br />
restrict default mssntp<br />
<br />
2b. If a minimal/simple ntp.conf is fine for you, then fill the file with the following:<br />
server 127.127.1.0<br />
fudge 127.127.1.0 stratum 12<br />
ntpsigndsocket /usr/local/samba/var/lib/ntp_signd/<br />
restrict default mssntp<br />
<br />
2c. A more complex ntp.conf is the following:<br />
server 127.127.1.0<br />
fudge 127.127.1.0 stratum 10<br />
server 0.pool.ntp.org iburst prefer<br />
server 1.pool.ntp.org iburst prefer<br />
driftfile /var/lib/ntp/ntp.drift<br />
logfile /var/log/ntp<br />
ntpsigndsocket /usr/local/samba/var/lib/ntp_signd/<br />
restrict default kod nomodify notrap nopeer mssntp<br />
restrict 127.0.0.1<br />
restrict 0.pool.ntp.org mask 255.255.255.255 nomodify notrap nopeer noquery<br />
restrict 1.pool.ntp.org mask 255.255.255.255 nomodify notrap nopeer noquery<br />
For explanation: This config allows clients to receive time from this NTP host, localhost<br />
doesn't have any restrictions, and the servers we receive the time from ,are not allowed<br />
to do anything else than providing the time to us. For mor information about ntpd<br />
access controll, see<br />
http://support.ntp.org/bin/view/Support/AccessRestrictions<br />
<br />
3. On members of the domain you don't have to configure anything. Per default they will receive<br />
the time from the DC that has the FSMO role PDC.<br />
<br />
== Step 11: Permissions, SELinux Labeling and Policy ==<br />
<br />
These instructions are intended for RedHat 6.X, but may serve as a guide for other distributions/versions.<br />
<br />
There is still more work to be done in regards of creating a Samba4 specific SELinux policy but for now you should be<br />
able to have everything working '''without''' disabling SELinux.<br />
<br />
For all the commands below, make sure you have set the following environment variable:<br />
MYREALM="samdom.example.com"<br />
<br />
=== Bind ===<br />
<br />
Set Permissions:<br />
chown named:named /usr/local/samba/private/dns<br />
chgrp named /usr/local/samba/private/dns.keytab<br />
chmod g+r /usr/local/samba/private/dns.keytab<br />
chmod 775 /usr/local/samba/private/dns<br />
<br />
Label files:<br />
chcon -t named_conf_t /usr/local/samba/private/dns.keytab<br />
chcon -t named_conf_t /usr/local/samba/private/named.conf.update<br />
chcon -t named_var_run_t /usr/local/samba/private/dns<br />
chcon -t named_var_run_t /usr/local/samba/private/dns/${MYREALM}.zone<br />
<br />
Set Label Persistence:<br />
semanage fcontext -a -t named_conf_t /usr/local/samba/private/dns.keytab<br />
semanage fcontext -a -t named_conf_t /usr/local/samba/private/named.conf<br />
semanage fcontext -a -t named_conf_t /usr/local/samba/private/named.conf.update<br />
semanage fcontext -a -t named_var_run_t /usr/local/samba/private/dns<br />
semanage fcontext -a -t named_var_run_t /usr/local/samba/private/dns/${MYREALM}.zone<br />
semanage fcontext -a -t named_var_run_t /usr/local/samba/private/dns/${MYREALM}.zone.jnl<br />
semanage fcontext -a -t ntpd_t /usr/local/samba/var/run/ntp_signd<br />
<br />
=== NTP ===<br />
<br />
Multiple attempts to set the context for ntp failed so the below policy was needed for windows clients time sync after joining the DOMAIN.<br />
$ chcon -u system_u -t ntpd_t /usr/local/samba/var/run/ntp_signd<br />
$ chcon -u system_u -t ntpd_t /usr/local/samba/var/run/<br />
$ chcon -t ntpd_t /usr/local/samba/var/run/ntp_signd/socket<br />
<br />
<tt>samba4.te</tt> policy:<br />
module samba4 1.0;<br />
<br />
<br />
require {<br />
type ntpd_t;<br />
type usr_t;<br />
type initrc_t;<br />
class sock_file write;<br />
class unix_stream_socket connectto;<br />
}<br />
<br />
#============= ntpd_t ==============<br />
allow ntpd_t usr_t:sock_file write;<br />
<br />
#============= ntpd_t ==============<br />
allow ntpd_t initrc_t:unix_stream_socket connectto;<br />
<br />
Check and load policy:<br />
$ checkmodule -M -m -o samba4.mod samba4.te <br />
$ semodule_package -o samba4.pp -m samba4.mod<br />
$ semodule -i samba4.pp<br />
<br />
== Step 12: Setup a File Share ==<br />
<br />
The provisioning will create a very simple <tt>/usr/local/samba/etc/smb.conf</tt> file with no non-system shares by<br />
default. For the server to be useful you, will need to update it to<br />
have at least one share. For example:<br />
<br />
[test]<br />
path = /data/test<br />
comment = Test Share<br />
read only = no<br />
<br />
*Note: In older alpha versions of Samba4 you need to restart Samba to make new shares visible.<br />
<br />
== Step 13: Setup a Printer share ==<br />
<br />
You can share any printers already configured with CUPS, keep in mind that Samba4 communicates with CUPS via sockets, so you don't need to set any configure any special permissions beyond a listen directive for the CUPS socket.<br />
<br />
=== Basic Print Sharing ===<br />
<br />
# Create a print spool directory, and set the permissions properly. This is where Samba will store temporary files related to print documents:<br />
mkdir /usr/local/samba/var/spool<br />
chmod 1777 /usr/local/samba/var/spool<br />
<br />
# Configure samba to use it, by adding the following to <tt>/usr/local/samba/etc/smb.conf</tt>:<br />
<br />
[printers]<br />
comment = All Printers<br />
path = /usr/local/samba/var/spool<br />
browseable = Yes<br />
read only = No<br />
printable = Yes<br />
<br />
=== Point and Print Drivers ===<br />
<br />
For the sake of convenience, Windows clients can query the server that is sharing a printer for a print driver. To enable this functionality in Samba, we have to create a special <tt>print$</tt> file share.<br />
<br />
# Create the print file share directory, and architecture sub-directories:<br />
<br />
mkdir -p /usr/local/samba/var/print/{COLOR,IA64,W32ALPHA,W32MIPS,W32PPC,W32X86,WIN40,x64}<br />
<br />
# Configure samba to use it, by adding the following to <tt>/usr/local/samba/etc/smb.conf</tt>:<br />
<br />
[print$]<br />
comment = Point and Print Printer Drivers<br />
path = /usr/local/samba/var/print<br />
read only = No<br />
<br />
# Log in as a Domain Administrator on a client computer<br />
# Click Start -> Run '\\samba\'<br />
# In the list of shares, Double-Click 'Printers and Faxes'<br />
# Click File -> Server Properties<br />
# On the Drivers Tab, Click 'Add...', then 'Next'<br />
#:[[Image:SambaServerDrivers.jpg]]<br />
# In the following prompts, choose the driver you would like to install, and click 'Next'<br />
#:[[Image:SambaServerChooseDriver.jpg]]<br />
# Choose the architectures you are installing the drivers for. Be aware if you choose an architecture that the client computer does not have the driver for you will be prompted to provide a disk with the drivers.<br />
#:[[Image:SambaServerChooseArch.jpg]]<br />
# Close the Server Driver Dialog box<br />
# Right-click on the printer the driver is for and choose Properties<br />
# On the Advanced tab, change the Driver drop-down box to the driver you just installed<br />
<br />
== Note: Filesystem Support ==<br />
<br />
This information has been included in the [[Samba_4_OS_Requirements#File_System_Support]]<br />
<br />
= Configure a Windows Client to join a Samba 4 Active Directory =<br />
<br />
Active Directory is a powerful administration service which enables an Administrator to centrally manage a network of Windows 2000, Windows XP Pro, Windows 2003, Windows Vista Business Edition, and Windows 7 Professional (and up) effectively. To test the real Samba4 capability, we use Windows XP Pro as testing environment (Windows XP Home doesn't include Active Directory functionality and won't work).<br />
<br />
To allow Samba 4 Active Directory or Microsoft Active Directory to manage a computer, we need to join the computer into the active directory.<br />
It involves:<br />
<br />
# Configuring DNS Settings<br />
# Configuring Date & Time and Time Zone<br />
# Joining the domain<br />
<br />
== Step 1: Configure DNS Setting for Windows ==<br />
<br />
Before we configure the DNS settings, verify that you are able to ping the server's IP address. If you are not able to ping the server, double check your IP address, firewall, routing, etc.<br />
<br />
Once you have verified network connectivity between the Samba server and client,<br />
<br />
# Right Click My Network Places, Select Properties<br />
# Right Click Local Area Network, Select Properties<br />
# Double click TCP/IP<br />
# Use a static DNS server, add the Samba4 server's IP address inside the primary DNS server column.<br />
#:[[Image:Samba4dnsclient.jpg]]<br />
# Press OK on all opened windows.<br />
# Open a command prompt, type 'ping samdom.example.com' (as per your provision).<br />
<br />
If you get replies, then it means that your Windows settings are correct for DNS, and the Samba4 server's DNS service is working as well.<br />
<br />
== Step 2: Configure Date & Time and Time Zone ==<br />
<br />
Active Directory uses Kerberos as the backend for authentication. Kerberos requires that the system clocks on the client and server be synchronized to within a few seconds of each other. If they are not synchronized, then authentication will fail for apparently no reason.<br />
<br />
=== Configure the Date & Time ===<br />
# Right-Click on the Time display in the system notification area, Select Adjust Date/Time.<br />
# Change the Date and Time so the client matches the server to the minute, and click OK<br />
#:[[Image:Samba4time.jpg]]<br />
<br />
=== Configure the Time Zone ===<br />
# Right-Click on the Time display in the system notification area, Select Adjust Date/Time.<br />
# Click on the Time Zone Tab<br />
# Change the Time Zone to match the Time Zone on the server.<br />
#:[[Image:Samba4timezone.jpg]]<br />
<br />
== Step 3: Joining Windows Clients to the Domain ==<br />
<br />
Now your Windows computer is ready to join the Active Directory (AD) domain,<br />
<br />
As an Administrator:<br />
<br />
# Right Click My Computer -> Properties<br />
# Choose the Computer Name tab, click Change...<br />
# Click option 'Domain', insert SAMDOM.EXAMPLE.COM. If this fails, try SAMDOM.<br />
#:[[Image:Samba4joindomain.jpg]]<br />
# When it requests a username and password, type '''Administrator''' as the username, and '''p4$$word''' as the password.<br />
# You should get a message box stating "Welcome to the SAMDOM.EXAMPLE.COM domain."<br />
# Click OK on this message box and the Properties window, and you will be instructed to restart your computer.<br />
# After restarting, you should be presented with the normal logon dialog.<br />
# Change the domain to SAMDOM and type '''Administrator''' as the username, and '''p4$$word''' as the password.<br />
#:[[Image:Samba4logindomain.jpg]]<br />
<br />
= Viewing Samba 4 Active Directory object from Windows =<br />
<br />
We need install Windows 2003 Adminpak into Windows XP in order to use<br />
GUI tools to manage the domain. Before you begin, make sure that the domain<br />
administrators have administrative rights to control your computer.(To<br />
give any user administrative rights in Windows XP Pro, right click My<br />
Computer, select Manage-> choose Groups-> double click Administrators<br />
and add members from domain into the member list. When you add<br />
members from Active Directory, it will prompt you to enter an<br />
Active Directory username and password).<br />
<br />
== Step 1: Installing Windows Remote Administration Tools onto Windows ==<br />
<br />
=== Windows 7/Vista ===<br />
<br />
#Download the Windows Remote Administration Tools from:<br />
#* http://www.microsoft.com/downloads/details.aspx?FamilyId=9FF6E897-23CE-4A36-B7FC-D52065DE9960&displaylang=en (Vista)<br />
#* http://www.microsoft.com/downloads/details.aspx?FamilyID=7D2F6AD7-656B-4313-A005-4E344E43997D&displaylang=en (Windows 7)<br />
#Follow the "Install RSAT" instructions<br />
<br />
=== Windows XP Pro ===<br />
<br />
==== Administration Tools Pack & Support Tools ====<br />
# Download adminpak and supporttools from:<br />
#* http://www.microsoft.com/downloads/en/details.aspx?FamilyID=86b71a4f-4122-44af-be79-3f101e533d95<br />
#* http://download.microsoft.com/download/3/e/4/3e438f5e-24ef-4637-abd1-981341d349c7/WindowsServer2003-KB892777-SupportTools-x86-ENU.exe<br />
#:If you installed an older version of the adminpak, you'll notice the dial-in tab is missing from property pages. Just follow the link above to get SP2 which does not have this issue.<br />
# Run through the installation.<br />
# Press start->run, type 'dsa.msc', if a window 'active directory users and computers' prompt up, it mean you had install adminpak it successfully. You can also find this at Start>Programs>Administrative Tools, which should have a lot more items now.<br />
# Go to c:\Program Files\Support Tools to check whether the support tools were installed correctly; if yes, then your XP workstation is ready to manage the Samba 4 Active Directory.<br />
<br />
==== Group Policy Management Console ====<br />
# You may also find the Group Policy Management Console useful. You can download it from<br />
#* http://www.microsoft.com/downloads/details.aspx?FamilyId=0A6D4C24-8CBD-4B35-9272-DD3CBFC81887&displaylang=en<br />
#:This is primarily useful when you have larger installs and are managing many machines. You may need to download the .NET Framework first.<br />
<br />
== Step 2: Viewing Samba4 Active Directory Content ==<br />
<br />
# When logged on as a Domain Administrator, start the Active Directory Users and Computers Snap-In, either by clicking Start -> Programs\Administrative Tools\Active Directory Users and Computers, or by clicking Start -> Run 'dsa.msc'<br />
# Expand the samdom.example.com tree to see existing objects in the domain.<br />
#:[[Image:Samba4dsa.msc.jpg]]<br />
<br />
= Managing Samba 4 Active Directory From a Windows Client =<br />
One of Samba4's goals is to integrate with (and replace) Active Directory as a system. At this point, if everything has worked correctly you should have an "Administrative Tools" menu under Programs. If, under Administrative Tools you have "Active Directory Users and Computers", that is a very good sign. Most times, if there is a configuration or bug in Samba4, the AD Users & Computers (among other interfaces) won't show up as an option. You can run it by hand (Start->Run->dsa.msc) but it's unlikely to work correctly.<br />
<br />
<br />
== Step 1: Adding Users into Samba 4 Active Directory ==<br />
Unlike Samba3, Samba4 does not require a local Unix user for each Samba user that is created.<br />
<br />
To create a Samba user, use the following command:<br />
<br />
/usr/local/samba/bin/samba-tool user add USERNAME<br />
<br />
To inspect the allocated user ID and SID, use the following command:<br />
<br />
$ /usr/local/samba/bin/wbinfo --name-to-sid USERNAME<br />
S-1-5-21-4036476082-4153129556-3089177936-1005 SID_USER (1)<br />
<br />
$ /usr/local/samba/bin/wbinfo --sid-to-uid S-1-5-21-4036476082-4153129556-3089177936-1005<br />
3000011<br />
<br />
If you want to change this mapping, then use <tt>ldbedit<tt> on the <tt>/usr/local/samba/private/idmap.ldb</tt>, as shown:<br />
<br />
$ ldbedit -e emacs -H /usr/local/samba/private/idmap.ldb objectsid=S-1-5-21-4036476082-4153129556-3089177936-1005<br />
<br />
*Note: You can replace <tt>emacs</tt> with your editor of choice.<br />
<br />
You will find records that look like this:<br />
<br />
# record 1<br />
dn: CN=S-1-5-21-4036476082-4153129556-3089177936-1005<br />
cn: S-1-5-21-4036476082-4153129556-3089177936-1005<br />
objectClass: sidMap<br />
objectSid: S-1-5-21-4036476082-4153129556-3089177936-1005<br />
type: ID_TYPE_BOTH<br />
xidNumber: 3000011<br />
distinguishedName: CN=S-1-5-21-4036476082-4153129556-3089177936-1005<br />
<br />
If you change the <tt>xidNumber</tt> attribute and save your editor then exit,<br />
then Samba will update the mapping to between the SID and the user<br />
ID. Updating group mappings works in the same way.<br />
<br />
*Note: You can also manage users using the normal Windows AD user management tools.<br />
<br />
= Setting Up Roaming Profiles =<br />
<br />
1. You will need to create a share for the profiles, typically named <tt>profiles</tt>. Edit the <tt>/usr/local/samba/etc/smb.conf</tt> to include:<br />
<br />
[profiles]<br />
path = /usr/local/samba/var/profiles<br />
read only = no<br />
<br />
2. Create the directory above using:<br />
<br />
$ sudo mkdir /usr/local/samba/var/profiles<br />
<br />
3. In Windows, start ''Active Directory Users and Computers'', select all the users, right click, and hit properties<br />
<br />
4. Under the profile tab, in the ''Profile path'', type the path to your share along with %USERNAME% as follows:<br />
<br />
\\sambaserver.samdom.example.com\profiles\%USERNAME%<br />
<br />
5. click OK, logout and login as one of those users. When you logout again, you should see that the profile has been synced onto the samba server.<br />
<br />
*Note: An excellent walk-through on configuring Roaming Profiles and Folder Redirection is available [http://www.grouppolicy.biz/2010/08/best-practice-roaming-profiles-and-folder-redirection-a-k-a-user-virtualization/ here.]<br />
<br />
= Adding Organization Units (OU) Into a Samba4 Domain = <br />
<br />
The Organizational Unit (OU) is a powerful feature in Active<br />
Directory. This is a type of container which allows you to drag & drop<br />
users and/or computers into it.<br />
<br />
We can link several types of group policies to an OU, and the settings<br />
will push out to all users/computers that sit under the OU. Withing a single domain,<br />
you can have as many OUs and sub-OUs as you'd like. The result is that<br />
it can greatly reduce administrative overhead since you are able to<br />
manage everything via an OU. The implementation of Group Policy will<br />
be discussed in the next chapter.<br />
<br />
Before we create an OU, we must know what one looks like. By default<br />
we can see a sample OU called 'Domain Controllers', which uses a different<br />
icon in the Windows management tools than the 'users' and 'computers'<br />
containers. We can deploy Group Policy to the users or the computers container.<br />
<br />
# To create an OU as the Domain Administrator, click Start -> Run -> dsa.msc<br />
# Right click your domain.<br />
# Select New -> Organizational Unit<br />
# Type 'OU Demo'<br />
# You will see a new OU appear, with the name 'OU Demo'.<br />
# You can drag the user 'demo' into the new OU (Don't move other users! Unless you want to get stuck!).<br />
# Right click 'OU Demo', A sub-OU can be created with New -> Organizational Unit.<br />
<br />
Normally OUs are created according to the department setup of your<br />
organization. Be careful not to confuse Groups and OUs. Groups are<br />
used to control permissions, OUs are used for deploying settings to<br />
all users/computers within the OU.<br />
<br />
= Implementing Group Policies (GPO) in A Samba4 Domain =<br />
<br />
Samba4 Active Directory has support for group policies, and can create<br />
the group policy on the fly. The basic idea of group policies is:-<br />
<br />
# Group Policies have two kinds of settings: computers and users.<br />
# Computer settings apply to computers, while user settings apply to users.<br />
# We link the group policy to a particular OU, and the group policy will effect all computers/users under the OU.<br />
# To add a group policy, right click 'OU Demo' OU->properties.<br />
# Choose group policy.<br />
# Press new, and name it as 'GP Demo'.<br />
# Press edit to modify the policy.<br />
# Here will demonstrate how to block users from access to the control panel. Open the tree 'User Configuration'->'Administrative Templates'->'Control Panel'.<br />
# Double click on 'Prohibit access to the Control Panel'.<br />
# Press enabled and then press OK. Now the all users under 'OU Demo' won't able to access to the control panel.<br />
# Make sure that the user 'demo' is inside the 'OU Demo' (You can drag and drop it). <br />
# Logout and login as user 'demo'.<br />
# You'll find user demo is not able to access control panel.<br />
<br />
== Notes ==<br />
:User configuration will take effect once you logout and login.<br />
:Computer configuration will take effect when you restart the computer.<br />
:GPO Password Policies are not read by Samba when assigning passwords, to change the policy that Samba uses you must use '''samba-tool domain passwordsettings'''<br />
<br />
To learn more about managing and implementing organizational units, group policies, and Active Directory, try a web search for Google in Windows 2003 Active Directory implementation.<br />
<br />
= Joining a Windows Domain Controller as an Additional DC in a Domain =<br />
<br />
Once you have a Samba domain controller set up, you can choose to join<br />
additional domain controllers to the domain, whether they be<br />
additional Samba domain controllers, or additional Windows domain<br />
controllers.<br />
<br />
If you wish to join an additional Samba domain controller to a domain,<br />
then please see the [[Samba4/HOWTO/Join a domain as a DC|Joining a domain as a DC]] page. The instructions<br />
on that page are the same for joining Samba to a Windows domain as<br />
they are for joining Samba to an existing Samba domain.<br />
<br />
If you wish to join a new Windows domain controller to a Samba domain,<br />
then you should use the 'dcpromo' tool on the Windows machine. Please<br />
see the normal instructions for installing dcpromo on Windows, with<br />
the exception that you should not check the 'DNS server' option box<br />
when it is offered. Right now you should either use Windows for DNS,<br />
or use Samba and bind9 for DNS. Mixing the two can work, but it is an<br />
advanced topic that is beyond the scope of this howto.<br />
<br />
= Migrating an Existing Samba3 Domain to Samba4 =<br />
<br />
It is very likely that you already have a running Samba3 domain on your network. The question is, how do you migrate that domain and all of its users and machines over to a new Samba4 based domain without having to move every user profile and machine to the new domain? The answer is the [[Samba4/samba-tool/domain/classicupgrade/HOWTO|samba-tool domain classicupgrade]] function.<br />
<br />
= Connecting other services to your new/migrated Active Directory =<br />
<br />
If you finished setting up or migrating to Samba4, you maybe want to connect other services<br />
to your new Active Directory. Have a look at the [[Samba4/beyond|Beyond Samba]] page.<br />
<br />
= Report Your Success/Failure! =<br />
<br />
Samba4, as a replicating domain controller, is still developing rapidly.<br />
We'd like to hear from users about their successes and<br />
failures. While Samba4 is still in alpha release, we would encourage<br />
you to report both your successes and failures to the samba-technical<br />
mailing list on http://lists.samba.org<br />
<br />
Please be aware that Samba4 is not complete, and therefore, should be deployed carefully until it is ready for a stable release.</div>Intruder0815https://wiki.samba.org/index.php?title=Setting_up_Samba_as_an_Active_Directory_Domain_Controller&diff=7109Setting up Samba as an Active Directory Domain Controller2012-12-09T11:48:44Z<p>Intruder0815: recent version of Debian Squeeze ships with ntpd-4.2.6p2 and has been tested successfully</p>
<hr />
<div>= HOWTO to set up a AD DC =<br />
<br />
This document explains how to setup a simple Samba4<br />
server. This is aimed at people who are already familiar with Samba3<br />
and wish to participate in Samba4 development or test the alpha<br />
releases of Samba4. This is not aimed at general production use of<br />
Samba4, although some brave sites are running Samba4 in production<br />
based on these instructions.<br />
<br />
== Video Demonstrations of This HOWTO ==<br />
<br />
A set of [[samba4/videos|demonstration videos]] is available that<br />
may provide a useful overview of the contents of this HOWTO.<br />
<br />
== A Note on Alpha/Beta/RC Versions ==<br />
<br />
Samba4 is developing very rapidly. This HOWTO is frequently updated to reflect the latest changes in the Samba git repository. Please see the Samba4 [[Samba4/Status|Status]] Wiki for more specifics on project status.<br />
<br />
== Samba 4 OS Requirements ==<br />
<br />
Because of the constantly changing and ever expanding nature of Linux, the '''OS Requirements for Samba4 have been moved''' from Step 2, to [[Samba_4/OS_Requirements]]<br />
This not only includes the required packages for a successful Samba4 deployment, but also the required file system features. Please consider that page as a prerequisite to a successful Samba4 setup.<br />
<br />
== Step 1: Download Samba4 ==<br />
<br />
Currently, there are three methods to download the current Samba4 sources, in order of preference: via git, rsync, or as a tarball from the samba.org website. We strongly recommend using the git method for downloading Samba, as it makes getting updates easier, and also allows you to integrate test patches from Samba developers more easily in case of problems. <br />
<br />
In the following examples we will assume that your top-level source is named <tt>samba-master</tt>. If you downloaded a tarball this will instead be based on the name of the tarball downloaded (e.g. <tt>samba-4.0.0alpha13</tt> for the tarball samba-4.0.0alpha13.tar.gz). Also note that in the <tt>master</tt> branch the<br />
samba4 code in our current git tree is now located in the top level directory.<br />
<br />
=== Downloading via git ===<br />
<br />
Git allows you to download the source tree via either the <tt>git</tt> or <tt>http</tt>protocols. In general, the <tt>git</tt> protocol is the preferred choice since it compresses the data being transferred. To download the source tree via <tt>git</tt>, run the following command:<br />
<br />
$ git clone git://git.samba.org/samba.git samba-master<br />
<br />
Alternatively, if you prefer to use the <tt>http</tt> protocol, run the following command:<br />
<br />
$ git clone http://gitweb.samba.org/samba.git samba-master<br />
<br />
Either command will create a directory called <tt>samba-master</tt> in the current<br />
directory.<br />
<br />
=== Updating via git ===<br />
<br />
If you already have downloaded the source tree via <tt>git</tt> and want to update the tree to the latest version, run the following command in your <tt>samba-master</tt> directory:<br />
<br />
$ git pull<br />
<br />
If you get an error like this:<br />
fatal: Unable to create '[...]/samba_master/.git/index.lock': File exists.<br />
Run the command below to reset your tree.<br />
<br />
If you are having trouble compiling the source, it may be due to stale files. You can reset your <tt>git</tt> tree to correct these errors. To reset your <tt>git</tt> tree, run the following command in your <tt>samba-master</tt> directory:<br />
<br />
$ git clean -x -f -d<br />
<br />
=== Downloading via rsync ===<br />
<br />
If <tt>git</tt> is not available to you, <tt>rsync</tt> is the next best choice. To download the source tree via <tt>rsync</tt>, run the following command:<br />
<br />
$ rsync -avz samba.org::ftp/unpacked/samba_4_0_test/ samba-master<br />
<br />
This command will create a directory called <tt>samba-master</tt> in the current directory, containing a checked out <tt>git</tt> repository. If you plan on using <tt>git</tt> to manage the tree, you will need to run the following commands in your <tt>samba-master</tt> directory:<br />
<br />
$ cd samba-master/<br />
$ rm .git/refs/tags/*<br />
$ rm -r .git/refs/remotes/<br />
$ git config remote.origin.url git://git.samba.org/samba.git<br />
$ git config --add remote.origin.fetch +refs/tags/*:refs/tags/* (this line is optional)<br />
$ git fetch<br />
<br />
Note you can ignore this error from <tt>git fetch</tt>:<br />
error: refs/heads/master does not point to a valid object!<br />
<br />
Refer to the [[#Updating via git|Updating via git]] instructions on how to manage the source tree with <tt>git</tt>.<br />
<br />
=== Downloading a tarball ===<br />
<br />
If both <tt>git</tt> and <tt>rsync</tt> are not available, you can download the latest Samba 4.0 Release Candidate tarball from [http://ftp.samba.org/pub/samba/rc/ the Samba website]<br />
<br />
== Step 2: Compile Samba4 ==<br />
<br />
To build Samba4, run the following command in your <tt>samba-master</tt> directory:<br />
<br />
$ cd samba-master<br />
$ ./configure --enable-debug --enable-selftest<br />
$ make<br />
<br />
The above command will setup Samba4 to install in <tt>/usr/local/samba</tt>. If you want Samba to install in a different directory, then you should use the <tt>--prefix</tt> option to <tt>configure</tt>.<br />
<br />
The reason we recommend using <tt>--enable-debug --enable-selftest</tt> for Samba is that it will include extra debug information that will help us diagnose problems in case of failures, and will also allow you to run our selftest <tt>make test</tt> to validate that Samba can behave correctly on your platform. Both of these are however, entirely '''optional'''.<br />
<br />
'''Profiling with google-perftools'''<br />
<br />
If you want to enable profiling support, change the configure command above to the following:<br />
$ LDFLAGS="-ltcmalloc -lprofiler" ./configure.developer<br />
:''(This also works for CFLAGS)''<br />
<br />
== Step 3: Install Samba4 ==<br />
<br />
To install Samba4, run the following command in your <tt>samba-master</tt> directory:<br />
<br />
$ make install<br />
<br />
Note that this must be run as a user who has permission to write to the install directory, which defaults to <tt>/usr/local/samba</tt>. See [[#Step 2: Compile Samba4|Step 2: Compile Samba4]] for instructions on how to change the install directory.<br />
<br />
For the rest of this HOWTO we will assume that you have installed<br />
Samba4 in the default location. All future Samba commands will stem from the <tt>/usr/local/samba/sbin</tt> and <tt>/usr/local/samba/bin</tt> directories.<br />
<br />
Please review the [[Samba4#Previous_Releases|Release Notes]] for the version you have installed, it may contain important information not yet reflected in this HOWTO.<br />
<br />
=== Upgrading ===<br />
<br />
If you are upgrading from a previous release of Samba4, be sure to review all the [[Samba4#Previous_Releases|Release Notes]] for the new version, as well as the notes for all the interim versions.<br />
<br />
== Step 4: Provision Samba4 ==<br />
<br />
The provision step sets up a basic user database, and is used when you are setting up your Samba4<br />
server in its own domain. If you instead want to setup your Samba4 server as an additional domain controller<br />
in an existing domain, then please see the [[#Joining a Windows Domain Controller as an Additional DC in a Domain|Joining a Windows Domain Controller as an Additional DC in a Domain]] section on this page. If you want to migrate an existing Samba3 domain to Samba4, see the [[#Migrating an Existing Samba3 Domain to Samba4|Migrating an Existing Samba3 Domain to Samba4]] section on this page.<br />
<br />
For the rest of the HOWTO we will assume that your DNS domain name is<br />
<tt>samdom.example.com</tt>, your short (also known as NT4) domain name is<br />
<tt>samdom</tt>, your Samba server's hostname is <tt>samba</tt>, and the IP Address of your Samba server is <tt>192.168.1.2</tt>.<br />
<br />
The provision step must be run as a user with permission to write to the install directory.<br />
<br />
# /usr/local/samba/bin/samba-tool domain provision \<br />
--realm=samdom.example.com --domain=SAMDOM \<br />
--adminpass='p4$$word' --server-role=dc<br />
<br />
If you run the previous command with a user who does not have write permission to the install directory, you will get an error similar to this:<br />
tdb_open_ex: could not open file /usr/local/samba/private/sam.ldb.d/DC=SAMDOM,DC=EXAMPLE,DC=COM. ldb: Permission denied<br />
<br />
There are many other options you can pass to the <tt>samba-tool domain provision</tt> command. You can run it with the <tt>--help</tt> option to see a list of them.<br />
<br />
*Note: As of September 11, 2012 (Samba4.0.0RC1) the provision command now uses Samba4's internal DNS server, if you would like the older behavior, add <tt>--dns-backend=BIND9_DLZ</tt> to the above provision command.<br />
*Note: You may need to remove the <tt>/usr/local/samba/etc/smb.conf</tt> file if you are re-running the provision command.<br />
<br />
== Step 5: Starting Samba4 ==<br />
<br />
If you are planning to run Samba4 as a production server, then just run the <tt>samba</tt> binary as root<br />
<br />
# /usr/local/samba/sbin/samba<br />
<br />
That will run Samba4 in 'standard' mode, which is suitable for<br />
production use. Samba4 doesn't yet have init scripts included<br />
for each platform, but making one for your platform should not be<br />
difficult. There are some example scripts (for RedHat/Fedora, Debian and Ubuntu) on the [[Samba4/InitScript]] page.<br />
<br />
If you are running Samba4 as a developer you may find<br />
the following more useful:<br />
<br />
# /usr/local/samba/sbin/samba -i -M single<br />
<br />
This will start <tt>samba</tt> with all log messages printed to stdout, and restricting it to a<br />
single process. That mode of operation makes debugging <tt>samba</tt> with <tt>gdb</tt><br />
easier. If you want to launch it under <tt>gdb</tt>, run <tt>samba</tt> as follows:<br />
<br />
# gdb --args /usr/local/samba/sbin/samba -i -M single<br />
<br />
Note that if you are running any Samba3 <tt>smbd</tt> or <tt>nmbd</tt> processes<br />
they need to be stopped before starting <tt>samba</tt> from Samba4.<br />
<br />
Take care when running Samba4 commands if you also have a previous version of Samba installed. To avoid inadvertently running the wrong version, you should consider putting the <tt>/usr/local/samba/bin</tt> and <tt>/usr/local/samba/sbin</tt> directories in the beginning of your <tt>PATH</tt> variable.<br />
<br />
You can see what version of Samba, if any, is in your <tt>PATH</tt> variable by running the following:<br />
# samba -V<br />
<br />
*Note: In older developer versions of Samba4 <tt>samba</tt> was still called <tt>smbd</tt>.<br />
<br />
== Step 6: Testing Samba4 ==<br />
<br />
First check you have the right version of <tt>smbclient</tt> by running the following command:<br />
<br />
$ /usr/local/samba/bin/smbclient --version<br />
<br />
This should show you a version starting with "Version 4.0.XXXXX". <br />
<br />
Now run this command to list the shares on your Samba4 server:<br />
<br />
$ /usr/local/samba/bin/smbclient -L localhost -U%<br />
<br />
The output of the command should be similar to what is shown below:<br />
<br />
Sharename Type Comment<br />
--------- ---- -------<br />
netlogon Disk<br />
sysvol Disk<br />
IPC$ IPC IPC Service (Samba 4.0.0alpha12-GIT-5e755e9)<br />
ADMIN$ Disk DISK Service (Samba 4.0.0alpha12-GIT-5e755e9)<br />
<br />
The <tt>netlogon</tt> and <tt>sysvol</tt> shares are basic shares needed for Active Directory server<br />
operation. <br />
<br />
If the command failed, restart samba by running the following:<br />
<br />
# killall samba<br />
# rm -v -- /usr/local/samba/var/run/smbd-fileserver.conf.pid<br />
# /usr/local/samba/sbin/samba<br />
<br />
To test that authentication is working, you should try to connect to the <tt>netlogon</tt> share<br />
using the Administrator password you set earlier:<br />
<br />
$ smbclient //localhost/netlogon -UAdministrator%'p4$$word' -c 'ls'<br />
<br />
The output of the command should be similar to what is shown below:<br />
<br />
Domain=[SAMDOM] OS=[Unix] Server=[Samba 4.0.0beta9-GIT-e4677e3]<br />
. D 0 Wed Sep 12 21:00:36 2012<br />
.. D 0 Wed Sep 12 21:02:28 2012<br />
<br />
== Step 7: Configure DNS ==<br />
<br />
A working DNS setup is essential to the correct operation of<br />
Samba4. Without the right DNS entries, Kerberos won't work, which in<br />
turn means that many of the basic features of Samba4 won't work.<br />
<br />
It is worth spending some extra time to ensure your DNS setup is correct, as debugging problems caused by mis-configured DNS can take a<br />
lot of time later on.<br />
<br />
=== DNS Server ===<br />
==== Samba's Internal DNS Server ====<br />
<br />
If you specified <tt>--dns-backend=SAMBA_INTERNAL</TT> or did not specify any backend at all when you provisioned, there is no further setup required for the DNS server. However, you still need to configure your <tt>/etc/resolv.conf</tt> as shown in [[#Configure /etc/resolv.conf|Configure /etc/resolv.conf]]<br />
<br />
If you want the internal DNS server to forward requests it isn't responsible for, then add the following to your smb.conf:<br />
dns forwarder = {IP-Address of the DNS you want to forward to}<br />
<br />
==== Bind 9.8.0 or newer ====<br />
<br />
If using BIND, the next step to get a working DNS setup for Samba4 is to start<br />
with the DNS configuration file that is created by the<br />
[[#Step 4: Provision Samba4|provision step]] or if you are using any of the other samba-tool options (classicupgrade for example) you can specify --dns-backend=BIND9_DLZ or --dns-backend=BIND9_FLATFILE.<br />
<br />
You can<br />
activate the configuration that the provision has created by including this configuration file in bind's named configuration file. This file is typically located in the <tt>/etc/bind</tt> directory, please refer to your distribution documentation for the location of this file on your system. Once located, add the following line to the configuration file:<br />
<br />
include "/usr/local/samba/private/named.conf";<br />
<br />
Edit that file to uncomment the correct dlz plugin line, based on your version of bind. Open the <tt>/usr/local/samba/private/named.conf</tt> file in a text editor and follow the instructions inside.<br />
<br />
After adding that line you should restart your Bind server and check<br />
in the system logs for any problems. If available, you can run <tt>named-checkconf</tt> to help you fix any problems with your named configuration.<br />
<br />
==== Bind 9.7.x ====<br />
<br />
Users of bind-9.7.x are strongly encouraged to upgrade to bind-9.8 or bind-9.9. If this is not possible, refer to the section [[#Step 9: Configure Kerberos DNS Dynamic Updates|Configure Kerberos DNS Dynamic Updates]] for instructions on configuring bind-9.7.<br />
<br />
==== Bind (All Versions) ====<br />
<br />
A common problem you may encounter is that many modern Linux distributions activate<br />
'Apparmor' or 'SELinux' by default, and these may be configured to<br />
deny access to Bind for your the <tt>named.conf</tt> and zone files created in<br />
the provision. If your Bind logs show that Bind is getting a access<br />
denied error accessing these files, please see your local system<br />
documentation for how to enable access to these files in Bind (hint:<br />
for Apparmor systems such as Ubuntu, the command <tt>aa-logprof</tt> may be<br />
useful).<br />
<br />
*Note: On Debian systems, the zone auto-generation might detect and use <tt>127.0.1.1</tt> as the domain controller's IP address. This will cause problems when trying to connect to the server from client machines. To fix this, you will need to adjust <tt>/usr/local/samba/private/named.conf</tt> by changing <tt>127.0.1.1</tt> to reflect the actual IP address of the server you're setting up.<br />
*Note: On Debian SID (bind9 package), <tt>/etc/bind/named.conf.options</tt> is missing and this will cause the <tt>named</tt> daemon to fail to start. To fix this either create an empty file, or comment out corresponding line in <tt>/etc/bind/named.conf</tt>. See your syslog messages for more information.<br />
<br />
=== Configure /etc/resolv.conf ===<br />
<br />
For all the local DNS lookups to resolve correctly, we need to modify the server's <tt>/etc/resolv.conf</tt> file. The following example should be sufficient to have DNS resolve properly:<br />
<br />
domain samdom.example.com<br />
nameserver 192.168.1.2<br />
<br />
*Note: Remember to change the IP Address to your Samba server's IP Address<br />
*Note: If your server is set up to receive its IP configuration via DHCP, the <tt>/etc/resolv.conf</tt> file might be automatically updated. Refer to your distribution's documentation on how to stop this behavior.<br />
<br />
=== Testing DNS ===<br />
<br />
To test that DNS is working properly, run the following commands and compare the output to what is shown:<br />
<br />
$ host -t SRV _ldap._tcp.samdom.example.com.<br />
_ldap._tcp.samdom.example.com has SRV record 0 100 389 samba.samdom.example.com.<br />
<br />
$ host -t SRV _kerberos._udp.samdom.example.com.<br />
_kerberos._udp.samdom.example.com has SRV record 0 100 88 samba.samdom.example.com.<br />
<br />
$ host -t A samba.samdom.example.com.<br />
samba.samdom.example.com has address 10.0.0.1<br />
<br />
The answers you get should be similar to the ones above (adjusted for your DNS domain name and hostname). If you get any errors, <br />
carefully check your system logs to locate the problem.<br />
<br />
== Step 8: Configure Kerberos ==<br />
<br />
Kerberos configuration is handled by the <tt>krb.conf</tt> file. This file is typically located in the <tt>/etc</tt> directory, please refer to your distribution documentation for the location of this file on your system. Replace the existing file, if any, with the sample from <tt>/usr/local/samba/share/setup/krb5.conf</tt>. Edit the file and replace <tt>${REALM}</tt> with the value you chose for the <tt>--realm</tt> parameter of the provision command above, make sure to enter the realm in '''uppercase letters''':<br />
<br />
[libdefaults]<br />
default_realm = SAMDOM.EXAMPLE.COM<br />
dns_lookup_realm = false<br />
dns_lookup_kdc = true<br />
<br />
=== Testing Kerberos ===<br />
<br />
The simplest test is to use the <tt>kinit</tt> command as follows:<br />
<br />
$ kinit administrator@SAMDOM.EXAMPLE.COM<br />
Password:<br />
<br />
*Note: You must specify your domain realm <tt>SAMDOM.EXAMPLE.COM</tt> in '''uppercase letters'''<br />
<br />
<tt>kinit</tt> will not give you any output. To verify that Kerberos is working, and that you received a ticket, run the following:<br />
<br />
$ klist<br />
Ticket cache: FILE:/tmp/krb5cc_1000<br />
Default principal: administrator@SAMDOM.EXAMPLE.COM<br />
<br />
Valid starting Expires Service principal<br />
02/10/10 19:39:48 02/11/10 19:39:46 krbtgt/SAMDOM.EXAMPLE.COM@SAMDOM.EXAMPLE.COM<br />
<br />
If either <tt>kinit</tt> or <tt>klist</tt> do not exist on your system, refer to [[Samba_4_OS_Requirements]] on how to install the necessary packages.<br />
<br />
You can also test Kerberos form a remote client, but you must first configure the client's <tt>krb5.conf</tt> and <tt>resolve.conf</tt> as shown previously.<br />
<br />
*Note: If you are using a client behind NAT then you have to add the following to the <tt>krb5.conf</tt> on the domain controller server:<br />
<br />
[kdc]<br />
check-ticket-addresses = false<br />
<br />
== Step 9: Configure DNS Dynamic Updates via Kerberos ==<br />
<br />
Samba4 has the capability to automatically update the bind zone files via Kerberos. While this step is optional, it is highly recommended. If you are using Samba's internal DNS server, no configuration is needed, and you can skip this step.<br />
<br />
To setup dynamic DNS updates you need to have a recent version of bind installed. It is highly recommended that you install at least version 9.8.0 as that version includes a set of patches from the Samba Team to make dynamic DNS updates much more robust and easier to configure. In the instructions below we give instructions for both bind 9.7.2 and 9.8.0, but please use 9.8.0 or later if at all possible.<br />
<br />
You can tell what version of bind you have using the command <tt>/usr/sbin/named -V</tt>. If your OS does not have bind-9.8.0 or later, then please consider getting it from a package provided by a 3rd party (for example, on Ubuntu there is a ppa available with the newer versions of bind).<br />
<br />
=== Bind 9.8.0 or Later ===<br />
<br />
When using bind-9.8.0 or later you need to add the following to the options section of your bind config:<br />
options {<br />
[...]<br />
tkey-gssapi-keytab "/usr/local/samba/private/dns.keytab";<br />
[...]<br />
};<br />
<br />
This file is typically located in the <tt>/etc/bind</tt> directory, please refer to your distribution documentation for the location of this file on your system.<br />
<br />
=== Bind 9.7.x ===<br />
<br />
If you have bind-9.7.x (specifically 9.7.2 or later), then first determine if you can <br />
at all possibly run bind-9.8. You will have far fewer problems. Otherwise, follow these instructions.<br />
<br />
The Samba provision will have created a custom <tt>/usr/local/samba/private/named.conf.update</tt> configuration file. You need to include this file in your master <tt>named.conf</tt> to allow Samba/Kerberos DNS updates to automatically take place. Be advised that if you include this file in Bind versions that don't support it, Bind will fail to start.<br />
<br />
You additionally need to set two environment variables when using bind-9.7.x:<br />
<br />
KEYTAB_FILE="/usr/local/samba/private/dns.keytab"<br />
KRB5_KTNAME="/usr/local/samba/private/dns.keytab"<br />
export KEYTAB_FILE<br />
export KRB5_KTNAME<br />
<br />
These should be put in your settings file for bind. On Debian based<br />
systems (including Ubuntu) this is in <tt>/etc/default/bind9</tt>. On RedHat and SUSE derived systems it is<br />
in <tt>/etc/sysconfig/named</tt>, please refer to your distribution documentation for the correct location to set these environment variables. Strictly speaking you only either need<br />
<tt>KEYTAB_FILE</tt> or <tt>KRB5_KTNAME</tt>, but which you need depends on your distribution,<br />
so it's easier to just set both.<br />
<br />
The <tt>dns.keytab</tt> must be readable by the bind server process. Generally, this is accomplished by executing:<br />
$ chown named:named /usr/local/samba/private/dns.keytab<br />
<br />
(the provision should have setup these permissions for you automatically).<br />
<br />
Finally, you need to add the following to the options section of your bind config:<br />
options {<br />
[...]<br />
tkey-gssapi-credential "DNS/server.samdom.example.com";<br />
tkey-domain "SAMDOM.EXAMPLE.COM";<br />
[...]<br />
};<br />
<br />
The last part of the credential in the first line must match the dns name of the server you have set up. This file is typically located in the <tt>/etc/bind</tt> directory, please refer to your distribution documentation for the location of this file on your system.<br />
<br />
=== Testing/Debugging Dynamic DNS Updates ===<br />
<br />
The way the automatic DNS update in Samba works is that the provision<br />
will create a file <tt>/usr/local/samba/private/dns_update_list</tt>, which<br />
contains a list of DNS entries that Samba will try to dynamically<br />
update at startup and every 10 minutes thereafter using <tt>samba_dnsupdate</tt> utility.<br />
Updates will only happen if the DNS entries do not already exist.<br />
Remember that you need <tt>nsupdate</tt> utility from bind the distribution<br />
for all these to work.<br />
<br />
If you want to test or debug this process, then please run this as root:<br />
<br />
/usr/local/samba/sbin/samba_dnsupdate --verbose --all-names<br />
<br />
The command line options specified will force an update of all records in the <tt>dns_update_list</tt>, as well as output detailed information on what is being done.<br />
<br />
=== Interaction With Apparmor or SELinux ===<br />
<br />
If you are using Apparmor or SELinux, you have to ensure that the bind process has read access to the <tt>/usr/local/samba/private/dns.keytab</tt> file, the<br />
<tt>/usr/local/samba/private/named.conf</tt> file as well as read-write access to the <tt>/usr/local/samba/private/dns</tt> directory and it's own zone file. The Samba provision tries to setup the permissions<br />
correctly for these files, but you may find you need to make changes<br />
in your Apparmor or SELinux configuration if you are running either of<br />
those. If you are using Apparmor then the <tt>aa-logprof</tt> command may help<br />
you add any missing permissions you need to add after you start Samba<br />
and bind for the first time after configuring them.<br />
<br />
Please refer to [[#Step 11: Permissions, SELinux Labeling and Policy|Step 11: Permissions, SELinux Labeling and Policy]] for more information.<br />
<br />
== Step 10: Configure NTP (Optional) ==<br />
<br />
You require a recent ntpd version (=>4.2.6) that supports signed ntp. E. g. the version sipped with RHEL6 and Ubuntu < 11.04 are to old.<br />
<br />
1. Download ntpd from ntp.org (verify md5 sum) and compile it (add additionals ./configure parameters, if needed):<br />
<br />
$ tar -zxvf ntp-4.x.x.tar.gz<br />
$ cd ntp-4.x.x<br />
$ ./configure --enable-ntp-signd<br />
$ make<br />
$ make install<br />
<br />
2a. If you already have a supported ntpd version and ntp.conf, you have to add/adjust only the following lines for minimal:<br />
ntpsigndsocket /usr/local/samba/var/run/ntp_signd/<br />
restrict default mssntp<br />
<br />
2b. If a minimal/simple ntp.conf is fine for you, then fill the file with the following:<br />
server 127.127.1.0<br />
fudge 127.127.1.0 stratum 12<br />
ntpsigndsocket /usr/local/samba/var/run/ntp_signd/<br />
restrict default mssntp<br />
<br />
2c. A more complex ntp.conf is the following:<br />
server 127.127.1.0<br />
fudge 127.127.1.0 stratum 10<br />
server 0.pool.ntp.org iburst prefer<br />
server 1.pool.ntp.org iburst prefer<br />
driftfile /var/lib/ntp/ntp.drift<br />
logfile /var/log/ntp<br />
ntpsigndsocket /usr/local/samba/var/lib/ntp_signd/<br />
restrict default kod nomodify notrap nopeer mssntp<br />
restrict 127.0.0.1<br />
restrict 0.pool.ntp.org mask 255.255.255.255 nomodify notrap nopeer noquery<br />
restrict 1.pool.ntp.org mask 255.255.255.255 nomodify notrap nopeer noquery<br />
For explanation: This config allows clients to receive time from this NTP host, localhost<br />
doesn't have any restrictions, and the servers we receive the time from ,are not allowed<br />
to do anything else than providing the time to us. For mor information about ntpd<br />
access controll, see<br />
http://support.ntp.org/bin/view/Support/AccessRestrictions<br />
<br />
3. On members of the domain you don't have to configure anything. Per default they will receive<br />
the time from the DC that has the FSMO role PDC.<br />
<br />
== Step 11: Permissions, SELinux Labeling and Policy ==<br />
<br />
These instructions are intended for RedHat 6.X, but may serve as a guide for other distributions/versions.<br />
<br />
There is still more work to be done in regards of creating a Samba4 specific SELinux policy but for now you should be<br />
able to have everything working '''without''' disabling SELinux.<br />
<br />
For all the commands below, make sure you have set the following environment variable:<br />
MYREALM="samdom.example.com"<br />
<br />
=== Bind ===<br />
<br />
Set Permissions:<br />
chown named:named /usr/local/samba/private/dns<br />
chgrp named /usr/local/samba/private/dns.keytab<br />
chmod g+r /usr/local/samba/private/dns.keytab<br />
chmod 775 /usr/local/samba/private/dns<br />
<br />
Label files:<br />
chcon -t named_conf_t /usr/local/samba/private/dns.keytab<br />
chcon -t named_conf_t /usr/local/samba/private/named.conf.update<br />
chcon -t named_var_run_t /usr/local/samba/private/dns<br />
chcon -t named_var_run_t /usr/local/samba/private/dns/${MYREALM}.zone<br />
<br />
Set Label Persistence:<br />
semanage fcontext -a -t named_conf_t /usr/local/samba/private/dns.keytab<br />
semanage fcontext -a -t named_conf_t /usr/local/samba/private/named.conf<br />
semanage fcontext -a -t named_conf_t /usr/local/samba/private/named.conf.update<br />
semanage fcontext -a -t named_var_run_t /usr/local/samba/private/dns<br />
semanage fcontext -a -t named_var_run_t /usr/local/samba/private/dns/${MYREALM}.zone<br />
semanage fcontext -a -t named_var_run_t /usr/local/samba/private/dns/${MYREALM}.zone.jnl<br />
semanage fcontext -a -t ntpd_t /usr/local/samba/var/run/ntp_signd<br />
<br />
=== NTP ===<br />
<br />
Multiple attempts to set the context for ntp failed so the below policy was needed for windows clients time sync after joining the DOMAIN.<br />
$ chcon -u system_u -t ntpd_t /usr/local/samba/var/run/ntp_signd<br />
$ chcon -u system_u -t ntpd_t /usr/local/samba/var/run/<br />
$ chcon -t ntpd_t /usr/local/samba/var/run/ntp_signd/socket<br />
<br />
<tt>samba4.te</tt> policy:<br />
module samba4 1.0;<br />
<br />
<br />
require {<br />
type ntpd_t;<br />
type usr_t;<br />
type initrc_t;<br />
class sock_file write;<br />
class unix_stream_socket connectto;<br />
}<br />
<br />
#============= ntpd_t ==============<br />
allow ntpd_t usr_t:sock_file write;<br />
<br />
#============= ntpd_t ==============<br />
allow ntpd_t initrc_t:unix_stream_socket connectto;<br />
<br />
Check and load policy:<br />
$ checkmodule -M -m -o samba4.mod samba4.te <br />
$ semodule_package -o samba4.pp -m samba4.mod<br />
$ semodule -i samba4.pp<br />
<br />
== Step 12: Setup a File Share ==<br />
<br />
The provisioning will create a very simple <tt>/usr/local/samba/etc/smb.conf</tt> file with no non-system shares by<br />
default. For the server to be useful you, will need to update it to<br />
have at least one share. For example:<br />
<br />
[test]<br />
path = /data/test<br />
comment = Test Share<br />
read only = no<br />
<br />
*Note: In older alpha versions of Samba4 you need to restart Samba to make new shares visible.<br />
<br />
== Step 13: Setup a Printer share ==<br />
<br />
You can share any printers already configured with CUPS, keep in mind that Samba4 communicates with CUPS via sockets, so you don't need to set any configure any special permissions beyond a listen directive for the CUPS socket.<br />
<br />
=== Basic Print Sharing ===<br />
<br />
# Create a print spool directory, and set the permissions properly. This is where Samba will store temporary files related to print documents:<br />
mkdir /usr/local/samba/var/spool<br />
chmod 1777 /usr/local/samba/var/spool<br />
<br />
# Configure samba to use it, by adding the following to <tt>/usr/local/samba/etc/smb.conf</tt>:<br />
<br />
[printers]<br />
comment = All Printers<br />
path = /usr/local/samba/var/spool<br />
browseable = Yes<br />
read only = No<br />
printable = Yes<br />
<br />
=== Point and Print Drivers ===<br />
<br />
For the sake of convenience, Windows clients can query the server that is sharing a printer for a print driver. To enable this functionality in Samba, we have to create a special <tt>print$</tt> file share.<br />
<br />
# Create the print file share directory, and architecture sub-directories:<br />
<br />
mkdir -p /usr/local/samba/var/print/{COLOR,IA64,W32ALPHA,W32MIPS,W32PPC,W32X86,WIN40,x64}<br />
<br />
# Configure samba to use it, by adding the following to <tt>/usr/local/samba/etc/smb.conf</tt>:<br />
<br />
[print$]<br />
comment = Point and Print Printer Drivers<br />
path = /usr/local/samba/var/print<br />
read only = No<br />
<br />
# Log in as a Domain Administrator on a client computer<br />
# Click Start -> Run '\\samba\'<br />
# In the list of shares, Double-Click 'Printers and Faxes'<br />
# Click File -> Server Properties<br />
# On the Drivers Tab, Click 'Add...', then 'Next'<br />
#:[[Image:SambaServerDrivers.jpg]]<br />
# In the following prompts, choose the driver you would like to install, and click 'Next'<br />
#:[[Image:SambaServerChooseDriver.jpg]]<br />
# Choose the architectures you are installing the drivers for. Be aware if you choose an architecture that the client computer does not have the driver for you will be prompted to provide a disk with the drivers.<br />
#:[[Image:SambaServerChooseArch.jpg]]<br />
# Close the Server Driver Dialog box<br />
# Right-click on the printer the driver is for and choose Properties<br />
# On the Advanced tab, change the Driver drop-down box to the driver you just installed<br />
<br />
== Note: Filesystem Support ==<br />
<br />
This information has been included in the [[Samba_4_OS_Requirements#File_System_Support]]<br />
<br />
= Configure a Windows Client to join a Samba 4 Active Directory =<br />
<br />
Active Directory is a powerful administration service which enables an Administrator to centrally manage a network of Windows 2000, Windows XP Pro, Windows 2003, Windows Vista Business Edition, and Windows 7 Professional (and up) effectively. To test the real Samba4 capability, we use Windows XP Pro as testing environment (Windows XP Home doesn't include Active Directory functionality and won't work).<br />
<br />
To allow Samba 4 Active Directory or Microsoft Active Directory to manage a computer, we need to join the computer into the active directory.<br />
It involves:<br />
<br />
# Configuring DNS Settings<br />
# Configuring Date & Time and Time Zone<br />
# Joining the domain<br />
<br />
== Step 1: Configure DNS Setting for Windows ==<br />
<br />
Before we configure the DNS settings, verify that you are able to ping the server's IP address. If you are not able to ping the server, double check your IP address, firewall, routing, etc.<br />
<br />
Once you have verified network connectivity between the Samba server and client,<br />
<br />
# Right Click My Network Places, Select Properties<br />
# Right Click Local Area Network, Select Properties<br />
# Double click TCP/IP<br />
# Use a static DNS server, add the Samba4 server's IP address inside the primary DNS server column.<br />
#:[[Image:Samba4dnsclient.jpg]]<br />
# Press OK on all opened windows.<br />
# Open a command prompt, type 'ping samdom.example.com' (as per your provision).<br />
<br />
If you get replies, then it means that your Windows settings are correct for DNS, and the Samba4 server's DNS service is working as well.<br />
<br />
== Step 2: Configure Date & Time and Time Zone ==<br />
<br />
Active Directory uses Kerberos as the backend for authentication. Kerberos requires that the system clocks on the client and server be synchronized to within a few seconds of each other. If they are not synchronized, then authentication will fail for apparently no reason.<br />
<br />
=== Configure the Date & Time ===<br />
# Right-Click on the Time display in the system notification area, Select Adjust Date/Time.<br />
# Change the Date and Time so the client matches the server to the minute, and click OK<br />
#:[[Image:Samba4time.jpg]]<br />
<br />
=== Configure the Time Zone ===<br />
# Right-Click on the Time display in the system notification area, Select Adjust Date/Time.<br />
# Click on the Time Zone Tab<br />
# Change the Time Zone to match the Time Zone on the server.<br />
#:[[Image:Samba4timezone.jpg]]<br />
<br />
== Step 3: Joining Windows Clients to the Domain ==<br />
<br />
Now your Windows computer is ready to join the Active Directory (AD) domain,<br />
<br />
As an Administrator:<br />
<br />
# Right Click My Computer -> Properties<br />
# Choose the Computer Name tab, click Change...<br />
# Click option 'Domain', insert SAMDOM.EXAMPLE.COM. If this fails, try SAMDOM.<br />
#:[[Image:Samba4joindomain.jpg]]<br />
# When it requests a username and password, type '''Administrator''' as the username, and '''p4$$word''' as the password.<br />
# You should get a message box stating "Welcome to the SAMDOM.EXAMPLE.COM domain."<br />
# Click OK on this message box and the Properties window, and you will be instructed to restart your computer.<br />
# After restarting, you should be presented with the normal logon dialog.<br />
# Change the domain to SAMDOM and type '''Administrator''' as the username, and '''p4$$word''' as the password.<br />
#:[[Image:Samba4logindomain.jpg]]<br />
<br />
= Viewing Samba 4 Active Directory object from Windows =<br />
<br />
We need install Windows 2003 Adminpak into Windows XP in order to use<br />
GUI tools to manage the domain. Before you begin, make sure that the domain<br />
administrators have administrative rights to control your computer.(To<br />
give any user administrative rights in Windows XP Pro, right click My<br />
Computer, select Manage-> choose Groups-> double click Administrators<br />
and add members from domain into the member list. When you add<br />
members from Active Directory, it will prompt you to enter an<br />
Active Directory username and password).<br />
<br />
== Step 1: Installing Windows Remote Administration Tools onto Windows ==<br />
<br />
=== Windows 7/Vista ===<br />
<br />
#Download the Windows Remote Administration Tools from:<br />
#* http://www.microsoft.com/downloads/details.aspx?FamilyId=9FF6E897-23CE-4A36-B7FC-D52065DE9960&displaylang=en (Vista)<br />
#* http://www.microsoft.com/downloads/details.aspx?FamilyID=7D2F6AD7-656B-4313-A005-4E344E43997D&displaylang=en (Windows 7)<br />
#Follow the "Install RSAT" instructions<br />
<br />
=== Windows XP Pro ===<br />
<br />
==== Administration Tools Pack & Support Tools ====<br />
# Download adminpak and supporttools from:<br />
#* http://www.microsoft.com/downloads/en/details.aspx?FamilyID=86b71a4f-4122-44af-be79-3f101e533d95<br />
#* http://download.microsoft.com/download/3/e/4/3e438f5e-24ef-4637-abd1-981341d349c7/WindowsServer2003-KB892777-SupportTools-x86-ENU.exe<br />
#:If you installed an older version of the adminpak, you'll notice the dial-in tab is missing from property pages. Just follow the link above to get SP2 which does not have this issue.<br />
# Run through the installation.<br />
# Press start->run, type 'dsa.msc', if a window 'active directory users and computers' prompt up, it mean you had install adminpak it successfully. You can also find this at Start>Programs>Administrative Tools, which should have a lot more items now.<br />
# Go to c:\Program Files\Support Tools to check whether the support tools were installed correctly; if yes, then your XP workstation is ready to manage the Samba 4 Active Directory.<br />
<br />
==== Group Policy Management Console ====<br />
# You may also find the Group Policy Management Console useful. You can download it from<br />
#* http://www.microsoft.com/downloads/details.aspx?FamilyId=0A6D4C24-8CBD-4B35-9272-DD3CBFC81887&displaylang=en<br />
#:This is primarily useful when you have larger installs and are managing many machines. You may need to download the .NET Framework first.<br />
<br />
== Step 2: Viewing Samba4 Active Directory Content ==<br />
<br />
# When logged on as a Domain Administrator, start the Active Directory Users and Computers Snap-In, either by clicking Start -> Programs\Administrative Tools\Active Directory Users and Computers, or by clicking Start -> Run 'dsa.msc'<br />
# Expand the samdom.example.com tree to see existing objects in the domain.<br />
#:[[Image:Samba4dsa.msc.jpg]]<br />
<br />
= Managing Samba 4 Active Directory From a Windows Client =<br />
One of Samba4's goals is to integrate with (and replace) Active Directory as a system. At this point, if everything has worked correctly you should have an "Administrative Tools" menu under Programs. If, under Administrative Tools you have "Active Directory Users and Computers", that is a very good sign. Most times, if there is a configuration or bug in Samba4, the AD Users & Computers (among other interfaces) won't show up as an option. You can run it by hand (Start->Run->dsa.msc) but it's unlikely to work correctly.<br />
<br />
<br />
== Step 1: Adding Users into Samba 4 Active Directory ==<br />
Unlike Samba3, Samba4 does not require a local Unix user for each Samba user that is created.<br />
<br />
To create a Samba user, use the following command:<br />
<br />
/usr/local/samba/bin/samba-tool user add USERNAME<br />
<br />
To inspect the allocated user ID and SID, use the following command:<br />
<br />
$ /usr/local/samba/bin/wbinfo --name-to-sid USERNAME<br />
S-1-5-21-4036476082-4153129556-3089177936-1005 SID_USER (1)<br />
<br />
$ /usr/local/samba/bin/wbinfo --sid-to-uid S-1-5-21-4036476082-4153129556-3089177936-1005<br />
3000011<br />
<br />
If you want to change this mapping, then use <tt>ldbedit<tt> on the <tt>/usr/local/samba/private/idmap.ldb</tt>, as shown:<br />
<br />
$ ldbedit -e emacs -H /usr/local/samba/private/idmap.ldb objectsid=S-1-5-21-4036476082-4153129556-3089177936-1005<br />
<br />
*Note: You can replace <tt>emacs</tt> with your editor of choice.<br />
<br />
You will find records that look like this:<br />
<br />
# record 1<br />
dn: CN=S-1-5-21-4036476082-4153129556-3089177936-1005<br />
cn: S-1-5-21-4036476082-4153129556-3089177936-1005<br />
objectClass: sidMap<br />
objectSid: S-1-5-21-4036476082-4153129556-3089177936-1005<br />
type: ID_TYPE_BOTH<br />
xidNumber: 3000011<br />
distinguishedName: CN=S-1-5-21-4036476082-4153129556-3089177936-1005<br />
<br />
If you change the <tt>xidNumber</tt> attribute and save your editor then exit,<br />
then Samba will update the mapping to between the SID and the user<br />
ID. Updating group mappings works in the same way.<br />
<br />
*Note: You can also manage users using the normal Windows AD user management tools.<br />
<br />
= Setting Up Roaming Profiles =<br />
<br />
1. You will need to create a share for the profiles, typically named <tt>profiles</tt>. Edit the <tt>/usr/local/samba/etc/smb.conf</tt> to include:<br />
<br />
[profiles]<br />
path = /usr/local/samba/var/profiles<br />
read only = no<br />
<br />
2. Create the directory above using:<br />
<br />
$ sudo mkdir /usr/local/samba/var/profiles<br />
<br />
3. In Windows, start ''Active Directory Users and Computers'', select all the users, right click, and hit properties<br />
<br />
4. Under the profile tab, in the ''Profile path'', type the path to your share along with %USERNAME% as follows:<br />
<br />
\\sambaserver.samdom.example.com\profiles\%USERNAME%<br />
<br />
5. click OK, logout and login as one of those users. When you logout again, you should see that the profile has been synced onto the samba server.<br />
<br />
*Note: An excellent walk-through on configuring Roaming Profiles and Folder Redirection is available [http://www.grouppolicy.biz/2010/08/best-practice-roaming-profiles-and-folder-redirection-a-k-a-user-virtualization/ here.]<br />
<br />
= Adding Organization Units (OU) Into a Samba4 Domain = <br />
<br />
The Organizational Unit (OU) is a powerful feature in Active<br />
Directory. This is a type of container which allows you to drag & drop<br />
users and/or computers into it.<br />
<br />
We can link several types of group policies to an OU, and the settings<br />
will push out to all users/computers that sit under the OU. Withing a single domain,<br />
you can have as many OUs and sub-OUs as you'd like. The result is that<br />
it can greatly reduce administrative overhead since you are able to<br />
manage everything via an OU. The implementation of Group Policy will<br />
be discussed in the next chapter.<br />
<br />
Before we create an OU, we must know what one looks like. By default<br />
we can see a sample OU called 'Domain Controllers', which uses a different<br />
icon in the Windows management tools than the 'users' and 'computers'<br />
containers. We can deploy Group Policy to the users or the computers container.<br />
<br />
# To create an OU as the Domain Administrator, click Start -> Run -> dsa.msc<br />
# Right click your domain.<br />
# Select New -> Organizational Unit<br />
# Type 'OU Demo'<br />
# You will see a new OU appear, with the name 'OU Demo'.<br />
# You can drag the user 'demo' into the new OU (Don't move other users! Unless you want to get stuck!).<br />
# Right click 'OU Demo', A sub-OU can be created with New -> Organizational Unit.<br />
<br />
Normally OUs are created according to the department setup of your<br />
organization. Be careful not to confuse Groups and OUs. Groups are<br />
used to control permissions, OUs are used for deploying settings to<br />
all users/computers within the OU.<br />
<br />
= Implementing Group Policies (GPO) in A Samba4 Domain =<br />
<br />
Samba4 Active Directory has support for group policies, and can create<br />
the group policy on the fly. The basic idea of group policies is:-<br />
<br />
# Group Policies have two kinds of settings: computers and users.<br />
# Computer settings apply to computers, while user settings apply to users.<br />
# We link the group policy to a particular OU, and the group policy will effect all computers/users under the OU.<br />
# To add a group policy, right click 'OU Demo' OU->properties.<br />
# Choose group policy.<br />
# Press new, and name it as 'GP Demo'.<br />
# Press edit to modify the policy.<br />
# Here will demonstrate how to block users from access to the control panel. Open the tree 'User Configuration'->'Administrative Templates'->'Control Panel'.<br />
# Double click on 'Prohibit access to the Control Panel'.<br />
# Press enabled and then press OK. Now the all users under 'OU Demo' won't able to access to the control panel.<br />
# Make sure that the user 'demo' is inside the 'OU Demo' (You can drag and drop it). <br />
# Logout and login as user 'demo'.<br />
# You'll find user demo is not able to access control panel.<br />
<br />
== Notes ==<br />
:User configuration will take effect once you logout and login.<br />
:Computer configuration will take effect when you restart the computer.<br />
:GPO Password Policies are not read by Samba when assigning passwords, to change the policy that Samba uses you must use '''samba-tool domain passwordsettings'''<br />
<br />
To learn more about managing and implementing organizational units, group policies, and Active Directory, try a web search for Google in Windows 2003 Active Directory implementation.<br />
<br />
= Joining a Windows Domain Controller as an Additional DC in a Domain =<br />
<br />
Once you have a Samba domain controller set up, you can choose to join<br />
additional domain controllers to the domain, whether they be<br />
additional Samba domain controllers, or additional Windows domain<br />
controllers.<br />
<br />
If you wish to join an additional Samba domain controller to a domain,<br />
then please see the [[Samba4/HOWTO/Join a domain as a DC|Joining a domain as a DC]] page. The instructions<br />
on that page are the same for joining Samba to a Windows domain as<br />
they are for joining Samba to an existing Samba domain.<br />
<br />
If you wish to join a new Windows domain controller to a Samba domain,<br />
then you should use the 'dcpromo' tool on the Windows machine. Please<br />
see the normal instructions for installing dcpromo on Windows, with<br />
the exception that you should not check the 'DNS server' option box<br />
when it is offered. Right now you should either use Windows for DNS,<br />
or use Samba and bind9 for DNS. Mixing the two can work, but it is an<br />
advanced topic that is beyond the scope of this howto.<br />
<br />
= Migrating an Existing Samba3 Domain to Samba4 =<br />
<br />
It is very likely that you already have a running Samba3 domain on your network. The question is, how do you migrate that domain and all of its users and machines over to a new Samba4 based domain without having to move every user profile and machine to the new domain? The answer is the [[Samba4/samba-tool/domain/classicupgrade/HOWTO|samba-tool domain classicupgrade]] function.<br />
<br />
= Connecting other services to your new/migrated Active Directory =<br />
<br />
If you finished setting up or migrating to Samba4, you maybe want to connect other services<br />
to your new Active Directory. Have a look at the [[Samba4/beyond|Beyond Samba]] page.<br />
<br />
= Report Your Success/Failure! =<br />
<br />
Samba4, as a replicating domain controller, is still developing rapidly.<br />
We'd like to hear from users about their successes and<br />
failures. While Samba4 is still in alpha release, we would encourage<br />
you to report both your successes and failures to the samba-technical<br />
mailing list on http://lists.samba.org<br />
<br />
Please be aware that Samba4 is not complete, and therefore, should be deployed carefully until it is ready for a stable release.</div>Intruder0815https://wiki.samba.org/index.php?title=Talk:Samba/InitScript&diff=6758Talk:Samba/InitScript2012-07-24T19:51:06Z<p>Intruder0815: Created page with "== Debian Based Systems == #!/bin/sh ### BEGIN INIT INFO # Provides: samba # Required-Start: $network $local_fs $remote_fs # Required-Stop: $network …"</p>
<hr />
<div>== Debian Based Systems ==<br />
<br />
#!/bin/sh<br />
<br />
### BEGIN INIT INFO<br />
# Provides: samba<br />
# Required-Start: $network $local_fs $remote_fs<br />
# Required-Stop: $network $local_fs $remote_fs<br />
# Default-Start: 2 3 4 5<br />
# Default-Stop: 0 1 6<br />
# Should-Start: slapd<br />
# Should-Stop: slapd<br />
# Short-Description: start Samba daemon (samba)<br />
### END INIT INFO<br />
<br />
Should-Start/Stop '''slapd''' doesn´t make sense IMO. Assuming Samba4 uses builtin LDAP service (which it does by default), might even prevent samba from starting.<br />
<br />
[[User:Intruder0815|Enrico Ehrhardt]] 19:51, 24 July 2012 (UTC)</div>Intruder0815https://wiki.samba.org/index.php?title=Samba4/HOWTO/Setup_a_Single_Sign-On_Website&diff=6729Samba4/HOWTO/Setup a Single Sign-On Website2012-07-24T00:17:00Z<p>Intruder0815: /* Apache2 */ added content</p>
<hr />
<div>=== Goal ===<br />
This Howto aims to show a clean way to setup a website that provides:<br />
<br />
* SSL encryption (HTTPS) by using a self-signed certificate<br />
* single sign-on from within your Samba4 domain<br />
* optional login from outside (user/password prompt)<br />
* full Kerberos 5 authentication security <br />
<br />
The type of setup shown here is very minimal. It is intended to get you a basic idea of how the process works.<br />
<br />
=== Usecase ===<br />
<br />
You may provide a secured intranet website for your clients, hosting private content on a per-user basis.<br />
<br />
It´s also possible to develop a web based application for domain management, using Kerberos/LDAP and Samba´s Python API. More information on this topic may be provided in another document.<br />
<br />
=== Requirements ===<br />
* Samba4 setup as domain controller<br />
* a working DNS configuration<br />
* a working Kerberos configuration<br />
<br />
It`s recommended to follow the setup process described at [[Samba4/HOWTO]].<br />
<br />
== Setup ==<br />
=== Apache2 ===<br />
<br />
You need a web server that hosts your site. Apache2 is widely spread these days and available as software package in (almost) all linux-distributions.<br />
<br />
To install apache2, mod_ssl and mod_auth_kerb run:<br />
<br />
'''Debian/Ubuntu'''<br />
<br />
<pre><br />
# apt-get install apache2 libapache2-mod-auth-kerb<br />
# a2enmod ssl auth_kerb<br />
</pre><br />
<br />
Setup a minimal ssl-site<br />
<br />
NOTE: You don't need to use a secured site to get this example working, but in production environments it's highly recommended for security reasons.<br />
A minimal configuration might look like this:<br />
<br />
----<br />
<tt>'''file: /etc/apache2/sites-available/default-ssl'''</tt><br />
<pre><br />
<IfModule mod_ssl.c><br />
<VirtualHost _default_:443><br />
ServerAdmin webmaster@localhost<br />
DocumentRoot /var/www<br />
<br />
<Directory /><br />
Options FollowSymLinks<br />
AllowOverride None<br />
</Directory><br />
<br />
<Directory /var/www/><br />
Options Indexes FollowSymLinks MultiViews<br />
AllowOverride None<br />
Order allow,deny<br />
allow from all<br />
</Directory> <br />
<br />
#########################################################<br />
# add a private directory using kerberos authentication #<br />
#########################################################<br />
<br />
<Directory /var/www/private><br />
AuthType Kerberos<br />
AuthName "Intranet Login"<br />
KrbMethodNegotiate on<br />
KrbMethodK5Passwd on<br />
KrbVerifyKDC on<br />
KrbSaveCredentials off<br />
# our keytab<br />
Krb5Keytab /etc/apache2/http.keytab<br />
# specify your realm (upper case - like the krb5.conf)<br />
KrbAuthRealms YOUR.REALM<br />
Require valid-user<br />
</Directory><br />
# rest of file<br />
...<br />
</pre><br />
----<br />
<br />
=== Active Directory ===<br />
=== Windows Client(s) ===<br />
== Troubleshooting ==</div>Intruder0815https://wiki.samba.org/index.php?title=Samba4/HOWTO/Setup_a_Single_Sign-On_Website&diff=6728Samba4/HOWTO/Setup a Single Sign-On Website2012-07-23T22:56:43Z<p>Intruder0815: /* Requirements */ added content</p>
<hr />
<div>=== Goal ===<br />
This Howto aims to show a clean way to setup a website that provides:<br />
<br />
* SSL encryption (HTTPS) by using a self-signed certificate<br />
* single sign-on from within your Samba4 domain<br />
* optional login from outside (user/password prompt)<br />
* full Kerberos 5 authentication security <br />
<br />
The type of setup shown here is very minimal. It is intended to get you a basic idea of how the process works.<br />
<br />
=== Usecase ===<br />
<br />
You may provide a secured intranet website for your clients, hosting private content on a per-user basis.<br />
<br />
It´s also possible to develop a web based application for domain management, using Kerberos/LDAP and Samba´s Python API. More information on this topic may be provided in another document.<br />
<br />
=== Requirements ===<br />
* Samba4 setup as domain controller<br />
* a working DNS configuration<br />
* a working Kerberos configuration<br />
<br />
It`s recommended to follow the setup process described at [[Samba4/HOWTO]].<br />
<br />
== Setup ==<br />
=== Apache2 ===<br />
=== Active Directory ===<br />
=== Windows Client(s) ===<br />
== Troubleshooting ==</div>Intruder0815https://wiki.samba.org/index.php?title=Samba4/HOWTO/Setup_a_Single_Sign-On_Website&diff=6717Samba4/HOWTO/Setup a Single Sign-On Website2012-07-17T21:11:19Z<p>Intruder0815: /* Usecase */ added content</p>
<hr />
<div>=== Goal ===<br />
This Howto aims to show a clean way to setup a website that provides:<br />
<br />
* SSL encryption (HTTPS) by using a self-signed certificate<br />
* single sign-on from within your Samba4 domain<br />
* optional login from outside (user/password prompt)<br />
* full Kerberos 5 authentication security <br />
<br />
The type of setup shown here is very minimal. It is intended to get you a basic idea of how the process works.<br />
<br />
=== Usecase ===<br />
<br />
You may provide a secured intranet website for your clients, hosting private content on a per-user basis.<br />
<br />
It´s also possible to develop a web based application for domain management, using Kerberos/LDAP and Samba´s Python API. More information on this topic may be provided in another document.<br />
<br />
=== Requirements ===<br />
== Setup ==<br />
=== Apache2 ===<br />
=== Active Directory ===<br />
=== Windows Client(s) ===<br />
== Troubleshooting ==</div>Intruder0815https://wiki.samba.org/index.php?title=Samba4/HOWTO/Setup_a_Single_Sign-On_Website&diff=6716Samba4/HOWTO/Setup a Single Sign-On Website2012-07-17T20:33:22Z<p>Intruder0815: /* Goal */ added content</p>
<hr />
<div>=== Goal ===<br />
This Howto aims to show a clean way to setup a website that provides:<br />
<br />
* SSL encryption (HTTPS) by using a self-signed certificate<br />
* single sign-on from within your Samba4 domain<br />
* optional login from outside (user/password prompt)<br />
* full Kerberos 5 authentication security <br />
<br />
The type of setup shown here is very minimal. It is intended to get you a basic idea of how the process works.<br />
<br />
=== Usecase ===<br />
=== Requirements ===<br />
== Setup ==<br />
=== Apache2 ===<br />
=== Active Directory ===<br />
=== Windows Client(s) ===<br />
== Troubleshooting ==</div>Intruder0815https://wiki.samba.org/index.php?title=Samba4/HOWTO/Setup_a_Single_Sign-On_Website&diff=6715Samba4/HOWTO/Setup a Single Sign-On Website2012-07-17T20:06:26Z<p>Intruder0815: added basic document structure</p>
<hr />
<div>=== Goal ===<br />
=== Usecase ===<br />
=== Requirements ===<br />
== Setup ==<br />
=== Apache2 ===<br />
=== Active Directory ===<br />
=== Windows Client(s) ===<br />
== Troubleshooting ==</div>Intruder0815