Setting up Samba as an Active Directory Domain Controller: Difference between revisions
Mmuehlfeld (talk | contribs) m (Remove link to non-existing page) |
Mmuehlfeld (talk | contribs) (Major rewrite and restructuring of the "Samba AD DC HowTo") |
||
Line 1: | Line 1: | ||
= Introduction = |
= Introduction = |
||
Since version 4.0, Samba can |
Since version 4.0, Samba can, additionally to the NT4 PDC, act as a Domain Controller that is compatible with Microsoft Active Directory. In the following we explain, how to set up Samba as an Active Directory Domain Controller from scratch. In addition, this documentation is the start for upgrading an existing Samba NT4-style domain to a Samba AD. |
||
Whilst the Domain Controller seems capable of running as a full file server, it is suggested that organisations run a distinct file server to allow upgrades of each without disrupting the other. It is also suggested that medium-sized sites should run more than one DC. It also makes sense to have the DC's distinct from any file servers that may use the Domain Controllers. Additionally using distinct file servers avoids the idiosyncrasies in the winbindd configuration on to the Active Directory Domain Controller. The Samba team do not recommend using the Domain Controller as a file server, due to issues with the winbind internal to the Domain Controller. The recommendation is to run a separate [[Setup_a_Samba_AD_Member_Server|Member Server]] as file server. |
|||
If you are upgrading an existing Samba Active Directory Domain Controller, please consult your distribution upgrade procedure or refer to the [[Updating_Samba|Updating Samba]] HowTo. |
|||
If you looking for documentation about updating the Samba version of an existing Samba Active Directory Domain Controller, please consult your distribution upgrade procedure or see: [[Updating_Samba|Updating Samba]]. |
|||
'''We <u>do not recommend</u> using the Domain Controller as a file Server'''. The recommendation is to run separate file or [[Setup_a_Samba_AD_Member_Server|Member Servers]]. |
|||
Even if Samba as an AD DC requires at least version 4.0.0, it's always recommended to use one of the latest stable versions of Samba. It will contain fixes for bugs of previous releases and may contain improved Microsoft Active Directory compatibility and additional features. See the [[Samba_Release_Planning|Samba release plan]] for more details about the latest maintained versions and their release notes. |
|||
Whilst the Domain Controller seems capable of running as a full file server, it is suggested that organisations run a distinct file server to allow upgrades of each without disrupting the other. It is also suggested that medium-sized sites should run more than one DC. It also makes sense to have the DC's distinct from any file servers that may use the Domain Controllers. Also using distinct file Servers avoids the idiosyncrasies in the winbindd configuration on to the Active Directory Domain Controller. |
|||
Please note, that Samba bring its own LDAP and Kerberos implementation. Using an external LDAP and Kerberos server is currently not supported!''' |
|||
= Versions = |
|||
If you already have an Active Directory and want to join an additional Samba Domain Controller, see the [[Join_an_additional_Samba_DC_to_an_existing_Active_Directory|Join an additional Samba DC to an existing Active Directory]] documentation. |
|||
Samba as an Active Directory Domain Controller requires at least version 4.0.0. But it's always <u>recommended to use the latest stable version</u> of Samba. It will contain fixes for bugs of previous releases and may contain improved Microsoft Active Directory compatibility and additional features. See the [[Samba_Release_Planning|Samba Release Planning]] page for more details about the latest maintained versions and their Release Notes. |
|||
'''See the [[Server_information_used_in_documentation|server information used in documentation]] page for used pathes, hostnames, etc.''' |
|||
= Server Information = |
|||
Below, we will be using the following configuration/settings: |
|||
Installation Directory: /usr/local/samba/ |
|||
AD DC Hostname: DC1 |
|||
AD DNS Domain Name: samdom.example.com |
|||
Kerberos Realm: SAMDOM.EXAMPLE.COM |
|||
NT4 Domain Name/NetBIOS Name: SAMDOM |
|||
IP Address: 192.168.1.1 |
|||
Server Role: Domain Controller (DC) |
|||
Domain Admin Password: passw0rd |
|||
Forwarder DNS Server: 192.168.1.254 |
|||
= Installation = |
|||
== Different Ways To Install == |
|||
= Preconditions = |
|||
'''Always check the [[Operating system requirements|OS Requirements]] for dependencies and recommendations.''' |
|||
'''Samba has its own LDAP and Kerberos implementation, using external LDAP and Kerberos server is not recommended.''' |
|||
* Make sure, that your future DC uses a static IP address. DHCP can cause trouble, if the address changes. |
|||
* Read carefully the [[Active_Directory_Naming_FAQ|Active Directory Naming FAQ]] for information, frequent pitfalls, etc. about choosing a DNS and NetBIOS name for your AD. Currently Samba aD does not support to change this, what makes it to an important decission! |
|||
You have a few options to install Samba: |
|||
* Check your /etc/hosts for a correct resolution of the hostname to its IP: |
|||
* [[Build_Samba_from_source|Build Samba]] yourself. |
|||
127.0.0.1 localhost.localdomain localhost |
|||
10.99.0.1 DC1.samdom.example.com DC1 |
|||
: Ensure that your DC hostname resolves to its LAN IP and not to 127.0.0.1! |
|||
* Remove a previous installation of Samba, if existing on that host. If upgrading from an Samba NT4 domain to Samba AD, only keep your previous smb.conf and the databases. |
|||
* Install [[Distribution_specific_package_installation|binary distribution packages]]. Make sure, that you use a recent Samba installation with Active Directory Domain Controller capabilities! At the moment this means that you cannot setup an AD DC on RHEL systems (Fedora, Centos etc) using system packages, this is due to a conflict between the Heimdal kerberos that Samba uses and the Mit kerberos used by RHEL. |
|||
:* Install from [http://www.enterprisesamba.com/samba/ SerNet Enterprise Samba] package. |
|||
== Paths == |
|||
Take care when running Samba commands if you also have a previous version of Samba installed! To avoid inadvertently running the wrong version of a program, you should consider putting the „/usr/local/samba/bin/“ and „/usr/local/samba/sbin/“ directories at the <u>beginning of your $PATH variable</u>. |
|||
= Installation = |
|||
You can see what version of Samba and client tools, if any, is in your „$PATH“ variable by running: |
|||
Before you start, check the [[Operating system requirements|Operating System requirements]] for dependencies. |
|||
# '''samba -V''' |
|||
# '''smbclient -V''' |
|||
You have the following options to install Samba: |
|||
* [[Build_Samba_from_source|Build Samba]] yourself |
|||
* Install [http://www.enterprisesamba.com/samba/ SerNet Enterprise Samba] packages |
|||
* Install [[Distribution_specific_package_installation|distribution specific packages]] |
|||
: Make sure, that you use a recent Samba and note, that not all distributions currently ship Samba packages, with Active Directory Domain Controller capabilities. One of the reasons is, that some distributions are based on MIT Kerberos, while Samba (currently) only supports Heimdal Kerberos. E. g. Red Hat operating systems (RHEL, CentOS, Fedora, etc.) are affected. In this case, choose one of the other install options. |
|||
= Provisioning The Samba Active Directory = |
|||
'''''Note (Migration):''' If you plan to migrate an existing Samba NT4 domain to Samba AD, you do not manually provision the domain! See the [[Migrating_a_Samba_NT4_domain_to_a_Samba_AD_domain_(classic_upgrade)|Samba Classic Upgrade]] HowTo, instead.'' |
|||
== Paths == |
|||
'''''Note (Adding additional Domain Controllers):''' If you already have an Active Directory and only want to join a new, additional Samba Domain Controller, you do not provision the domain again! See the [[Join_an_additional_Samba_DC_to_an_existing_Active_Directory|Join a domain as a DC]] HowTo, instead.'' |
|||
You should consider putting the directories "/usr/local/samba/bin/" and "/usr/local/samba/sbin/" at the beginning of your $PATH variable: |
|||
export PATH=/usr/local/samba/bin/:/usr/local/samba/sbin/:$PATH |
|||
'''''<u>Selecting what DNS name to use:</u>''' See [[DNS#Selecting_the_Forest_Root_Domain|Selecting the Forest Root Domain]] for further information and best practice and [[DNS#Avoid_.local_TLD|avoid .local domains]].'' |
|||
To permanently add this to your system or user configuration, see your distributions documentation. |
|||
When Samba sets up the first Domain Controller in a Domain, the provisioning creates an initial Active Directory database. Because of this, the provision command must be executed with root privileges, to be able to write to the installation directory and set the correct permissions on files and folders. |
|||
Before you start the provisioning, make yourself familiar with the parameters and options of 'samba-tool': |
|||
# '''samba-tool domain provision --help ''' |
|||
= Provisioning the Samba Active Directory = |
|||
'''''Migration of a Samba NT4 domain:''' If you plan to migrate an existing Samba NT4 domain to Samba AD, you do not manually provision the domain. The migration is done by the classicupgrade process. Skip this section and follow [[Migrating_a_Samba_NT4_domain_to_a_Samba_AD_domain_(classic_upgrade)|Migrating a Samba NT4 domain to a Samba AD domain (classic upgrade)]]. Come back afterwards and continue with [[#Testing_your_Samba_Domain_Controller|Testing your Samba Domain Controller]].'' |
|||
If your future Domain Controller has multiple NICs, the following two options are required. This is because 'samba-tool' would auto-choose one of the IPv4/IPv6 addresses if multiple interfaces were found, therefore it is necessary to bind Samba to the desired interfaces using |
|||
--option="interfaces=lo eth0" --option="bind interfaces only=yes" |
|||
When Samba sets up the first Domain Controller in a Domain, the provisioning creates an initial Active Directory database. This must be done with root privileges, to be able to write to the installation directory and set the correct permissions on files and folders. |
|||
First make yourself familiar with the possible parameters and options of the provisioning: |
|||
# samba-tool domain provision --help |
|||
If your Domain Controller has multiple network interfaces, the following two "samba-tool" options are required, to prevent that tool to auto-choose one of the IPv4/IPv6 addresses of the interfaces. Furthermore it is necessary to bind Samba to the desired interface. |
|||
# samba-tool domain provision ..... --option="interfaces=lo eth0" --option="bind interfaces only=yes" |
|||
Interactively provision a new domain (parameter explanation below): |
Interactively provision a new domain (parameter explanation below): |
||
# |
# samba-tool domain provision --use-rfc2307 --interactive |
||
Realm [SAMDOM.EXAMPLE.COM]: |
Realm [SAMDOM.EXAMPLE.COM]: SAMDOM.EXAMPLE.COM |
||
Domain [SAMDOM]: |
Domain [SAMDOM]: SAMDOM |
||
Server Role (dc, member, standalone) [dc]: |
Server Role (dc, member, standalone) [dc]: dc |
||
DNS backend (SAMBA_INTERNAL, BIND9_FLATFILE, BIND9_DLZ, NONE) [SAMBA_INTERNAL]: |
DNS backend (SAMBA_INTERNAL, BIND9_FLATFILE, BIND9_DLZ, NONE) [SAMBA_INTERNAL]: SAMBA_INTERNAL |
||
DNS forwarder IP address (write 'none' to disable forwarding) [ |
DNS forwarder IP address (write 'none' to disable forwarding) [10.99.0.1]: 8.8.8.8 |
||
Administrator password: |
Administrator password: Passw0rd |
||
Retype password: |
Retype password: Passw0rd |
||
Looking up IPv4 addresses |
Looking up IPv4 addresses |
||
Looking up IPv6 addresses |
Looking up IPv6 addresses |
||
Line 135: | Line 136: | ||
<u>--use-rfc2307:</u> Enables |
<u>--use-rfc2307:</u> Enables NIS extensions. They allow a central management of Unix attributes (UIDs, shells, GIDs, etc.) inside Active Directory. It is recommended to always enable this feature during the provisioning. There are no disadvantages by not using it, but you may find yourself later in a situation where the central management of Unix account/group information becomes a requirement. Enabling it afterwards requires additional work like a manual AD schema extension. For further information about RFC2307, see [[General_information_on_RFC2307|General information on RFC2307]] and [[Setting_up_RFC2307_in_AD|Setting up RFC2307 in AD]]. |
||
<u>--interactive:</u> Use interactive provisioning. The defaults are the values in the squared brackets, they will be used if no input is made. |
<u>--interactive:</u> Use interactive provisioning. The defaults are the values in the squared brackets, they will be used if no other input is made. |
||
<u>Realm:</u> Kerberos Realm and AD DNS domain written in upper case. You should always use a subdomain of your domain name (e. g. samdom.example.com). Never use your domain name (example.com) for your Active Directory DNS domain. This prevent you accessing accessing servers using that name, like web server, because the domain is resolved to the IP(s) of your Domain Controller(s) instead! See the [[Active_Directory_Naming_FAQ|Active Directory Naming FAQ]] for further information and help. |
|||
<u>Realm:</u> Kerberos Realm. It will automatically be used as the Active Directory DNS domain name, so it must be the same as the dns name of the machine you are provisioning on, it must always be entered in uppercase. |
|||
<u>Domain:</u> NT4 |
<u>Domain:</u> NT4 NetBIOS domain name in upper case used by AD for compatibility reasons. Maximum name length: 15 characters. Usually - and that's what we recommend - this is the first part of the AD DNS name. In any case if using something different, make sure, that it maches the [https://support.microsoft.com/en-us/kb/909264 naming conventions in Active Directory (section "NetBIOS domain names")]. Please note, that even if some punctuation marks like periods are allowed, can cause trouble in some situations and should be avoided! See the [[Active_Directory_Naming_FAQ|Active Directory Naming FAQ]] for further information and help. |
||
<u>Server Role:</u> 'dc' for Domain Controller |
<u>Server Role:</u> 'dc' for Domain Controller. |
||
<u>DNS backend:</u> |
<u>DNS backend:</u> Supported DNS backends are the [[Samba_Internal_DNS|Samba internal DNS server]] and [[Configure_BIND_as_backend_for_Samba_AD|BIND9_DLZ]]. We used the default - the internal DNS - in our above example. It is the best choice if you're not having complex DNS requirements. See [[DNS#Which_DNS_backend_should_I_choose.3F|Which DNS backend should I choose?]] for a comparison and suggestions. If you have chosen BIND9_DLZ as backend, you must setup and configure BIND, before first starting your Domain Controller. See [[Configure_BIND_as_backend_for_Samba_AD|Configure BIND as backend for Samba AD]] for further setup information. If you later find out that your DNS backend choice doesn't fit your needs, you can [[Changing_the_DNS_backend|change it afterwards]]. Don't use BIND9_FLATFILE as DNS backend. It isn't documented and not supported! See that AD heavily relies on DNS, the first DC in an AD must act as a DNS server, so you can't choose NONE here. |
||
<u>DNS forwarder IP address:</u> You are only prompted for this if you chose the Internal DNS as the backend. It defines the IP address of one DNS server to which DNS queries should be forwarded to when your DNS server isn't authoritative. Commonly it is your providers DNS server IP address. |
|||
<u>DNS forwarder IP address:</u> You are only prompted for this information, if you choose the Samba internal DNS as the backend. It defines the IP address of one DNS server, to which DNS queries should be forwarded, when your DNS server isn't authoritative for a zone. Commonly it is your providers DNS server IP address. |
|||
'''''Note:''' You should always use a subdomain of your domain name (e. g. samdom.example.com). Never use your domain name (example.com) for your Active Directory DNS domain, this is to stop problems when accessing servers using that name (e. g. web server), but resolving to different IPs other than your Domain Controllers!'' |
|||
<u>Administrator password:</u> The Domain Administrators password. It must meet the |
<u>Administrator password:</u> The Domain Administrators password. It must meet the complexity requirements (see https://technet.microsoft.com/en-us/library/cc786468%28v=ws.10%29.aspx): |
||
* At least 8 characters |
* At least 8 characters |
||
* Containing three of the following |
* Containing at least three of the following five character groups |
||
** Uppercase characters of European languages (A through Z, with diacritic marks, Greek and Cyrillic characters) |
|||
** Uppercase letters |
|||
** Lowercase characters of European languages (a through z, sharp-s, with diacritic marks, Greek and Cyrillic characters) |
|||
** Lowercase letters |
|||
** Base 10 digits (0 through 9) |
|||
** Numerals |
|||
** Nonalphanumeric characters: ~!@#$%^&*_-+=`|\(){}[]:;"'<>,.?/ |
|||
** Symbols (all keyboard characters not defined as letters or numerals) |
|||
** Any Unicode character that is categorized as an alphabetic character but is not uppercase or lowercase. This includes Unicode characters from Asian languages. |
|||
If the password doesn't fulfil the complexity requirements, the provisioning will fail and you will have to start over (remove the 'smb.conf'in that case). |
|||
:If the password doesn't fulfil the complexity requirements, the provisioning will fail and you will have to start over (remove the generated new "smb.conf" in that case). |
|||
= Testing Your Samba Domain Controller = |
|||
'''Note: If you are running any „smbd“, „nmbd“ or „winbindd“ processes from previous installations, they need to be stopped before starting „samba“ from your new installation!''' |
|||
= Testing your Samba Domain Controller = |
|||
'''Note: If you are running any "smbd", "nmbd" or "winbindd" processes from previous installations, they need to be stopped before starting "samba" from your new DC installation!''' |
|||
To start the Samba Active Directory Domain Controller in „standard“ mode, which is suitable for production use, run |
To start the Samba Active Directory Domain Controller in „standard“ mode, which is suitable for production use, run |
||
# |
# samba |
||
Line 178: | Line 184: | ||
Run |
Run "smbclient", to check if Samba provides the AD DC default shares "netlogon" and "sysvol", that were created in your "smb.conf" during provisioning/upgrading: |
||
$ |
$ smbclient -L localhost -U% |
||
Domain=[SAMDOM] OS=[Unix] Server=[Samba 4.x.y] |
Domain=[SAMDOM] OS=[Unix] Server=[Samba 4.x.y] |
||
Line 197: | Line 203: | ||
To test that authentication is working, you should try to connect to the „netlogon“ share, using the Domain Administrator account, created during provisioning: |
To test that authentication is working, you should try to connect to the „netlogon“ share, using the Domain Administrator account, that was created during provisioning/upgrading: |
||
$ |
$ smbclient //localhost/netlogon -UAdministrator -c 'ls' |
||
Enter Administrator's password: |
Enter Administrator's password: Passw0rd |
||
Domain=[SAMDOM] OS=[Unix] Server=[Samba 4.x.y] |
Domain=[SAMDOM] OS=[Unix] Server=[Samba 4.x.y] |
||
. D 0 Sat Jul 5 08:40:00 |
. D 0 Sat Jul 5 08:40:00 2015 |
||
.. D 0 Sat Jul 5 08:40:00 |
.. D 0 Sat Jul 5 08:40:00 2015 |
||
49386 blocks of size 524288. 42093 blocks available |
49386 blocks of size 524288. 42093 blocks available |
||
If the tests fail, check out the [[Samba_AD_DC_Troubleshooting|Samba AD DC Troubleshooting]] |
If any of the connection tests fail, check out the [[Samba_AD_DC_Troubleshooting|Samba AD DC Troubleshooting]] page. |
||
Line 216: | Line 222: | ||
= Configure DNS = |
= Configure DNS = |
||
A working DNS is essential |
A working DNS is essential for the correct operation of an Active Directory! E. g. without the right DNS entries, Kerberos won't work, which in turn means that many of the basic features won't work. It is worth spending some extra time ensuring your DNS setup is correct, because debugging problems caused by incorrect DNS configuration, can take a lot of time later. |
||
== DNS Backends == |
|||
For additional information on the supported DNS backends and as a decision aid to help choose which fits best to your needs, see the [[DNS#Which_DNS_backend_should_I_choose.3F|DNS]] page. |
|||
=== Samba Internal DNS Server === |
|||
By default Samba uses its Internal DNS and no further configuration is required. The forwarder was already set during the provisioning and can be changed in your „smb.conf“ (reload of „samba“ is required after changes). |
|||
=== BIND9 DNS Backend === |
|||
If you chose „BIND9_DLZ“ during your provisioning, see the [[Configure_BIND_as_backend_for_Samba_AD|Configure BIND as backend for Samba AD]] documentation for additional setup instructions. |
|||
Line 240: | Line 228: | ||
== Configure /etc/resolv.conf == |
== Configure /etc/resolv.conf == |
||
Your Domain Controller requires a name server that |
Your Domain Controller requires a name server that is able to resolve queries to Active Directory zones. Becasue this is your first Domain Controller in your AD forest, use the DCs IP and domain name in your /etc/resolv.conf: |
||
domain samdom.example.com |
domain samdom.example.com |
||
nameserver |
nameserver 10.99.0.1 |
||
'''''Note:''' If your server is set up to receive its IP configuration via DHCP, the „/etc/resolv.conf“ file might be automatically updated. Refer to your distributions documentation on how to stop/change this behavior, although DHCP is not recommended on a DC!'' |
|||
Line 255: | Line 239: | ||
To test that DNS is working properly, run the following commands and compare the output to what is shown: |
To test that DNS is working properly, run the following commands and compare the output to what is shown: |
||
$ |
$ host -t SRV _ldap._tcp.samdom.example.com. |
||
_ldap._tcp.samdom.example.com has SRV record 0 100 389 dc1.samdom.example.com. |
_ldap._tcp.samdom.example.com has SRV record 0 100 389 dc1.samdom.example.com. |
||
$ |
$ host -t SRV _kerberos._udp.samdom.example.com. |
||
_kerberos._udp.samdom.example.com has SRV record 0 100 88 dc1.samdom.example.com. |
_kerberos._udp.samdom.example.com has SRV record 0 100 88 dc1.samdom.example.com. |
||
$ |
$ host -t A dc1.samdom.example.com. |
||
dc1.samdom.example.com has address |
dc1.samdom.example.com has address 10.99.0.1 |
||
If you receive any errors, check your system logs to locate the problem. |
If you receive any errors, check your system logs to locate the problem. |
||
Line 272: | Line 255: | ||
= Configure Kerberos = |
= Configure Kerberos = |
||
== Configure /etc/krb5.conf == |
|||
Kerberos is an important part of Active Directory. Typically the configuration is done in /etc/krb5.conf. During provisioning, a working sample configuration will be created. You can replace your krb5.conf file with the sample by copying or creating a symlink: |
Kerberos is an important part of Active Directory. Typically the configuration is done in /etc/krb5.conf. During provisioning, a working sample configuration will be created. You can replace your krb5.conf file with the sample by copying or creating a symlink: |
||
# |
# ln -sf /usr/local/samba/private/krb5.conf /etc/krb5.conf |
||
Line 281: | Line 266: | ||
== Testing Kerberos == |
== Testing Kerberos == |
||
Use |
Use "kinit" to obtain a Kerberos ticket: |
||
# |
# kinit administrator@SAMDOM.EXAMPLE.COM |
||
Password for administrator@SAMDOM.EXAMPLE.COM: |
Password for administrator@SAMDOM.EXAMPLE.COM: Passw0rd |
||
Warning: Your password will expire in 41 days on Sat Aug 16 21:41:28 2014 |
|||
'''''Note:''' You must specify your realm in uppercase letters!'' |
'''''Note:''' You must always specify your realm in uppercase letters!'' |
||
Depending on your distribution, "kinit" may just return you to a prompt when successful. To verify that Kerberos is working and that you had received a ticket, run: |
|||
# klist |
|||
To verify that Kerberos is working and that you had received a ticket, run: |
|||
# '''klist''' |
|||
Ticket cache: FILE:/tmp/krb5cc_0 |
Ticket cache: FILE:/tmp/krb5cc_0 |
||
Default principal: administrator@SAMDOM.EXAMPLE.COM |
Default principal: administrator@SAMDOM.EXAMPLE.COM |
||
Valid starting Expires Service principal |
Valid starting Expires Service principal |
||
08.09.2015 14:27:45 09.09.2015 00:27:45 krbtgt/SAMDOM.EXAMPLE.COM@SAMDOM.EXAMPLE.COM |
|||
renew until 09.09.2015 14:27:42 |
|||
Line 308: | Line 289: | ||
= Configure NTP = |
= Configure NTP = |
||
Active Directory requires an accurate time synchronization between all participant machines for Kerberos to work properly. It's highly recommended to use NTP or another form of time synchronization on your Domain Controller! The [[Time_syncronisation|Time synchronisation]] documentation will provide all neccessary information, to configure NTP on an AD Domain Controller. |
|||
'''''Note:''' NTP is optional, but highly recommended!'' |
|||
Active Directory requires an accurate time synchronization between all participant machines for Kerberos to work properly. It's highly recommended to use NTP or another form of time synchronization on your Domain Controller! |
|||
The [[Time_syncronisation|Time Synchronisation]] documentation will provide all neccessary information for configuring NTP on Domain Controllers, Member Servers and clients. |
|||
Line 320: | Line 297: | ||
= Troubleshooting = |
= Troubleshooting = |
||
If you encounter any problems when using |
If you encounter any problems when using this documentation, see the [[Samba_AD_DC_Troubleshooting|Samba AD DC Troubleshooting]] page. |
||
= Further Documentation = |
|||
= Further documentation = |
|||
The Samba Wiki provides a lot of useful [[User_Documentation|documentation]] on administering your DC, ([[Backup and restore an Samba AD DC|backup and recovery]], [[Shares_with_Windows_ACLs|setup and configure file shares]], etc.), daily work ([[Joining_a_Windows_client_to_a_domain|join a Windows client to a Domain]] or [[Installing RSAT|installing RSAT on Windows for AD Management]], etc.). |
|||
The Samba Wiki provides a lot of useful [[User_Documentation|documentation]] on administering your DC, ([[Backup and restore an Samba AD DC|Backup and restore an Samba AD DC]], [[Shares_with_Windows_ACLs|Setup shares with Windows ACLs]], etc.) and daily work ([[Joining_a_Windows_client_to_a_domain|Joining a Windows client to a Domain]], [[Installing RSAT|Installing RSAT on Windows for AD Management]], etc.). |
|||
See the [[User_Documentation|Samba |
See the [[User_Documentation|Samba user documentation]] for a great overview. |
||
Line 338: | Line 313: | ||
= Report |
= Report your success/failure! = |
||
We would encourage you to report your successes and failures to the |
We would encourage you to report your successes and failures to the Samba mailing list on https://lists.samba.org/mailman/listinfo/samba. |
||
Suggestions on improving the documentation has the same importance as reporting [https://bugzilla.samba.org/ Bugs] and complications. |
Suggestions on improving the documentation has the same importance as reporting [https://bugzilla.samba.org/ Bugs] and complications. |
Revision as of 19:38, 10 September 2015
Introduction
Since version 4.0, Samba can, additionally to the NT4 PDC, act as a Domain Controller that is compatible with Microsoft Active Directory. In the following we explain, how to set up Samba as an Active Directory Domain Controller from scratch. In addition, this documentation is the start for upgrading an existing Samba NT4-style domain to a Samba AD.
Whilst the Domain Controller seems capable of running as a full file server, it is suggested that organisations run a distinct file server to allow upgrades of each without disrupting the other. It is also suggested that medium-sized sites should run more than one DC. It also makes sense to have the DC's distinct from any file servers that may use the Domain Controllers. Additionally using distinct file servers avoids the idiosyncrasies in the winbindd configuration on to the Active Directory Domain Controller. The Samba team do not recommend using the Domain Controller as a file server, due to issues with the winbind internal to the Domain Controller. The recommendation is to run a separate Member Server as file server.
If you looking for documentation about updating the Samba version of an existing Samba Active Directory Domain Controller, please consult your distribution upgrade procedure or see: Updating Samba.
Even if Samba as an AD DC requires at least version 4.0.0, it's always recommended to use one of the latest stable versions of Samba. It will contain fixes for bugs of previous releases and may contain improved Microsoft Active Directory compatibility and additional features. See the Samba release plan for more details about the latest maintained versions and their release notes.
Please note, that Samba bring its own LDAP and Kerberos implementation. Using an external LDAP and Kerberos server is currently not supported!
If you already have an Active Directory and want to join an additional Samba Domain Controller, see the Join an additional Samba DC to an existing Active Directory documentation.
See the server information used in documentation page for used pathes, hostnames, etc.
Preconditions
- Make sure, that your future DC uses a static IP address. DHCP can cause trouble, if the address changes.
- Read carefully the Active Directory Naming FAQ for information, frequent pitfalls, etc. about choosing a DNS and NetBIOS name for your AD. Currently Samba aD does not support to change this, what makes it to an important decission!
- Check your /etc/hosts for a correct resolution of the hostname to its IP:
127.0.0.1 localhost.localdomain localhost 10.99.0.1 DC1.samdom.example.com DC1
- Ensure that your DC hostname resolves to its LAN IP and not to 127.0.0.1!
- Remove a previous installation of Samba, if existing on that host. If upgrading from an Samba NT4 domain to Samba AD, only keep your previous smb.conf and the databases.
Installation
Before you start, check the Operating System requirements for dependencies.
You have the following options to install Samba:
- Build Samba yourself
- Install SerNet Enterprise Samba packages
- Install distribution specific packages
- Make sure, that you use a recent Samba and note, that not all distributions currently ship Samba packages, with Active Directory Domain Controller capabilities. One of the reasons is, that some distributions are based on MIT Kerberos, while Samba (currently) only supports Heimdal Kerberos. E. g. Red Hat operating systems (RHEL, CentOS, Fedora, etc.) are affected. In this case, choose one of the other install options.
Paths
You should consider putting the directories "/usr/local/samba/bin/" and "/usr/local/samba/sbin/" at the beginning of your $PATH variable:
export PATH=/usr/local/samba/bin/:/usr/local/samba/sbin/:$PATH
To permanently add this to your system or user configuration, see your distributions documentation.
Provisioning the Samba Active Directory
Migration of a Samba NT4 domain: If you plan to migrate an existing Samba NT4 domain to Samba AD, you do not manually provision the domain. The migration is done by the classicupgrade process. Skip this section and follow Migrating a Samba NT4 domain to a Samba AD domain (classic upgrade). Come back afterwards and continue with Testing your Samba Domain Controller.
When Samba sets up the first Domain Controller in a Domain, the provisioning creates an initial Active Directory database. This must be done with root privileges, to be able to write to the installation directory and set the correct permissions on files and folders.
First make yourself familiar with the possible parameters and options of the provisioning:
# samba-tool domain provision --help
If your Domain Controller has multiple network interfaces, the following two "samba-tool" options are required, to prevent that tool to auto-choose one of the IPv4/IPv6 addresses of the interfaces. Furthermore it is necessary to bind Samba to the desired interface.
# samba-tool domain provision ..... --option="interfaces=lo eth0" --option="bind interfaces only=yes"
Interactively provision a new domain (parameter explanation below):
# samba-tool domain provision --use-rfc2307 --interactive Realm [SAMDOM.EXAMPLE.COM]: SAMDOM.EXAMPLE.COM Domain [SAMDOM]: SAMDOM Server Role (dc, member, standalone) [dc]: dc DNS backend (SAMBA_INTERNAL, BIND9_FLATFILE, BIND9_DLZ, NONE) [SAMBA_INTERNAL]: SAMBA_INTERNAL DNS forwarder IP address (write 'none' to disable forwarding) [10.99.0.1]: 8.8.8.8 Administrator password: Passw0rd Retype password: Passw0rd Looking up IPv4 addresses Looking up IPv6 addresses No IPv6 address will be assigned Setting up share.ldb Setting up secrets.ldb Setting up the registry Setting up the privileges database Setting up idmap db Setting up SAM db Setting up sam.ldb partitions and settings Setting up sam.ldb rootDSE Pre-loading the Samba 4 and AD schema Adding DomainDN: DC=samdom,DC=example,DC=com Adding configuration container Setting up sam.ldb schema Setting up sam.ldb configuration data Setting up display specifiers Modifying display specifiers Adding users container Modifying users container Adding computers container Modifying computers container Setting up sam.ldb data Setting up well known security principals Setting up sam.ldb users and groups Setting up self join Adding DNS accounts Creating CN=MicrosoftDNS,CN=System,DC=samdom,DC=example,DC=com Creating DomainDnsZones and ForestDnsZones partitions Populating DomainDnsZones and ForestDnsZones partitions Setting up sam.ldb rootDSE marking as synchronized Fixing provision GUIDs A Kerberos configuration suitable for Samba 4 has been generated at /usr/local/samba/private/krb5.conf Setting up fake yp server settings Once the above files are installed, your Samba4 server will be ready to use Server Role: active directory domain controller Hostname: DC1 NetBIOS Domain: SAMDOM DNS Domain: samdom.example.com DOMAIN SID: S-1-5-21-2614513918-2685075268-614796884
Parameter explanations:
--use-rfc2307: Enables NIS extensions. They allow a central management of Unix attributes (UIDs, shells, GIDs, etc.) inside Active Directory. It is recommended to always enable this feature during the provisioning. There are no disadvantages by not using it, but you may find yourself later in a situation where the central management of Unix account/group information becomes a requirement. Enabling it afterwards requires additional work like a manual AD schema extension. For further information about RFC2307, see General information on RFC2307 and Setting up RFC2307 in AD.
--interactive: Use interactive provisioning. The defaults are the values in the squared brackets, they will be used if no other input is made.
Realm: Kerberos Realm and AD DNS domain written in upper case. You should always use a subdomain of your domain name (e. g. samdom.example.com). Never use your domain name (example.com) for your Active Directory DNS domain. This prevent you accessing accessing servers using that name, like web server, because the domain is resolved to the IP(s) of your Domain Controller(s) instead! See the Active Directory Naming FAQ for further information and help.
Domain: NT4 NetBIOS domain name in upper case used by AD for compatibility reasons. Maximum name length: 15 characters. Usually - and that's what we recommend - this is the first part of the AD DNS name. In any case if using something different, make sure, that it maches the naming conventions in Active Directory (section "NetBIOS domain names"). Please note, that even if some punctuation marks like periods are allowed, can cause trouble in some situations and should be avoided! See the Active Directory Naming FAQ for further information and help.
Server Role: 'dc' for Domain Controller.
DNS backend: Supported DNS backends are the Samba internal DNS server and BIND9_DLZ. We used the default - the internal DNS - in our above example. It is the best choice if you're not having complex DNS requirements. See Which DNS backend should I choose? for a comparison and suggestions. If you have chosen BIND9_DLZ as backend, you must setup and configure BIND, before first starting your Domain Controller. See Configure BIND as backend for Samba AD for further setup information. If you later find out that your DNS backend choice doesn't fit your needs, you can change it afterwards. Don't use BIND9_FLATFILE as DNS backend. It isn't documented and not supported! See that AD heavily relies on DNS, the first DC in an AD must act as a DNS server, so you can't choose NONE here.
DNS forwarder IP address: You are only prompted for this information, if you choose the Samba internal DNS as the backend. It defines the IP address of one DNS server, to which DNS queries should be forwarded, when your DNS server isn't authoritative for a zone. Commonly it is your providers DNS server IP address.
Administrator password: The Domain Administrators password. It must meet the complexity requirements (see https://technet.microsoft.com/en-us/library/cc786468%28v=ws.10%29.aspx):
- At least 8 characters
- Containing at least three of the following five character groups
- Uppercase characters of European languages (A through Z, with diacritic marks, Greek and Cyrillic characters)
- Lowercase characters of European languages (a through z, sharp-s, with diacritic marks, Greek and Cyrillic characters)
- Base 10 digits (0 through 9)
- Nonalphanumeric characters: ~!@#$%^&*_-+=`|\(){}[]:;"'<>,.?/
- Any Unicode character that is categorized as an alphabetic character but is not uppercase or lowercase. This includes Unicode characters from Asian languages.
- If the password doesn't fulfil the complexity requirements, the provisioning will fail and you will have to start over (remove the generated new "smb.conf" in that case).
Testing your Samba Domain Controller
Note: If you are running any "smbd", "nmbd" or "winbindd" processes from previous installations, they need to be stopped before starting "samba" from your new DC installation!
To start the Samba Active Directory Domain Controller in „standard“ mode, which is suitable for production use, run
# samba
Samba doesn't yet have init scripts included. You can find examples on the Samba Init-Script page.
Run "smbclient", to check if Samba provides the AD DC default shares "netlogon" and "sysvol", that were created in your "smb.conf" during provisioning/upgrading:
$ smbclient -L localhost -U% Domain=[SAMDOM] OS=[Unix] Server=[Samba 4.x.y] Sharename Type Comment --------- ---- ------- netlogon Disk sysvol Disk IPC$ IPC IPC Service (Samba 4.x.y) Domain=[SAMDOM] OS=[Unix] Server=[Samba 4.x.y] Server Comment --------- ------- Workgroup Master --------- -------
To test that authentication is working, you should try to connect to the „netlogon“ share, using the Domain Administrator account, that was created during provisioning/upgrading:
$ smbclient //localhost/netlogon -UAdministrator -c 'ls' Enter Administrator's password: Passw0rd Domain=[SAMDOM] OS=[Unix] Server=[Samba 4.x.y] . D 0 Sat Jul 5 08:40:00 2015 .. D 0 Sat Jul 5 08:40:00 2015 49386 blocks of size 524288. 42093 blocks available
If any of the connection tests fail, check out the Samba AD DC Troubleshooting page.
Configure DNS
A working DNS is essential for the correct operation of an Active Directory! E. g. without the right DNS entries, Kerberos won't work, which in turn means that many of the basic features won't work. It is worth spending some extra time ensuring your DNS setup is correct, because debugging problems caused by incorrect DNS configuration, can take a lot of time later.
Configure /etc/resolv.conf
Your Domain Controller requires a name server that is able to resolve queries to Active Directory zones. Becasue this is your first Domain Controller in your AD forest, use the DCs IP and domain name in your /etc/resolv.conf:
domain samdom.example.com nameserver 10.99.0.1
Testing DNS
To test that DNS is working properly, run the following commands and compare the output to what is shown:
$ host -t SRV _ldap._tcp.samdom.example.com. _ldap._tcp.samdom.example.com has SRV record 0 100 389 dc1.samdom.example.com.
$ host -t SRV _kerberos._udp.samdom.example.com. _kerberos._udp.samdom.example.com has SRV record 0 100 88 dc1.samdom.example.com.
$ host -t A dc1.samdom.example.com. dc1.samdom.example.com has address 10.99.0.1
If you receive any errors, check your system logs to locate the problem.
Configure Kerberos
Configure /etc/krb5.conf
Kerberos is an important part of Active Directory. Typically the configuration is done in /etc/krb5.conf. During provisioning, a working sample configuration will be created. You can replace your krb5.conf file with the sample by copying or creating a symlink:
# ln -sf /usr/local/samba/private/krb5.conf /etc/krb5.conf
Testing Kerberos
Use "kinit" to obtain a Kerberos ticket:
# kinit administrator@SAMDOM.EXAMPLE.COM Password for administrator@SAMDOM.EXAMPLE.COM: Passw0rd
Note: You must always specify your realm in uppercase letters!
Depending on your distribution, "kinit" may just return you to a prompt when successful. To verify that Kerberos is working and that you had received a ticket, run:
# klist Ticket cache: FILE:/tmp/krb5cc_0 Default principal: administrator@SAMDOM.EXAMPLE.COM Valid starting Expires Service principal 08.09.2015 14:27:45 09.09.2015 00:27:45 krbtgt/SAMDOM.EXAMPLE.COM@SAMDOM.EXAMPLE.COM renew until 09.09.2015 14:27:42
Configure NTP
Active Directory requires an accurate time synchronization between all participant machines for Kerberos to work properly. It's highly recommended to use NTP or another form of time synchronization on your Domain Controller! The Time synchronisation documentation will provide all neccessary information, to configure NTP on an AD Domain Controller.
Troubleshooting
If you encounter any problems when using this documentation, see the Samba AD DC Troubleshooting page.
Further documentation
The Samba Wiki provides a lot of useful documentation on administering your DC, (Backup and restore an Samba AD DC, Setup shares with Windows ACLs, etc.) and daily work (Joining a Windows client to a Domain, Installing RSAT on Windows for AD Management, etc.).
See the Samba user documentation for a great overview.
Report your success/failure!
We would encourage you to report your successes and failures to the Samba mailing list on https://lists.samba.org/mailman/listinfo/samba.
Suggestions on improving the documentation has the same importance as reporting Bugs and complications.