Showing posts with label Active Directory. Show all posts
Showing posts with label Active Directory. Show all posts

Friday, July 6, 2012

Windows 2003 Active Directory Setup:dcpromo


Windows 2003 Active Directory Setup:dcpromo

Now that we have setup Windows Server 2003 on our virtual machine, and we have patched it with SP2, Installed an Antivirus and setup DNS, is time now to setup active directory using dcpromo. Read about how to install and configure DNS on Windows Server 2003 from my previous post.

Setting up active directory using the run command dcpromo is a straightforward procedure. To begin, from your windows 2003 server desktop go to Start click on Run and type dcpromo and hit Enter.


The “Welcome to the Active Directory Installation Wizard” should come up:





Click on Next. On the following window, you will get a warning about comparability issues with other Operating Systems. Improve security settings in Windows Server 2003 affect older versions of windows:





After reading and thinking about consequences, click Next. On the next screen, you will get two options. The first option asks you if you want the server to become a domain controller for a new domain or if you want the server to be an additional domain controller for for an existing domain:



Select the first option and click Next. On the next window, you will get three options. the first option is to setup the domain in a new forest. Select this option if its the first domain controller on your organization, or if you want it to be totally independent from any forest.

Option two: Child domain in an existing domain tree. select this option if you want the domain to be a child domain from an existing domain. option three: Domain tree in an existing forest. if you don’t want any of the above, select this option.





In our case, choose the first option, and click Next. On the next screen, we need to type the full DNS name for the new domain:



Type the full DNS name like helpdeskgeek.com, and click on Next. On the next screen, we need to choose the NETBIOS name. This is the name earlier version of windows users will be using to identify the new domain.





Choose the name, and click Next. On the next screen, you need to select the location of where you want to store the database and log files. for best performance store them in separate disks



Choose the location where you want the active directory database and logs, and click Next.

Next, the Shared system volume window will come up. here, you need to choose the location on where you want to store the SYSVOL files. this folder contains the domain public files and are replicated to all the domain controllers in the domain.





Choose the folder location, and click Next. On the next window, the DNS registration diagnostic will show up. in here most likely you will get ” Diagnostic failed” and will give you three options. First option: it will allow you to perform the DNS diagnostic again,if you have corrected the problem.

Option two: it gives you the option to allow the active directory wizard to install and configure DNS for you, and use this DNS as the primary DNS for this server. third option, it allows you to bypass this window if you plan to correct the problem later on.





Even though we have already installed DNS on this server, we have not configure any of its services, so we will choose the option to Install and configure DNS server on this computer and set this computer to use this DNS server as its preferred DNS server. then click Next.

On the next window, you need to choose what type or permissions you want for users and group objects. Here you will get two options. the first options: select this option if you run server programs with pre-windows 2000. option two: select this option, if you only run windows servers 2000 and windows servers 2003 on your domain.





Select the second option, and click Next. On the next window, you need to enter the Directory services restore mode administrator password. This password is used when you start the computer in directory services restore mode. This account is different from the domain administrator account.





Type your chosen password, and click Next. Next, you will get the summary of all the options you have chosen during the active directory wizard. remember, the domain administrator account password is the same as the current local administrator password.



Click Next. the active directory installation should begin.



Some serious configuration processes going here. After a few minutes, active directory should be installed.





Click on Finish. and restart the computer. Active Directory should be now installed.

Wednesday, December 21, 2011

Integration with Active Directory : Learn Linux, 302 (Mixed environments)

Summary:  Since the release of Windows 2000, Microsoft has offered Active Directory as its directory service, and later versions have renamed it Active Directory Domain Services (AD DS). AD DS leverages the popular LDAP for resource management, Kerberos for authentication, and tight integration with DNS for name resolution. If you currently use AD DS, integrating a Linux server can help centralize identity management and maintenance for Linux printing and file services. However, doing so can be challenging. Fortunately, Samba provides a solution for Linux integration with AD DS that requires no modification to the directory service.



In this article, learn about these concepts:
  • Understanding Active Directory Domain Services (AD DS)
  • Understanding how Samba communicates with AD DS
  • Configuring Samba to work with AD DS
  • Interacting with AD DS
.
Understanding Active Directory
Although other methods are available for integrating your Linux servers into the AD DS domain, Samba can help ease the management and configuration without requiring any schema modifications in AD DS or other software installations on the Windows Server computer. A Samba server can't become a domain controller within an AD DS domain, but it can join as a member server and interact with AD DS services.
AD DS has its foundations in the following Internet standards:
  • Domain Name System (DNS) for name resolution
  • Kerberos version 5 for user authentication
  • Lightweight Directory Access Protocol (LDAP) version 3 for directory services
LDAP originated out of the need for a more lightweight directory service than its predecessor, the X.500 protocol. LDAP has evolved a good deal since its its release in 1993. Today, it is the de facto Internet standard for directory services.
Microsoft claims LDAP compliance in the core. Table 1 shows the Requests for Comments (RFCs) providing extended support for reading and performing operations in LDAP.

Table 1. Microsoft RFC support for LDAP
RFCSupport
2251LDAP v3Since Windows 2000
2252Attribute Syntax DefinitionsSince Windows 2000
2253UTF-8 String Representation of Distinguished NamesSince Windows 2000
2254LDAP Search Filters Using StringsSince Windows 2000
2255The LDAP URL FormatSince Windows 2000
2256The X.500 User Schema for use with LDAPv3Since Windows 2000
2829Authentication Methods for LDAPSince Windows 2000
2830Extension for Transport Layer SecuritySince Windows 2000
2589Extensions for Dynamic Directory ServicesSince Windows Server 2003
2798Defines the inetOrgPerson LDAP Object ClassSince Windows Server 2003
2831Using Digest Authentication as an SASL MechanismSince Windows Server 2003
2891LDAP Control Extension for Server Side Sorting of Search ResultsSince Windows Server 2003

Kerberos was developed by the Massachusetts Institute of Technology to be a network authentication protocol at a time when security on the Internet and internal networks moved to the forefront. This protocol provides strong cryptography, which allows a client to prove its identity to a server; likewise, a server can prove its identity to the client. This operation uses tickets and authenticators.
AD DS tightly integrates with DNS and uses it to:
  • Locate AD DS domain controllers
  • Express the organizational structure in the names of its domains in a hierarchical manner
  • Provide a name-resolution service for domain controller location and AD DS domains
Keep in mind that AD DS itself is not a DNS server and doesn't replace the tasks that DNS typically performs. As a general rule, a DNS server stores zones and resource records, while AD DS uses the same namespace to store the domains and their objects. Table 2 compares typical DNS and AD DS roles.

Table 2. DNS and AD DS roles
DNSAD DS
Maps domain names to resource recordsStores DNS names as objects (dnsZone)
Maps computer names to resource recordsStores computer names as object records

service record (SRV record) is a specification of data in DNS defining the location of servers for specified services. For AD DS to function properly, DNS servers must provide support for service location resource records (RR). SRV RRs map the name of a service to the name of a server offering that service. AD DS clients and domain controllers use SRV records to determine the IP addresses of domain controllers.
Before your Linux server can interact with AD DS, you must verify your Samba installation can support LDAP and Kerberos. If you are using a previously compiled version of Samba, chances are your installation will support both Kerberos 5 and LDAP. If you compile Samba from source, be sure to include support for the kbr5 and ldap libraries. Primarily, this involves a change to the include/config.h header file before running the make command:
#define HAVE_KRB5 1
#define HAVE_LDAP 1

Library names may vary, depending on your Linux computer.
When Samba is installed on your Linux computer, you can use the Samba service daemon smbd to discover what your installation of Samba supports (see Listing 1).

Listing 1. Displaying a partial listing of Kerberos 5 support in Samba
[tbost@samba3 ~]$ smbd -b | grep KRB
   HAVE_KRB5_H
   HAVE_KRB5_LOCATE_PLUGIN_H
   HAVE_ADDRTYPE_IN_KRB5_ADDRESS
   HAVE_DECL_KRB5_AUTH_CON_SET_REQ_CKSUMTYPE
   HAVE_DECL_KRB5_GET_CREDENTIALS_FOR_USER
   HAVE_INITIALIZE_KRB5_ERROR_TABLE
   HAVE_KRB5
   HAVE_KRB5_AUTH_CON_SETUSERUSERKEY
   HAVE_KRB5_AUTH_CON_SET_REQ_CKSUMTYPE
   HAVE_KRB5_C_ENCTYPE_COMPARE
   HAVE_KRB5_C_VERIFY_CHECKSUM
   HAVE_KRB5_DEPRECATED_WITH_IDENTIFIER
   HAVE_KRB5_ENCRYPT_BLOCK
   HAVE_KRB5_ENCRYPT_DATA
   HAVE_KRB5_ENCTYPE_TO_STRING
.....

[tbost@samba3 ~]$smbd -b | grep LDAP
   HAVE_LDAP_H
   HAVE_LDAP
   HAVE_LDAP_ADD_RESULT_ENTRY
   HAVE_LDAP_INIT
   HAVE_LDAP_INITIALIZE
   HAVE_LDAP_SASL_WRAPPING
   HAVE_LDAP_SET_REBIND_PROC
   HAVE_LIBLDAP
   LDAP_SET_REBIND_PROC_ARGS

Listing 1 displays the support for the krb5 and ldap libraries, respectively, on a Fedora distribution. Your output may differ depending on the distribution. Nonetheless, verify that your command output displays HAVE_KRB5_H and HAVE_LDAP_H at a minimum.

Kerberos and NTP

Kerberos support relies on your Samba server keeping time in sync with the domain. AD DS is usually configured to use a domain controller for the time service. You can configure the Network Time Protocol (NTP) on your Linux computer using the specified Windows domain controller as the time server.
Samba can use Kerberos as a way to authenticate users in an AD DS domain. To configure Samba, locate the krb5.conf file in /etc directory, because you need to perform a few modifications to the default file configuration. At a minimum, you should specify the domain name in the realms section of the file along with the fully qualified domain name of the Windows domain server that performs authentication for AD DS (see Listing 2).

Listing 2. Configuring the krb5.conf file
[realms]

 LPIC302.LOCAL= {
  kdc = wins3.lpic302.local 
  admin_server =wins3.lpic302.local
  default_domain = LPIC302.LOCAL
 
 }

Listing 2 shows an example of a simple configuration using LPIC302.LOCAL as the AD DS domain name. Make sure you enter your domain in all uppercase letters, or Kerberos will not connect. The kdc directive specifies the AD DS controller with host name wins3.lpic302.local. In addition, the admin_server is specified as the domain controller. The default_domainparameter is useful if you want Kerberos to assume this domain name when none is expressed by the user.
The Winbind daemon facilitates authentication for users to the AD DS domain. As such, you should configure the Pluggable Authentication Modules (PAM) to use the pam_winbind module, as shown in Listing 3.

Listing 3. Configuring PAM to use pam_winbind
auth        sufficient   pam_winbind.so
auth        sufficient   pam_unix.so use_first_pass
auth        required     pam_stack.so service=system-auth
auth        required     pam_nologin.so
account     sufficient   pam_winbind.so
account     required     pam_stack.so service=system-auth
password    required     pam_stack.so service=system-auth
session     required     pam_stack.so service=system-auth
session     optional     pam_console.so

Listing 3 displays the modified system-auth file in the /etc/pam.d directory on a Fedora-based distribution. Depending on your Linux distribution, the authentication file's name may vary. Typically, the file name will be services or login.
The placement of pam_winbind.so is important. If you expect that your users will primarily authenticate from their AD DS account as opposed to the local passwd file, pam_winbind.so should be entered first. Otherwise, you may find your auth.log files filling quickly with failed local login attempts.
The Name Service Switch provides a standard mechanism by which your Linux computer can interact with common services, one being authentication. Your Linux computer will query the /etc/nsswitch.conf file when using these services. Modify this file as follows to allow your Linux computer to use Winbind for user authentication.
The code that follows highlights the process to add Winbind support to allow users to authenticate against an AD DS Kerberos 5 database using Winbind:
passwd: files winbind
group:  files winbind

Not surprisingly, the smb.conf file needs a configuration change so Samba can work within the AD DS domain. At the most basic level, set the parameters for the realm and security, as shown in Listing 4.

Listing 4. Configuring the smb.conf file
[global]
realm = lpic302.LOCAL
security = ADS
password server = wins.lpic302.local
workgroup = lpic302
winbind use default domain = yes
idmap uid = 10000-20000
idmap gid = 10000-20000
winbind enum users = yes
winbind enum groups = yes

The configuration in Listing 4 sets the realm to the domain name, lpic302.local. The security parameter is set to ADS. ADS indicates that Samba will operate in AD DS Service security mode. You can set the line windbind use default domain = yes to eliminate the need to qualify user names and other resources with the domain name when accessing resources. For example, instead of authenticating with LPIC302.LOCAL/tbost, Winbind assumes the domain LPIC302.LOCAL when the user name tbost is specified.
When configuration is complete, Samba has been restarted, and the Winbind daemon is running, you can interact with AD DS.
The net tool is an extremely useful one for Samba administrators. If you have experience with the Windows net command, you'll be familiar with many of its options and functionality. The net ADS command is what you use when working with AD DS. One of the first things to do is join a domain:
[tbost@samba3 ~]$ sudo net ADS join -U Administrator%password
[tbost@samba3 ~]$ sudo net ADS testjoin
[tbost@samba3 ~]$ sudo net ADS join -U Administrator createcomputer="ACCOUNTING/Servers"

This code uses the net command to join the domain. Alternatively, you can omit %password and enter the Windows Administrator account password when prompted. The second command verifies that the server has joined the domain. The third command in the snippet can create (or move from the default Computers object) a computer account for the Samba server in AD DS under ACCOUNTING/Servers. The object organizational unit ACCOUNTING/Servers should already exist in Active Directory if applying the third command. If you need more information about the net command, its online man page provides a lot of useful information. In addition, you can issue the command net help ADS, as shown in Listing 5.

Listing 5. Listing users and groups in an AD DS domain
[tbost@samba3 ~]$ net help ADS
Usage:
net ads info
    Display details on remote ADS server
net ads join
    Join the local machine to ADS realm
net ads testjoin
    Validate machine account
net ads leave
    Remove the local machine from ADS
net ads status
    Display machine account details
net ads user
    List/modify users
net ads group
    List/modify groups
net ads dns
    Issue dynamic DNS update
net ads password
    Change user passwords
net ads changetrustpw
    Change trust account password
net ads printer
    List/modify printer entries
net ads search
    Issue LDAP search using filter
net ads dn
    Issue LDAP search by DN
net ads sid
    Issue LDAP search by SID
net ads workgroup
    Display the workgroup name
net ads lookup
    Find the ADS DC using CLDAP lookups
net ads keytab
    Manage local keytab file
net ads gpo
    Manage group policy objects
net ads kerberos
    Manage kerberos keytab

You use the wbinfo tool, which the Winbind daemon provides, to query AD DS resources:
[tbost@samba3 ~]$  wbinfo -p
[tbost@samba3 ~]$  wbinfo -u 
[tbost@samba3 ~]$  wbinfo -g 

This snippet uses wbinfo to discover information about the domain. The wbinfo -p command pings the Winbind daemon to verify that it's running. The wbinfo -u command returns a listing of all users in the domain, while wbinfo -g returns all groups in the domain. Consult the wbinfo manual for more tool options and functionality.
If you are familiar with the setfacl and getfacl commands, you should have little problem learning the smbcacls command that the Samba client suite provides. You can use the smbcacls tool to change group and user ownership or manage access control list permissions on shares provided by a Windows Server machine in a domain:
[tbost@samba3 ~]$sudo smbcacls -G LPIC302.LOCAL\accounting \
//wins2.lpic302.local/budget private.doc

This code uses the smbcacls command to change the group permissions on the file private.doc to the accounting group on the shared directory budget on a Windows Server machine to the accounting group within the AD DS domain. The smbcacls --help command displays the available options to the various functionality of the tool.