| 1 | <?xml version="1.0" encoding="iso-8859-1"?> | 
|---|
| 2 | <!DOCTYPE chapter PUBLIC "-//Samba-Team//DTD DocBook V4.2-Based Variant V1.0//EN" "http://www.samba.org/samba/DTD/samba-doc"> | 
|---|
| 3 | <chapter id="winbind"> | 
|---|
| 4 |  | 
|---|
| 5 | <chapterinfo> | 
|---|
| 6 | <author> | 
|---|
| 7 | <firstname>Tim</firstname><surname>Potter</surname> | 
|---|
| 8 | <affiliation> | 
|---|
| 9 | <orgname>Samba Team</orgname> | 
|---|
| 10 | <address><email>tpot@linuxcare.com.au</email></address> | 
|---|
| 11 | </affiliation> | 
|---|
| 12 | </author> | 
|---|
| 13 | &author.tridge; | 
|---|
| 14 | <author> | 
|---|
| 15 | <firstname>Naag</firstname><surname>Mummaneni</surname> | 
|---|
| 16 | <affiliation> | 
|---|
| 17 | <address><email>getnag@rediffmail.com</email></address> | 
|---|
| 18 | </affiliation> | 
|---|
| 19 | <contrib>Notes for Solaris</contrib> | 
|---|
| 20 | </author> | 
|---|
| 21 | <author> | 
|---|
| 22 | <firstname>John</firstname><surname>Trostel</surname> | 
|---|
| 23 | <affiliation> | 
|---|
| 24 | <orgname>SNAP</orgname> | 
|---|
| 25 | <address><email>jtrostel@snapserver.com</email></address> | 
|---|
| 26 | </affiliation> | 
|---|
| 27 | </author> | 
|---|
| 28 | &author.jelmer; | 
|---|
| 29 | &author.jht; | 
|---|
| 30 | <pubdate>June 15, 2005</pubdate> | 
|---|
| 31 | </chapterinfo> | 
|---|
| 32 |  | 
|---|
| 33 | <title>Winbind: Use of Domain Accounts</title> | 
|---|
| 34 |  | 
|---|
| 35 | <sect1> | 
|---|
| 36 | <title>Features and Benefits</title> | 
|---|
| 37 |  | 
|---|
| 38 | <para> | 
|---|
| 39 | <indexterm><primary>holy grail</primary></indexterm> | 
|---|
| 40 | <indexterm><primary>heterogeneous computing</primary></indexterm> | 
|---|
| 41 | Integration of UNIX and Microsoft Windows NT through a unified logon has | 
|---|
| 42 | been considered a <quote>holy grail</quote> in heterogeneous computing environments for | 
|---|
| 43 | a long time. | 
|---|
| 44 | </para> | 
|---|
| 45 |  | 
|---|
| 46 | <para> | 
|---|
| 47 | <indexterm><primary>interoperability</primary></indexterm> | 
|---|
| 48 | <indexterm><primary>domain user</primary></indexterm> | 
|---|
| 49 | <indexterm><primary>domain group</primary></indexterm> | 
|---|
| 50 | <indexterm><primary>group ownership</primary></indexterm> | 
|---|
| 51 | There is one other facility without which UNIX and Microsoft Windows network | 
|---|
| 52 | interoperability would suffer greatly. It is imperative that there be a | 
|---|
| 53 | mechanism for sharing files across UNIX systems and to be able to assign | 
|---|
| 54 | domain user and group ownerships with integrity. | 
|---|
| 55 | </para> | 
|---|
| 56 |  | 
|---|
| 57 | <para> | 
|---|
| 58 | <indexterm><primary>Pluggable Authentication Modules</primary><see>PAM</see></indexterm> | 
|---|
| 59 | <indexterm><primary>winbind</primary></indexterm> | 
|---|
| 60 | <indexterm><primary>NSS</primary></indexterm> | 
|---|
| 61 | <indexterm><primary>RPC</primary></indexterm> | 
|---|
| 62 | <emphasis>winbind</emphasis> is a component of the Samba suite of programs that | 
|---|
| 63 | solves the unified logon problem. Winbind uses a UNIX implementation of Microsoft | 
|---|
| 64 | RPC calls, Pluggable Authentication Modules (PAMs), and the name service switch (NSS) to | 
|---|
| 65 | allow Windows NT domain users to appear and operate as UNIX users on a UNIX | 
|---|
| 66 | machine. This chapter describes the Winbind system, the functionality | 
|---|
| 67 | it provides, how it is configured, and how it works internally. | 
|---|
| 68 | </para> | 
|---|
| 69 |  | 
|---|
| 70 | <para> | 
|---|
| 71 | Winbind provides three separate functions: | 
|---|
| 72 | </para> | 
|---|
| 73 |  | 
|---|
| 74 | <itemizedlist> | 
|---|
| 75 | <listitem><para> | 
|---|
| 76 | <indexterm><primary>ADS</primary></indexterm> | 
|---|
| 77 | <indexterm><primary>NT4 domain</primary></indexterm> | 
|---|
| 78 | Authentication of user credentials (via PAM). This makes it possible to | 
|---|
| 79 | log onto a UNIX/Linux system using user and group accounts from a Windows | 
|---|
| 80 | NT4 (including a Samba domain) or an Active Directory domain. | 
|---|
| 81 | </para></listitem> | 
|---|
| 82 |  | 
|---|
| 83 | <listitem><para> | 
|---|
| 84 | <indexterm><primary>identity resolution</primary></indexterm> | 
|---|
| 85 | <indexterm><primary>NSS</primary></indexterm> | 
|---|
| 86 | Identity resolution (via NSS). This is the default when winbind is not used. | 
|---|
| 87 | </para></listitem> | 
|---|
| 88 |  | 
|---|
| 89 | <listitem><para> | 
|---|
| 90 | <indexterm><primary>UID</primary></indexterm> | 
|---|
| 91 | <indexterm><primary>GID</primary></indexterm> | 
|---|
| 92 | <indexterm><primary>SID</primary></indexterm> | 
|---|
| 93 | <indexterm><primary>idmap uid</primary></indexterm> | 
|---|
| 94 | <indexterm><primary>idmap gid</primary></indexterm> | 
|---|
| 95 | <indexterm><primary>idmap backend</primary></indexterm> | 
|---|
| 96 | Winbind maintains a database called winbind_idmap.tdb in which it stores | 
|---|
| 97 | mappings between UNIX UIDs, GIDs, and NT SIDs. This mapping is used only | 
|---|
| 98 | for users and groups that do not have a local UID/GID. It stores the UID/GID | 
|---|
| 99 | allocated from the idmap uid/gid range that it has mapped to the NT SID. | 
|---|
| 100 | If <parameter>idmap backend</parameter> has been specified as <constant>ldap:ldap://hostname[:389]</constant>, | 
|---|
| 101 | then instead of using a local mapping, Winbind will obtain this information | 
|---|
| 102 | from the LDAP database. | 
|---|
| 103 | </para></listitem> | 
|---|
| 104 | </itemizedlist> | 
|---|
| 105 |  | 
|---|
| 106 | <note><para> | 
|---|
| 107 | <indexterm><primary>winbindd</primary></indexterm> | 
|---|
| 108 | <indexterm><primary>starting samba</primary><secondary>winbindd</secondary></indexterm> | 
|---|
| 109 | <indexterm><primary>/etc/passwd</primary></indexterm> | 
|---|
| 110 | <indexterm><primary>/etc/group</primary></indexterm> | 
|---|
| 111 | <indexterm><primary>smbd</primary></indexterm> | 
|---|
| 112 | <indexterm><primary>NSS</primary></indexterm> | 
|---|
| 113 | If <command>winbindd</command> is not running, smbd (which calls <command>winbindd</command>) will fall back to | 
|---|
| 114 | using purely local information from <filename>/etc/passwd</filename> and <filename>/etc/group</filename> and no dynamic | 
|---|
| 115 | mapping will be used. On an operating system that has been enabled with the NSS, | 
|---|
| 116 | the resolution of user and group information will be accomplished via NSS. | 
|---|
| 117 | </para></note> | 
|---|
| 118 |  | 
|---|
| 119 |  | 
|---|
| 120 | <figure id="winbind_idmap"> | 
|---|
| 121 | <title>Winbind Idmap</title> | 
|---|
| 122 | <imagefile scale="45">idmap_winbind_no_loop</imagefile> | 
|---|
| 123 | </figure> | 
|---|
| 124 |  | 
|---|
| 125 | </sect1> | 
|---|
| 126 |  | 
|---|
| 127 |  | 
|---|
| 128 | <sect1> | 
|---|
| 129 | <title>Introduction</title> | 
|---|
| 130 |  | 
|---|
| 131 | <para>It is well known that UNIX and Microsoft Windows NT have | 
|---|
| 132 | different models for representing user and group information and | 
|---|
| 133 | use different technologies for implementing them. This fact has | 
|---|
| 134 | made it difficult to integrate the two systems in a satisfactory | 
|---|
| 135 | manner.</para> | 
|---|
| 136 |  | 
|---|
| 137 | <para> | 
|---|
| 138 | <indexterm><primary>synchronization problems</primary></indexterm> | 
|---|
| 139 | <indexterm><primary>passwords</primary></indexterm> | 
|---|
| 140 | One common solution in use today has been to create | 
|---|
| 141 | identically named user accounts on both the UNIX and Windows systems | 
|---|
| 142 | and use the Samba suite of programs to provide file and print services | 
|---|
| 143 | between the two. This solution is far from perfect, however, because | 
|---|
| 144 | adding and deleting users on both sets of machines becomes a chore, | 
|---|
| 145 | and two sets of passwords are required &smbmdash; both of which | 
|---|
| 146 | can lead to synchronization problems between the UNIX and Windows | 
|---|
| 147 | systems and confusion for users.</para> | 
|---|
| 148 |  | 
|---|
| 149 | <para>We divide the unified logon problem for UNIX machines into | 
|---|
| 150 | three smaller problems:</para> | 
|---|
| 151 |  | 
|---|
| 152 | <itemizedlist> | 
|---|
| 153 | <listitem><para>Obtaining Windows NT user and group information. | 
|---|
| 154 | </para></listitem> | 
|---|
| 155 |  | 
|---|
| 156 | <listitem><para>Authenticating Windows NT users. | 
|---|
| 157 | </para></listitem> | 
|---|
| 158 |  | 
|---|
| 159 | <listitem><para>Password changing for Windows NT users. | 
|---|
| 160 | </para></listitem> | 
|---|
| 161 | </itemizedlist> | 
|---|
| 162 |  | 
|---|
| 163 |  | 
|---|
| 164 | <para> | 
|---|
| 165 | <indexterm><primary>unified logon</primary></indexterm> | 
|---|
| 166 | <indexterm><primary>duplication of information</primary></indexterm> | 
|---|
| 167 | Ideally, a prospective solution to the unified logon problem | 
|---|
| 168 | would satisfy all the above components without duplication of | 
|---|
| 169 | information on the UNIX machines and without creating additional | 
|---|
| 170 | tasks for the system administrator when maintaining users and | 
|---|
| 171 | groups on either system. The Winbind system provides a simple | 
|---|
| 172 | and elegant solution to all three components of the unified logon | 
|---|
| 173 | problem.</para> | 
|---|
| 174 | </sect1> | 
|---|
| 175 |  | 
|---|
| 176 |  | 
|---|
| 177 | <sect1> | 
|---|
| 178 | <title>What Winbind Provides</title> | 
|---|
| 179 |  | 
|---|
| 180 | <para> | 
|---|
| 181 | <indexterm><primary>Windows account management</primary></indexterm> | 
|---|
| 182 | <indexterm><primary>UNIX users</primary></indexterm> | 
|---|
| 183 | <indexterm><primary>UNIX groups</primary></indexterm> | 
|---|
| 184 | <indexterm><primary>NT domain</primary></indexterm> | 
|---|
| 185 | Winbind unifies UNIX and Windows NT account management by | 
|---|
| 186 | allowing a UNIX box to become a full member of an NT domain. Once | 
|---|
| 187 | this is done, the UNIX box will see NT users and groups as if | 
|---|
| 188 | they were <quote>native</quote> UNIX users and groups, allowing the NT domain | 
|---|
| 189 | to be used in much the same manner that NIS+ is used within | 
|---|
| 190 | UNIX-only environments.</para> | 
|---|
| 191 |  | 
|---|
| 192 | <para> | 
|---|
| 193 | <indexterm><primary>Winbind hooks</primary></indexterm> | 
|---|
| 194 | <indexterm><primary>domain controller</primary></indexterm> | 
|---|
| 195 | <indexterm><primary>NSS</primary></indexterm> | 
|---|
| 196 | <indexterm><primary>redirection</primary></indexterm> | 
|---|
| 197 | The end result is that whenever a | 
|---|
| 198 | program on the UNIX machine asks the operating system to look up | 
|---|
| 199 | a user or group name, the query will be resolved by asking the | 
|---|
| 200 | NT domain controller for the specified domain to do the lookup. | 
|---|
| 201 | Because Winbind hooks into the operating system at a low level | 
|---|
| 202 | (via the NSS name resolution modules in the C library), this | 
|---|
| 203 | redirection to the NT domain controller is completely | 
|---|
| 204 | transparent.</para> | 
|---|
| 205 |  | 
|---|
| 206 | <para> | 
|---|
| 207 | <indexterm><primary>user and group</primary></indexterm> | 
|---|
| 208 | <indexterm><primary>domain user</primary></indexterm> | 
|---|
| 209 | Users on the UNIX machine can then use NT user and group | 
|---|
| 210 | names as they would <quote>native</quote> UNIX names. They can chown files | 
|---|
| 211 | so they are owned by NT domain users or even login to the | 
|---|
| 212 | UNIX machine and run a UNIX X Window session as a domain user.</para> | 
|---|
| 213 |  | 
|---|
| 214 | <para> | 
|---|
| 215 | <indexterm><primary>domain controller</primary></indexterm> | 
|---|
| 216 | The only obvious indication that Winbind is being used is | 
|---|
| 217 | that user and group names take the form <constant>DOMAIN\user</constant> and | 
|---|
| 218 | <constant>DOMAIN\group</constant>. This is necessary because it allows Winbind to determine | 
|---|
| 219 | that redirection to a domain controller is wanted for a particular | 
|---|
| 220 | lookup and which trusted domain is being referenced.</para> | 
|---|
| 221 |  | 
|---|
| 222 | <para> | 
|---|
| 223 | <indexterm><primary>PAM-enabled</primary></indexterm> | 
|---|
| 224 | <indexterm><primary>domain controller</primary></indexterm> | 
|---|
| 225 | Additionally, Winbind provides an authentication service that hooks into the PAM system | 
|---|
| 226 | to provide authentication via an NT domain to any PAM-enabled | 
|---|
| 227 | applications. This capability solves the problem of synchronizing | 
|---|
| 228 | passwords between systems, since all passwords are stored in a single | 
|---|
| 229 | location (on the domain controller).</para> | 
|---|
| 230 |  | 
|---|
| 231 | <sect2> | 
|---|
| 232 | <title>Target Uses</title> | 
|---|
| 233 |  | 
|---|
| 234 | <para> | 
|---|
| 235 | <indexterm><primary>infrastructure</primary></indexterm> | 
|---|
| 236 | Winbind is targeted at organizations that have an | 
|---|
| 237 | existing NT-based domain infrastructure into which they wish | 
|---|
| 238 | to put UNIX workstations or servers. Winbind will allow these | 
|---|
| 239 | organizations to deploy UNIX workstations without having to | 
|---|
| 240 | maintain a separate account infrastructure. This greatly | 
|---|
| 241 | simplifies the administrative overhead of deploying UNIX | 
|---|
| 242 | workstations into an NT-based organization.</para> | 
|---|
| 243 |  | 
|---|
| 244 | <para> | 
|---|
| 245 | <indexterm><primary>Appliances</primary></indexterm> | 
|---|
| 246 | <indexterm><primary>Winbind</primary></indexterm> | 
|---|
| 247 | Another interesting way in which we expect Winbind to | 
|---|
| 248 | be used is as a central part of UNIX-based appliances. Appliances | 
|---|
| 249 | that provide file and print services to Microsoft-based networks | 
|---|
| 250 | will be able to use Winbind to provide seamless integration of | 
|---|
| 251 | the appliance into the domain.</para> | 
|---|
| 252 | </sect2> | 
|---|
| 253 |  | 
|---|
| 254 | <sect2> | 
|---|
| 255 | <title>Handling of Foreign SIDs</title> | 
|---|
| 256 |  | 
|---|
| 257 | <para> | 
|---|
| 258 | <indexterm><primary>foreign SID</primary></indexterm> | 
|---|
| 259 | The term <emphasis>foreign SID</emphasis> is often met with the reaction that it | 
|---|
| 260 | is not relevant to a particular environment. The following documents an interchange | 
|---|
| 261 | that took place on the Samba mailing list. It is a good example of the confusion | 
|---|
| 262 | often expressed regarding the use of winbind. | 
|---|
| 263 | </para> | 
|---|
| 264 |  | 
|---|
| 265 | <para> | 
|---|
| 266 | <indexterm><primary>local domain</primary></indexterm> | 
|---|
| 267 | Fact: Winbind is needed to handle users who use workstations that are NOT part | 
|---|
| 268 | of the local domain. | 
|---|
| 269 | </para> | 
|---|
| 270 |  | 
|---|
| 271 | <para> | 
|---|
| 272 | <indexterm><primary>PDC</primary></indexterm> | 
|---|
| 273 | Response: <quote>Why? I've used Samba with workstations that are not part of my domains | 
|---|
| 274 | lots of times without using winbind. I thought winbind was for using Samba as a member server | 
|---|
| 275 | in a domain controlled by another Samba/Windows PDC.</quote> | 
|---|
| 276 | </para> | 
|---|
| 277 |  | 
|---|
| 278 | <para> | 
|---|
| 279 | <indexterm><primary>UID</primary></indexterm> | 
|---|
| 280 | <indexterm><primary>GID</primary></indexterm> | 
|---|
| 281 | <indexterm><primary>foreign user</primary></indexterm> | 
|---|
| 282 | If the Samba server will be accessed from a domain other than the local Samba domain, or | 
|---|
| 283 | if there will be access from machines that are not local domain members, winbind will | 
|---|
| 284 | permit the allocation of UIDs and GIDs from the assigned pool that will keep the identity | 
|---|
| 285 | of the foreign user separate from users that are members of the Samba domain. | 
|---|
| 286 | </para> | 
|---|
| 287 |  | 
|---|
| 288 | <para> | 
|---|
| 289 | <indexterm><primary>PDC</primary></indexterm> | 
|---|
| 290 | <indexterm><primary>domain member</primary></indexterm> | 
|---|
| 291 | <indexterm><primary>domain non-member</primary></indexterm> | 
|---|
| 292 | <indexterm><primary>SID</primary></indexterm> | 
|---|
| 293 | This means that winbind is eminently useful in cases where a single | 
|---|
| 294 | Samba PDC on a local network is combined with both domain member and domain non-member workstations. | 
|---|
| 295 | If winbind is not used, the user george on a Windows workstation that is not a domain | 
|---|
| 296 | member will be able to access the files of a user called george in the account database | 
|---|
| 297 | of the Samba server that is acting as a PDC. When winbind is used, the default condition | 
|---|
| 298 | is that the local user george will be treated as the account DOMAIN\george and the | 
|---|
| 299 | foreign (non-member of the domain) account will be treated as MACHINE\george because | 
|---|
| 300 | each has a different SID. | 
|---|
| 301 | </para> | 
|---|
| 302 |  | 
|---|
| 303 | </sect2> | 
|---|
| 304 | </sect1> | 
|---|
| 305 |  | 
|---|
| 306 |  | 
|---|
| 307 |  | 
|---|
| 308 | <sect1> | 
|---|
| 309 | <title>How Winbind Works</title> | 
|---|
| 310 |  | 
|---|
| 311 | <para> | 
|---|
| 312 | <indexterm><primary>winbindd</primary></indexterm> | 
|---|
| 313 | <indexterm><primary>UNIX domain socket</primary></indexterm> | 
|---|
| 314 | <indexterm><primary>NSS</primary></indexterm> | 
|---|
| 315 | <indexterm><primary>PAM</primary></indexterm> | 
|---|
| 316 | The Winbind system is designed around a client/server | 
|---|
| 317 | architecture. A long-running <command>winbindd</command> daemon | 
|---|
| 318 | listens on a UNIX domain socket waiting for requests | 
|---|
| 319 | to arrive. These requests are generated by the NSS and PAM | 
|---|
| 320 | clients and are processed sequentially.</para> | 
|---|
| 321 |  | 
|---|
| 322 | <para>The technologies used to implement Winbind are described | 
|---|
| 323 | in detail below.</para> | 
|---|
| 324 |  | 
|---|
| 325 | <sect2> | 
|---|
| 326 | <title>Microsoft Remote Procedure Calls</title> | 
|---|
| 327 |  | 
|---|
| 328 | <para> | 
|---|
| 329 | <indexterm><primary>Microsoft Remote Procedure Call</primary><see>MSRPC</see></indexterm> | 
|---|
| 330 | <indexterm><primary>PDC</primary></indexterm> | 
|---|
| 331 | <indexterm><primary>remote management</primary></indexterm> | 
|---|
| 332 | <indexterm><primary>user authentication</primary></indexterm> | 
|---|
| 333 | <indexterm><primary>print spooling</primary></indexterm> | 
|---|
| 334 | Over the last few years, efforts have been underway by various Samba Team members to implement various aspects of | 
|---|
| 335 | the Microsoft Remote Procedure Call (MSRPC) system. This system is used for most network-related operations | 
|---|
| 336 | between Windows NT machines, including remote management, user authentication, and print spooling. Although | 
|---|
| 337 | initially this work was done to aid the implementation of Primary Domain Controller (PDC) functionality in | 
|---|
| 338 | Samba, it has also yielded a body of code that can be used for other purposes. | 
|---|
| 339 | </para> | 
|---|
| 340 |  | 
|---|
| 341 | <para> | 
|---|
| 342 | <indexterm><primary>MSRPC</primary></indexterm> | 
|---|
| 343 | <indexterm><primary>enumerate domain users</primary></indexterm> | 
|---|
| 344 | <indexterm><primary>enumerate domain groups</primary></indexterm> | 
|---|
| 345 | Winbind uses various MSRPC calls to enumerate domain users and groups and to obtain detailed information about | 
|---|
| 346 | individual users or groups. Other MSRPC calls can be used to authenticate NT domain users and to change user | 
|---|
| 347 | passwords. By directly querying a Windows PDC for user and group information, Winbind maps the NT account | 
|---|
| 348 | information onto UNIX user and group names. | 
|---|
| 349 | </para> | 
|---|
| 350 | </sect2> | 
|---|
| 351 |  | 
|---|
| 352 | <sect2> | 
|---|
| 353 | <title>Microsoft Active Directory Services</title> | 
|---|
| 354 |  | 
|---|
| 355 | <para> | 
|---|
| 356 | <indexterm><primary>LDAP</primary></indexterm> | 
|---|
| 357 | <indexterm><primary>Kerberos</primary></indexterm> | 
|---|
| 358 | <indexterm><primary>Winbind</primary></indexterm> | 
|---|
| 359 | <indexterm><primary>native mode</primary></indexterm> | 
|---|
| 360 | Since late 2001, Samba has gained the ability to interact with Microsoft Windows 2000 using its <quote>native | 
|---|
| 361 | mode</quote> protocols rather than the NT4 RPC services.  Using LDAP and Kerberos, a domain member running | 
|---|
| 362 | Winbind can enumerate users and groups in exactly the same way as a Windows 200x client would, and in so doing | 
|---|
| 363 | provide a much more efficient and effective Winbind implementation. | 
|---|
| 364 | </para> | 
|---|
| 365 | </sect2> | 
|---|
| 366 |  | 
|---|
| 367 | <sect2> | 
|---|
| 368 | <title>Name Service Switch</title> | 
|---|
| 369 |  | 
|---|
| 370 | <para> | 
|---|
| 371 | <indexterm><primary>NSS</primary></indexterm> | 
|---|
| 372 | <indexterm><primary>networked workstation</primary></indexterm> | 
|---|
| 373 | <indexterm><primary>NIS</primary></indexterm> | 
|---|
| 374 | <indexterm><primary>DNS</primary></indexterm> | 
|---|
| 375 | The NSS is a feature that is present in many UNIX operating systems. It allows system | 
|---|
| 376 | information such as hostnames, mail aliases, and user information | 
|---|
| 377 | to be resolved from different sources. For example, a standalone | 
|---|
| 378 | UNIX workstation may resolve system information from a series of | 
|---|
| 379 | flat files stored on the local file system. A networked workstation | 
|---|
| 380 | may first attempt to resolve system information from local files, | 
|---|
| 381 | and then consult an NIS database for user information or a DNS server | 
|---|
| 382 | for hostname information.</para> | 
|---|
| 383 |  | 
|---|
| 384 | <para> | 
|---|
| 385 | <indexterm><primary>NSS</primary></indexterm> | 
|---|
| 386 | <indexterm><primary>MSRPC</primary></indexterm> | 
|---|
| 387 | <indexterm><primary>trusted domain</primary></indexterm> | 
|---|
| 388 | <indexterm><primary>local users</primary></indexterm> | 
|---|
| 389 | <indexterm><primary>local groups</primary></indexterm> | 
|---|
| 390 | The NSS application programming interface allows Winbind to present itself as a source of system | 
|---|
| 391 | information when resolving UNIX usernames and groups. Winbind uses this interface and information obtained | 
|---|
| 392 | from a Windows NT server using MSRPC calls to provide a new source of account enumeration. Using standard UNIX | 
|---|
| 393 | library calls, you can enumerate the users and groups on a UNIX machine running Winbind and see all users and | 
|---|
| 394 | groups in an NT domain plus any trusted domain as though they were local users and groups. | 
|---|
| 395 | </para> | 
|---|
| 396 |  | 
|---|
| 397 | <para> | 
|---|
| 398 | <indexterm><primary>NSS</primary></indexterm> | 
|---|
| 399 | <indexterm><primary>/etc/nsswitch.conf</primary></indexterm> | 
|---|
| 400 | <indexterm><primary>passwd</primary></indexterm> | 
|---|
| 401 | The primary control file for NSS is <filename>/etc/nsswitch.conf</filename>.  When a UNIX application | 
|---|
| 402 | makes a request to do a lookup, the C library looks in <filename>/etc/nsswitch.conf</filename> for a line that | 
|---|
| 403 | matches the service type being requested; for example, the <quote>passwd</quote> service type is used when | 
|---|
| 404 | user or group names are looked up. This config line specifies which implementations of that service should be | 
|---|
| 405 | tried and in what order. If the passwd config line is: | 
|---|
| 406 | <screen> | 
|---|
| 407 | passwd: files example | 
|---|
| 408 | </screen> | 
|---|
| 409 | <indexterm><primary>/lib/libnss_files.so</primary></indexterm> | 
|---|
| 410 | <indexterm><primary>/lib/libnss_example.so</primary></indexterm> | 
|---|
| 411 | <indexterm><primary>resolver functions</primary></indexterm> | 
|---|
| 412 | then the C library will first load a module called <filename>/lib/libnss_files.so</filename> followed | 
|---|
| 413 | by the module <filename>/lib/libnss_example.so</filename>. The C library will dynamically load each of these | 
|---|
| 414 | modules in turn and call resolver functions within the modules to try to resolve the request. Once the request | 
|---|
| 415 | is resolved, the C library returns the result to the application. | 
|---|
| 416 | </para> | 
|---|
| 417 |  | 
|---|
| 418 | <para> | 
|---|
| 419 | <indexterm><primary>NSS</primary></indexterm> | 
|---|
| 420 | <indexterm><primary>libnss_winbind.so</primary></indexterm> | 
|---|
| 421 | <indexterm><primary>/etc/nsswitch.conf</primary></indexterm> | 
|---|
| 422 | This NSS interface provides an easy way for Winbind to hook into the operating system. All that needs | 
|---|
| 423 | to be done is to put <filename>libnss_winbind.so</filename> in <filename>/lib/</filename> then add | 
|---|
| 424 | <quote>winbind</quote> into <filename>/etc/nsswitch.conf</filename> at the appropriate place. The C library | 
|---|
| 425 | will then call Winbind to resolve user and group names. | 
|---|
| 426 | </para> | 
|---|
| 427 | </sect2> | 
|---|
| 428 |  | 
|---|
| 429 | <sect2> | 
|---|
| 430 | <title>Pluggable Authentication Modules</title> | 
|---|
| 431 |  | 
|---|
| 432 | <para> | 
|---|
| 433 | <indexterm><primary>PAM</primary></indexterm> | 
|---|
| 434 | <indexterm><primary>authentication methods</primary></indexterm> | 
|---|
| 435 | <indexterm><primary>authorization</primary></indexterm> | 
|---|
| 436 | <indexterm><primary>NIS database</primary></indexterm> | 
|---|
| 437 | PAMs provide a system for abstracting authentication and authorization technologies. With a PAM | 
|---|
| 438 | module, it is possible to specify different authentication methods for different system applications without | 
|---|
| 439 | having to recompile these applications. PAM is also useful for implementing a particular policy for | 
|---|
| 440 | authorization. For example, a system administrator may only allow console logins from users stored in the | 
|---|
| 441 | local password file but only allow users resolved from an NIS database to log in over the network. | 
|---|
| 442 | </para> | 
|---|
| 443 |  | 
|---|
| 444 | <para> | 
|---|
| 445 | <indexterm><primary>PAM</primary></indexterm> | 
|---|
| 446 | <indexterm><primary>Winbind</primary></indexterm> | 
|---|
| 447 | <indexterm><primary>authentication management</primary></indexterm> | 
|---|
| 448 | <indexterm><primary>password management</primary></indexterm> | 
|---|
| 449 | <indexterm><primary>PDC</primary></indexterm> | 
|---|
| 450 | Winbind uses the authentication management and password management PAM interface to integrate Windows | 
|---|
| 451 | NT users into a UNIX system. This allows Windows NT users to log in to a UNIX machine and be authenticated | 
|---|
| 452 | against a suitable PDC.  These users can also change their passwords and have this change take effect directly | 
|---|
| 453 | on the PDC. | 
|---|
| 454 | </para> | 
|---|
| 455 |  | 
|---|
| 456 | <para> | 
|---|
| 457 | <indexterm><primary>PAM</primary></indexterm> | 
|---|
| 458 | <indexterm><primary>/etc/pam.d/</primary></indexterm> | 
|---|
| 459 | <indexterm><primary>pam_winbind.so</primary></indexterm> | 
|---|
| 460 | <indexterm><primary>/lib/security/</primary></indexterm> | 
|---|
| 461 | PAM is configured by providing control files in the directory <filename>/etc/pam.d/</filename> for | 
|---|
| 462 | each of the services that require authentication. When an authentication request is made by an application, | 
|---|
| 463 | the PAM code in the C library looks up this control file to determine what modules to load to do the | 
|---|
| 464 | authentication check and in what order. This interface makes adding a new authentication service for Winbind | 
|---|
| 465 | very easy: simply copy the <filename>pam_winbind.so</filename> module to <filename>/lib/security/</filename>, | 
|---|
| 466 | and the PAM control files for relevant services are updated to allow authentication via Winbind. See the PAM | 
|---|
| 467 | documentation in <link linkend="pam">PAM-Based Distributed Authentication</link>, for more information. | 
|---|
| 468 | </para> | 
|---|
| 469 | </sect2> | 
|---|
| 470 |  | 
|---|
| 471 | <sect2> | 
|---|
| 472 | <title>User and Group ID Allocation</title> | 
|---|
| 473 |  | 
|---|
| 474 | <para> | 
|---|
| 475 | <indexterm><primary>RID</primary></indexterm> | 
|---|
| 476 | <indexterm><primary>Winbind</primary></indexterm> | 
|---|
| 477 | <indexterm><primary>UNIX ID</primary></indexterm> | 
|---|
| 478 | When a user or group is created under Windows NT/200x, it is allocated a numerical relative identifier | 
|---|
| 479 | (RID). This is slightly different from UNIX, which has a range of numbers that are used to identify users and | 
|---|
| 480 | the same range used to identify groups. It is Winbind's job to convert RIDs to UNIX ID numbers and vice versa. | 
|---|
| 481 | When Winbind is configured, it is given part of the UNIX user ID space and a part of the UNIX group ID space | 
|---|
| 482 | in which to store Windows NT users and groups. If a Windows NT user is resolved for the first time, it is | 
|---|
| 483 | allocated the next UNIX ID from the range. The same process applies for Windows NT groups. Over time, Winbind | 
|---|
| 484 | will have mapped all Windows NT users and groups to UNIX user IDs and group IDs. | 
|---|
| 485 | </para> | 
|---|
| 486 |  | 
|---|
| 487 | <para> | 
|---|
| 488 | <indexterm><primary>ID mapping database</primary></indexterm> | 
|---|
| 489 | <indexterm><primary>tdb</primary></indexterm> | 
|---|
| 490 | <indexterm><primary>UNIX ID</primary></indexterm> | 
|---|
| 491 | <indexterm><primary>RID</primary></indexterm> | 
|---|
| 492 | The results of this mapping are stored persistently in an ID mapping database held in a tdb database. | 
|---|
| 493 | This ensures that RIDs are mapped to UNIX IDs in a consistent way. | 
|---|
| 494 | </para> | 
|---|
| 495 | </sect2> | 
|---|
| 496 |  | 
|---|
| 497 | <sect2> | 
|---|
| 498 | <title>Result Caching</title> | 
|---|
| 499 |  | 
|---|
| 500 | <para> | 
|---|
| 501 | <indexterm><primary>SAM</primary></indexterm> | 
|---|
| 502 | <indexterm><primary>caching scheme</primary></indexterm> | 
|---|
| 503 | <indexterm><primary>Winbind</primary></indexterm> | 
|---|
| 504 | <indexterm><primary>ADS</primary></indexterm> | 
|---|
| 505 | <indexterm><primary>PDC</primary></indexterm> | 
|---|
| 506 | An active directory system can generate a lot of user and group name lookups. To reduce the network | 
|---|
| 507 | cost of these lookups, Winbind uses a caching scheme based on the SAM sequence number supplied by NT domain | 
|---|
| 508 | controllers. User or group information returned by a PDC is cached by Winbind along with a sequence number | 
|---|
| 509 | also returned by the PDC. This sequence number is incremented by Windows NT whenever any user or group | 
|---|
| 510 | information is modified. If a cached entry has expired, the sequence number is requested from the PDC and | 
|---|
| 511 | compared against the sequence number of the cached entry.  If the sequence numbers do not match, then the | 
|---|
| 512 | cached information is discarded and up-to-date information is requested directly from the PDC. | 
|---|
| 513 | </para> | 
|---|
| 514 | </sect2> | 
|---|
| 515 | </sect1> | 
|---|
| 516 |  | 
|---|
| 517 |  | 
|---|
| 518 | <sect1> | 
|---|
| 519 | <title>Installation and Configuration</title> | 
|---|
| 520 |  | 
|---|
| 521 | <sect2> | 
|---|
| 522 | <title>Introduction</title> | 
|---|
| 523 |  | 
|---|
| 524 | <para> | 
|---|
| 525 | <indexterm><primary>Winbind</primary></indexterm> | 
|---|
| 526 | <indexterm><primary>PDC</primary></indexterm> | 
|---|
| 527 | <indexterm><primary>authentication control</primary></indexterm> | 
|---|
| 528 | This section describes the procedures used to get Winbind up and running. Winbind is capable of providing | 
|---|
| 529 | access and authentication control for Windows Domain users through an NT or Windows 200x PDC for regular | 
|---|
| 530 | services, such as telnet and ftp, as well for Samba services. | 
|---|
| 531 | </para> | 
|---|
| 532 |  | 
|---|
| 533 | <itemizedlist> | 
|---|
| 534 | <listitem> | 
|---|
| 535 | <para> | 
|---|
| 536 | <emphasis>Why should I do this?</emphasis> | 
|---|
| 537 | </para> | 
|---|
| 538 |  | 
|---|
| 539 | <para> | 
|---|
| 540 | <indexterm><primary>Samba administrator</primary></indexterm> | 
|---|
| 541 | <indexterm><primary>authentication mechanisms</primary></indexterm> | 
|---|
| 542 | <indexterm><primary>domain members</primary></indexterm> | 
|---|
| 543 | <indexterm><primary>accounts</primary></indexterm> | 
|---|
| 544 | This allows the Samba administrator to rely on the authentication mechanisms on the Windows NT/200x PDC | 
|---|
| 545 | for the authentication of domain members. Windows NT/200x users no longer need to have separate accounts on | 
|---|
| 546 | the Samba server. | 
|---|
| 547 | </para> | 
|---|
| 548 | </listitem> | 
|---|
| 549 |  | 
|---|
| 550 | <listitem> | 
|---|
| 551 | <para> | 
|---|
| 552 | <emphasis>Who should be reading this document?</emphasis> | 
|---|
| 553 | </para> | 
|---|
| 554 |  | 
|---|
| 555 | <para> | 
|---|
| 556 | <indexterm><primary>PDC</primary></indexterm> | 
|---|
| 557 | <indexterm><primary>Windows NT/200x</primary></indexterm> | 
|---|
| 558 | This document is designed for system administrators. If you are implementing Samba on a file server and wish | 
|---|
| 559 | to (fairly easily) integrate existing Windows NT/200x users from your PDC onto the Samba server, this document | 
|---|
| 560 | is for you. | 
|---|
| 561 | </para> | 
|---|
| 562 | </listitem> | 
|---|
| 563 | </itemizedlist> | 
|---|
| 564 | </sect2> | 
|---|
| 565 |  | 
|---|
| 566 |  | 
|---|
| 567 | <sect2> | 
|---|
| 568 | <title>Requirements</title> | 
|---|
| 569 |  | 
|---|
| 570 | <para> | 
|---|
| 571 | <indexterm><primary>PAM</primary></indexterm> | 
|---|
| 572 | <indexterm><primary>back up</primary></indexterm> | 
|---|
| 573 | <indexterm><primary>boot disk</primary></indexterm> | 
|---|
| 574 | If you have a Samba configuration file that you are currently using, <emphasis>BACK IT UP!</emphasis> | 
|---|
| 575 | If your system already uses PAM, <emphasis>back up the <filename>/etc/pam.d</filename> directory | 
|---|
| 576 | contents!</emphasis> If you haven't already made a boot disk, <emphasis>MAKE ONE NOW!</emphasis> | 
|---|
| 577 | </para> | 
|---|
| 578 |  | 
|---|
| 579 | <para> | 
|---|
| 580 | <indexterm><primary>PAM configuration</primary></indexterm> | 
|---|
| 581 | <indexterm><primary>/etc/pam.d</primary></indexterm> | 
|---|
| 582 | <indexterm><primary>single-user mode</primary></indexterm> | 
|---|
| 583 | Messing with the PAM configuration files can make it nearly impossible to log in to your machine. That's | 
|---|
| 584 | why you want to be able to boot back into your machine in single-user mode and restore your | 
|---|
| 585 | <filename>/etc/pam.d</filename> to the original state it was in if you get frustrated with the | 
|---|
| 586 | way things are going. | 
|---|
| 587 | </para> | 
|---|
| 588 |  | 
|---|
| 589 | <para> | 
|---|
| 590 | <indexterm><primary>winbindd</primary></indexterm> | 
|---|
| 591 | <indexterm><primary>daemon</primary></indexterm> | 
|---|
| 592 | The latest version of Samba-3 includes a functioning winbindd daemon. Please refer to the <ulink | 
|---|
| 593 | url="http://samba.org/">main Samba Web page</ulink>, or better yet, your closest Samba mirror site for | 
|---|
| 594 | instructions on downloading the source code. | 
|---|
| 595 | </para> | 
|---|
| 596 |  | 
|---|
| 597 | <para> | 
|---|
| 598 | <indexterm><primary>domain users</primary></indexterm> | 
|---|
| 599 | <indexterm><primary>shares and files</primary></indexterm> | 
|---|
| 600 | <indexterm><primary>PAM</primary></indexterm> | 
|---|
| 601 | <indexterm><primary>development libraries</primary></indexterm> | 
|---|
| 602 | To allow domain users the ability to access Samba shares and files, as well as potentially other services | 
|---|
| 603 | provided by your Samba machine, PAM must be set up properly on your | 
|---|
| 604 | machine. In order to compile the Winbind modules, the PAM development libraries should be installed | 
|---|
| 605 | on your system. Please refer to the <ulink url="http://www.kernel.org/pub/linux/libs/pam/">PAM Web Site</ulink>. | 
|---|
| 606 | </para> | 
|---|
| 607 | </sect2> | 
|---|
| 608 |  | 
|---|
| 609 | <sect2> | 
|---|
| 610 | <title>Testing Things Out</title> | 
|---|
| 611 |  | 
|---|
| 612 | <para> | 
|---|
| 613 | <indexterm><primary>smbd</primary></indexterm> | 
|---|
| 614 | <indexterm><primary>nmbd</primary></indexterm> | 
|---|
| 615 | <indexterm><primary>winbindd</primary></indexterm> | 
|---|
| 616 | <indexterm><primary>/etc/pam.d</primary></indexterm> | 
|---|
| 617 | <indexterm><primary>PAM</primary></indexterm> | 
|---|
| 618 | Before starting, it is probably best to kill off all the Samba-related daemons running on your server. | 
|---|
| 619 | Kill off all &smbd;, &nmbd;, and &winbindd; processes that may be running. To use PAM, | 
|---|
| 620 | make sure that you have the standard PAM package that supplies the <filename>/etc/pam.d</filename> | 
|---|
| 621 | directory structure, including the PAM modules that are used by PAM-aware services, several PAM libraries, | 
|---|
| 622 | and the <filename>/usr/doc</filename> and <filename>/usr/man</filename> entries for PAM. Winbind is built | 
|---|
| 623 | better in Samba if the pam-devel package is also installed. This package includes the header files | 
|---|
| 624 | needed to compile PAM-aware applications. | 
|---|
| 625 | </para> | 
|---|
| 626 |  | 
|---|
| 627 | <sect3> | 
|---|
| 628 | <title>Configure <filename>nsswitch.conf</filename> and the Winbind Libraries on Linux and Solaris</title> | 
|---|
| 629 |  | 
|---|
| 630 | <para> | 
|---|
| 631 | <indexterm><primary>PAM</primary></indexterm> | 
|---|
| 632 | <indexterm><primary>pam-devel</primary></indexterm> | 
|---|
| 633 | <indexterm><primary>Winbind</primary></indexterm> | 
|---|
| 634 | <indexterm><primary>/etc/nsswitch.conf</primary></indexterm> | 
|---|
| 635 | PAM is a standard component of most current generation UNIX/Linux systems. Unfortunately, few systems install | 
|---|
| 636 | the <filename>pam-devel</filename> libraries that are needed to build PAM-enabled Samba. Additionally, Samba-3 | 
|---|
| 637 | may auto-install the Winbind files into their correct locations on your system, so before you get too far down | 
|---|
| 638 | the track, be sure to check if the following configuration is really | 
|---|
| 639 | necessary. You may only need to configure | 
|---|
| 640 | <filename>/etc/nsswitch.conf</filename>. | 
|---|
| 641 | </para> | 
|---|
| 642 |  | 
|---|
| 643 | <para> | 
|---|
| 644 | The libraries needed to run the &winbindd; daemon through nsswitch need to be copied to their proper locations: | 
|---|
| 645 | </para> | 
|---|
| 646 |  | 
|---|
| 647 | <para> | 
|---|
| 648 | <indexterm><primary>libnss_winbind.so</primary></indexterm> | 
|---|
| 649 | <screen> | 
|---|
| 650 | &rootprompt;<userinput>cp ../samba/source/nsswitch/libnss_winbind.so /lib</userinput> | 
|---|
| 651 | </screen> | 
|---|
| 652 | </para> | 
|---|
| 653 |  | 
|---|
| 654 | <para> | 
|---|
| 655 | I also found it necessary to make the following symbolic link: | 
|---|
| 656 | </para> | 
|---|
| 657 |  | 
|---|
| 658 | <para> | 
|---|
| 659 | &rootprompt; <userinput>ln -s /lib/libnss_winbind.so /lib/libnss_winbind.so.2</userinput> | 
|---|
| 660 | </para> | 
|---|
| 661 |  | 
|---|
| 662 | <para>And, in the case of Sun Solaris: | 
|---|
| 663 | <indexterm><primary>nss_winbind.so.1</primary></indexterm> | 
|---|
| 664 | <screen> | 
|---|
| 665 | &rootprompt;<userinput>ln -s /usr/lib/libnss_winbind.so /usr/lib/libnss_winbind.so.1</userinput> | 
|---|
| 666 | &rootprompt;<userinput>ln -s /usr/lib/libnss_winbind.so /usr/lib/nss_winbind.so.1</userinput> | 
|---|
| 667 | &rootprompt;<userinput>ln -s /usr/lib/libnss_winbind.so /usr/lib/nss_winbind.so.2</userinput> | 
|---|
| 668 | </screen> | 
|---|
| 669 | </para> | 
|---|
| 670 |  | 
|---|
| 671 | <para> | 
|---|
| 672 | <indexterm><primary>/etc/nsswitch.conf</primary></indexterm> | 
|---|
| 673 | As root, edit <filename>/etc/nsswitch.conf</filename> to allow user and group entries to be visible from the | 
|---|
| 674 | &winbindd; daemon. My <filename>/etc/nsswitch.conf</filename> file looked like this after editing: | 
|---|
| 675 | <programlisting> | 
|---|
| 676 | passwd:     files winbind | 
|---|
| 677 | shadow:     files | 
|---|
| 678 | group:      files winbind | 
|---|
| 679 | </programlisting></para> | 
|---|
| 680 |  | 
|---|
| 681 | <para> | 
|---|
| 682 | <indexterm><primary>winbindd</primary></indexterm> | 
|---|
| 683 | <indexterm><primary>ldconfig</primary></indexterm> | 
|---|
| 684 | <indexterm><primary>libnss_winbind</primary></indexterm> | 
|---|
| 685 | <indexterm><primary>grep</primary></indexterm> | 
|---|
| 686 | <indexterm><primary>dynamic link loader</primary></indexterm> | 
|---|
| 687 | The libraries needed by the <command>winbindd</command> daemon will be automatically | 
|---|
| 688 | entered into the <command>ldconfig</command> cache the next time | 
|---|
| 689 | your system reboots, but it is faster (and you do not need to reboot) if you do it manually: | 
|---|
| 690 | <screen> | 
|---|
| 691 | &rootprompt;<userinput>/sbin/ldconfig -v | grep winbind</userinput> | 
|---|
| 692 | </screen> | 
|---|
| 693 | This makes <filename>libnss_winbind</filename> available to winbindd and reports the current | 
|---|
| 694 | search path that is used by the dynamic link loader. The use of the <command>grep</command> | 
|---|
| 695 | filters the output of the <command>ldconfig</command> command so that we may see proof that | 
|---|
| 696 | this library is indeed recognized by the dynamic link loader. | 
|---|
| 697 | </para> | 
|---|
| 698 |  | 
|---|
| 699 | <para> | 
|---|
| 700 | <indexterm><primary>dynamic link loader</primary></indexterm> | 
|---|
| 701 | <indexterm><primary>crle</primary></indexterm> | 
|---|
| 702 | <indexterm><primary>/usr/local/lib</primary></indexterm> | 
|---|
| 703 | <indexterm><primary>link loader configuration</primary></indexterm> | 
|---|
| 704 | <indexterm><primary>object module dependencies</primary></indexterm> | 
|---|
| 705 | The Sun Solaris dynamic link loader management tool is called <command>crle</command>. The | 
|---|
| 706 | use of this tool is necessary to instruct the dynamic link loader to search directories that | 
|---|
| 707 | contain library files that were not supplied as part of the original operating system platform. | 
|---|
| 708 | The following example shows how to use this tool to add the directory <filename>/usr/local/lib</filename> | 
|---|
| 709 | to the dynamic link loader's search path: | 
|---|
| 710 | <screen> | 
|---|
| 711 | &rootprompt; crle -u -l /usr/lib:/usr/local/lib | 
|---|
| 712 | </screen> | 
|---|
| 713 | When executed without arguments, <command>crle</command> reports the current dynamic | 
|---|
| 714 | link loader configuration. This is demonstrated here: | 
|---|
| 715 | <screen> | 
|---|
| 716 | &rootprompt; crle | 
|---|
| 717 |  | 
|---|
| 718 | Configuration file [version 4]: /var/ld/ld.config | 
|---|
| 719 | Default Library Path (ELF):   /lib:/usr/lib:/usr/local/lib | 
|---|
| 720 | Trusted Directories (ELF):    /lib/secure:/usr/lib/secure  (system default) | 
|---|
| 721 |  | 
|---|
| 722 | Command line: | 
|---|
| 723 | crle -c /var/ld/ld.config -l /lib:/usr/lib:/usr/local/lib | 
|---|
| 724 | </screen> | 
|---|
| 725 | From this it is apparent that the <filename>/usr/local/lib</filename> directory is included | 
|---|
| 726 | in the search dynamic link libraries in order to satisfy object module dependencies. | 
|---|
| 727 | </para> | 
|---|
| 728 |  | 
|---|
| 729 | </sect3> | 
|---|
| 730 |  | 
|---|
| 731 | <sect3> | 
|---|
| 732 | <title>NSS Winbind on AIX</title> | 
|---|
| 733 |  | 
|---|
| 734 | <para>(This section is only for those running AIX.)</para> | 
|---|
| 735 |  | 
|---|
| 736 | <para> | 
|---|
| 737 | <indexterm><primary>AIX</primary></indexterm> | 
|---|
| 738 | <indexterm><primary>Winbind</primary></indexterm> | 
|---|
| 739 | <indexterm><primary>/usr/lib/security</primary></indexterm> | 
|---|
| 740 | <indexterm><primary>authentication module API</primary></indexterm> | 
|---|
| 741 | <indexterm><primary>/usr/lib/security/methods.cfg</primary></indexterm> | 
|---|
| 742 | <indexterm><primary>PAM module</primary></indexterm> | 
|---|
| 743 | The Winbind AIX identification module gets built as <filename>libnss_winbind.so</filename> in the | 
|---|
| 744 | nsswitch directory of the Samba source. This file can be copied to <filename>/usr/lib/security</filename>, | 
|---|
| 745 | and the AIX naming convention would indicate that it should be named WINBIND. A stanza like the following: | 
|---|
| 746 | <programlisting> | 
|---|
| 747 | WINBIND: | 
|---|
| 748 | program = /usr/lib/security/WINBIND | 
|---|
| 749 | options = authonly | 
|---|
| 750 | </programlisting> | 
|---|
| 751 | can then be added to <filename>/usr/lib/security/methods.cfg</filename>. This module only supports | 
|---|
| 752 | identification, but there have been reports of success using the standard Winbind PAM module for | 
|---|
| 753 | authentication. Use caution configuring loadable authentication modules, since misconfiguration can make | 
|---|
| 754 | it impossible to log on to the system.  Information regarding the AIX authentication module API can | 
|---|
| 755 | be found in the <quote>Kernel Extensions and Device Support Programming Concepts for AIX</quote> document that | 
|---|
| 756 | describes the <ulink url="http://publibn.boulder.ibm.com/doc_link/en_US/a_doc_lib/aixprggd/kernextc/sec_load_mod.htm"> | 
|---|
| 757 | Loadable Authentication Module Programming Interface</ulink> for AIX. Further information on administering the modules | 
|---|
| 758 | can be found in the <ulink url="http://publibn.boulder.ibm.com/doc_link/en_US/a_doc_lib/aixbman/baseadmn/iandaadmin.htm">System | 
|---|
| 759 | Management Guide: Operating System and Devices.</ulink> | 
|---|
| 760 | </para> | 
|---|
| 761 | </sect3> | 
|---|
| 762 |  | 
|---|
| 763 | <sect3> | 
|---|
| 764 | <title>Configure smb.conf</title> | 
|---|
| 765 |  | 
|---|
| 766 | <para> | 
|---|
| 767 | <indexterm><primary>winbind</primary></indexterm> | 
|---|
| 768 | <indexterm><primary>man page</primary></indexterm> | 
|---|
| 769 | <indexterm><primary>winbindd</primary></indexterm> | 
|---|
| 770 | Several parameters are needed in the &smb.conf; file to control the behavior of &winbindd;. These | 
|---|
| 771 | are described in more detail in the <citerefentry><refentrytitle>winbindd</refentrytitle> | 
|---|
| 772 | <manvolnum>8</manvolnum></citerefentry> man page. My &smb.conf; file, as shown in <link | 
|---|
| 773 | linkend="winbindcfg">the smb.conf for Winbind Setup</link>, was modified to include the necessary entries in the [global] section. | 
|---|
| 774 | </para> | 
|---|
| 775 |  | 
|---|
| 776 | <example id="winbindcfg"> | 
|---|
| 777 | <title>smb.conf for Winbind Setup</title> | 
|---|
| 778 | <smbconfblock> | 
|---|
| 779 | <smbconfsection name="[global]"/> | 
|---|
| 780 | <smbconfcomment> separate domain and username with '\', like DOMAIN\username</smbconfcomment> | 
|---|
| 781 | <smbconfoption name="winbind separator">\</smbconfoption> | 
|---|
| 782 | <smbconfcomment> use uids from 10000 to 20000 for domain users</smbconfcomment> | 
|---|
| 783 | <smbconfoption name="idmap uid">10000-20000</smbconfoption> | 
|---|
| 784 | <smbconfcomment> use gids from 10000 to 20000 for domain groups</smbconfcomment> | 
|---|
| 785 | <smbconfoption name="idmap gid">10000-20000</smbconfoption> | 
|---|
| 786 | <smbconfcomment> allow enumeration of winbind users and groups</smbconfcomment> | 
|---|
| 787 | <smbconfoption name="winbind enum users">yes</smbconfoption> | 
|---|
| 788 | <smbconfoption name="winbind enum groups">yes</smbconfoption> | 
|---|
| 789 | <smbconfcomment> give winbind users a real shell (only needed if they have telnet access)</smbconfcomment> | 
|---|
| 790 | <smbconfoption name="template homedir">/home/winnt/%D/%U</smbconfoption> | 
|---|
| 791 | <smbconfoption name="template shell">/bin/bash</smbconfoption> | 
|---|
| 792 | </smbconfblock> | 
|---|
| 793 | </example> | 
|---|
| 794 |  | 
|---|
| 795 | </sect3> | 
|---|
| 796 |  | 
|---|
| 797 |  | 
|---|
| 798 | <sect3> | 
|---|
| 799 | <title>Join the Samba Server to the PDC Domain</title> | 
|---|
| 800 |  | 
|---|
| 801 | <para> | 
|---|
| 802 | <indexterm><primary>domain security</primary></indexterm> | 
|---|
| 803 | <indexterm><primary>PDC</primary></indexterm> | 
|---|
| 804 | <indexterm><primary>BDC</primary></indexterm> | 
|---|
| 805 | All machines that will participate in domain security should be members of | 
|---|
| 806 | the domain. This applies also to the PDC and all BDCs. | 
|---|
| 807 | </para> | 
|---|
| 808 |  | 
|---|
| 809 | <para> | 
|---|
| 810 | <indexterm><primary>joining domain</primary></indexterm> | 
|---|
| 811 | <indexterm><primary>domain join</primary></indexterm> | 
|---|
| 812 | <indexterm><primary>net</primary><secondary>rpc</secondary><tertiary>join</tertiary></indexterm> | 
|---|
| 813 | <indexterm><primary>smbd</primary></indexterm> | 
|---|
| 814 | <indexterm><primary>PDC</primary></indexterm> | 
|---|
| 815 | <indexterm><primary>domain controller</primary></indexterm> | 
|---|
| 816 | <indexterm><primary>MS DCE RPC</primary></indexterm> | 
|---|
| 817 | <indexterm><primary>DCE RPC</primary></indexterm> | 
|---|
| 818 | <indexterm><primary>RPC</primary></indexterm> | 
|---|
| 819 | The process of joining a domain requires the use of the <command>net rpc join</command> | 
|---|
| 820 | command. This process communicates with the domain controller it will register with | 
|---|
| 821 | (usually the PDC) via MS DCE RPC. This means, of course, that the <command>smbd</command> | 
|---|
| 822 | process must be running on the target domain controller. It is therefore necessary to temporarily | 
|---|
| 823 | start Samba on a PDC so that it can join its own domain. | 
|---|
| 824 | </para> | 
|---|
| 825 |  | 
|---|
| 826 | <para> | 
|---|
| 827 | <indexterm><primary>PDC</primary></indexterm> | 
|---|
| 828 | <indexterm><primary>administrative privileges</primary></indexterm> | 
|---|
| 829 | <indexterm><primary>Administrator</primary></indexterm> | 
|---|
| 830 | Enter the following command to make the Samba server join the domain, where <replaceable>PDC</replaceable> is | 
|---|
| 831 | the name of your PDC and <replaceable>Administrator</replaceable> is a domain user who has administrative | 
|---|
| 832 | privileges in the domain. | 
|---|
| 833 | </para> | 
|---|
| 834 |  | 
|---|
| 835 | <note><para> | 
|---|
| 836 | <indexterm><primary>domain controller</primary></indexterm> | 
|---|
| 837 | <indexterm><primary>PDC</primary></indexterm> | 
|---|
| 838 | <indexterm><primary>tcp ports</primary></indexterm> | 
|---|
| 839 | <indexterm><primary>udp ports</primary></indexterm> | 
|---|
| 840 | Before attempting to join a machine to the domain, verify that Samba is running | 
|---|
| 841 | on the target domain controller (usually PDC) and that it is capable of being reached via ports | 
|---|
| 842 | 137/udp, 135/tcp, 139/tcp, and 445/tcp (if Samba or Windows Server 2Kx). | 
|---|
| 843 | </para></note> | 
|---|
| 844 |  | 
|---|
| 845 | <para> | 
|---|
| 846 | <indexterm><primary>net</primary><secondary>rpc</secondary><tertiary>join</tertiary></indexterm> | 
|---|
| 847 | The use of the <command>net rpc join</command> facility is shown here: | 
|---|
| 848 | <screen> | 
|---|
| 849 | &rootprompt;<userinput>/usr/local/samba/bin/net rpc join -S PDC -U Administrator</userinput> | 
|---|
| 850 | </screen> | 
|---|
| 851 | The proper response to the command should be <quote>Joined the domain | 
|---|
| 852 | <replaceable>DOMAIN</replaceable></quote> where <replaceable>DOMAIN</replaceable> | 
|---|
| 853 | is your domain name. | 
|---|
| 854 | </para> | 
|---|
| 855 |  | 
|---|
| 856 | </sect3> | 
|---|
| 857 |  | 
|---|
| 858 | <sect3> | 
|---|
| 859 | <title>Starting and Testing the <command>winbindd</command> Daemon</title> | 
|---|
| 860 |  | 
|---|
| 861 | <para> | 
|---|
| 862 | <indexterm><primary>startup script</primary></indexterm> | 
|---|
| 863 | <indexterm><primary>winbindd</primary></indexterm> | 
|---|
| 864 | <indexterm><primary>Winbind services</primary></indexterm> | 
|---|
| 865 | Eventually, you will want to modify your Samba startup script to automatically invoke the winbindd daemon when | 
|---|
| 866 | the other parts of Samba start, but it is possible to test out just the Winbind portion first. To start up | 
|---|
| 867 | Winbind services, enter the following command as root: | 
|---|
| 868 | <screen> | 
|---|
| 869 | &rootprompt;<userinput>/usr/local/samba/sbin/winbindd</userinput> | 
|---|
| 870 | </screen> | 
|---|
| 871 | Use the appropriate path to the location of the <command>winbindd</command> executable file. | 
|---|
| 872 | </para> | 
|---|
| 873 |  | 
|---|
| 874 | <note><para> | 
|---|
| 875 | <indexterm><primary>Winbind</primary></indexterm> | 
|---|
| 876 | <indexterm><primary>/usr/local/samba</primary></indexterm> | 
|---|
| 877 | The command to start up Winbind services assumes that Samba has been installed in the | 
|---|
| 878 | <filename>/usr/local/samba</filename> directory tree. You may need to search for the location of Samba files | 
|---|
| 879 | if this is not the location of <command>winbindd</command> on your system. | 
|---|
| 880 | </para></note> | 
|---|
| 881 |  | 
|---|
| 882 | <para> | 
|---|
| 883 | <indexterm><primary>paranoid</primary></indexterm> | 
|---|
| 884 | <indexterm><primary>daemon running</primary></indexterm> | 
|---|
| 885 | I'm always paranoid and like to make sure the daemon is really running. | 
|---|
| 886 | <screen> | 
|---|
| 887 | &rootprompt;<userinput>ps -ae | grep winbindd</userinput> | 
|---|
| 888 | </screen> | 
|---|
| 889 | </para> | 
|---|
| 890 |  | 
|---|
| 891 | <para> | 
|---|
| 892 | <indexterm><primary>winbindd</primary></indexterm> | 
|---|
| 893 | This command should produce output like the following if the daemon is running. | 
|---|
| 894 | <screen> | 
|---|
| 895 | 3025 ?        00:00:00 winbindd | 
|---|
| 896 | </screen> | 
|---|
| 897 | </para> | 
|---|
| 898 |  | 
|---|
| 899 | <para> | 
|---|
| 900 | <indexterm><primary>PDC</primary></indexterm> | 
|---|
| 901 | <indexterm><primary>wbinfo</primary></indexterm> | 
|---|
| 902 | Now, for the real test, try to get some information about the users on your PDC: | 
|---|
| 903 | <screen> | 
|---|
| 904 | &rootprompt;<userinput>/usr/local/samba/bin/wbinfo -u</userinput> | 
|---|
| 905 | </screen> | 
|---|
| 906 | This should echo back a list of users on your Windows users on your PDC. For example, I get the following | 
|---|
| 907 | response: | 
|---|
| 908 | <screen> | 
|---|
| 909 | CEO\Administrator | 
|---|
| 910 | CEO\burdell | 
|---|
| 911 | CEO\Guest | 
|---|
| 912 | CEO\jt-ad | 
|---|
| 913 | CEO\krbtgt | 
|---|
| 914 | CEO\TsInternetUser | 
|---|
| 915 | </screen> | 
|---|
| 916 | Obviously, I have named my domain <quote>CEO</quote> and my <smbconfoption name="winbind separator"/> is | 
|---|
| 917 | <quote>\</quote>. | 
|---|
| 918 | </para> | 
|---|
| 919 |  | 
|---|
| 920 | <para> | 
|---|
| 921 | <indexterm><primary>wbinfo</primary></indexterm> | 
|---|
| 922 | <indexterm><primary>PDC</primary></indexterm> | 
|---|
| 923 | You can do the same sort of thing to get group information from the PDC: | 
|---|
| 924 | <screen> | 
|---|
| 925 | &rootprompt;<userinput>/usr/local/samba/bin/wbinfo -g</userinput> | 
|---|
| 926 | CEO\Domain Admins | 
|---|
| 927 | CEO\Domain Users | 
|---|
| 928 | CEO\Domain Guests | 
|---|
| 929 | CEO\Domain Computers | 
|---|
| 930 | CEO\Domain Controllers | 
|---|
| 931 | CEO\Cert Publishers | 
|---|
| 932 | CEO\Schema Admins | 
|---|
| 933 | CEO\Enterprise Admins | 
|---|
| 934 | CEO\Group Policy Creator Owners | 
|---|
| 935 | </screen></para> | 
|---|
| 936 |  | 
|---|
| 937 | <para> | 
|---|
| 938 | <indexterm><primary>getent</primary></indexterm> | 
|---|
| 939 | <indexterm><primary>PDC</primary></indexterm> | 
|---|
| 940 | <indexterm><primary>/etc/passwd</primary></indexterm> | 
|---|
| 941 | <indexterm><primary>UID</primary></indexterm> | 
|---|
| 942 | <indexterm><primary>GID</primary></indexterm> | 
|---|
| 943 | <indexterm><primary>home directories</primary></indexterm> | 
|---|
| 944 | <indexterm><primary>default shells</primary></indexterm> | 
|---|
| 945 | The function <command>getent</command> can now be used to get unified lists of both local and PDC users and | 
|---|
| 946 | groups. Try the following command: | 
|---|
| 947 | <screen> | 
|---|
| 948 | &rootprompt;<userinput>getent passwd</userinput> | 
|---|
| 949 | </screen> | 
|---|
| 950 | You should get a list that looks like your <filename>/etc/passwd</filename> | 
|---|
| 951 | list followed by the domain users with their new UIDs, GIDs, home | 
|---|
| 952 | directories, and default shells. | 
|---|
| 953 | </para> | 
|---|
| 954 |  | 
|---|
| 955 | <para> | 
|---|
| 956 | The same thing can be done for groups with the command: | 
|---|
| 957 | <screen> | 
|---|
| 958 | &rootprompt;<userinput>getent group</userinput> | 
|---|
| 959 | </screen> | 
|---|
| 960 | </para> | 
|---|
| 961 |  | 
|---|
| 962 | </sect3> | 
|---|
| 963 |  | 
|---|
| 964 |  | 
|---|
| 965 | <sect3> | 
|---|
| 966 | <title>Fix the init.d Startup Scripts</title> | 
|---|
| 967 |  | 
|---|
| 968 | <sect4> | 
|---|
| 969 | <title>Linux</title> | 
|---|
| 970 |  | 
|---|
| 971 | <para> | 
|---|
| 972 | <indexterm><primary>winbindd daemon</primary></indexterm> | 
|---|
| 973 | <indexterm><primary>smbd</primary></indexterm> | 
|---|
| 974 | <indexterm><primary>nmbd</primary></indexterm> | 
|---|
| 975 | <indexterm><primary>/etc/init.d/smb</primary></indexterm> | 
|---|
| 976 | <indexterm><primary>/etc/init.d/samba</primary></indexterm> | 
|---|
| 977 | <indexterm><primary>/usr/local/samba/bin</primary></indexterm> | 
|---|
| 978 | The &winbindd; daemon needs to start up after the &smbd; and &nmbd; daemons are running.  To accomplish this | 
|---|
| 979 | task, you need to modify the startup scripts of your system.  They are located at | 
|---|
| 980 | <filename>/etc/init.d/smb</filename> in Red Hat Linux and in <filename>/etc/init.d/samba</filename> in Debian | 
|---|
| 981 | Linux. Edit your script to add commands to invoke this daemon in the proper sequence. My startup script starts | 
|---|
| 982 | up &smbd;, &nmbd;, and &winbindd; from the <filename>/usr/local/samba/bin</filename> directory directly. The | 
|---|
| 983 | <command>start</command> function in the script looks like this: | 
|---|
| 984 | <programlisting> | 
|---|
| 985 | start() { | 
|---|
| 986 | KIND="SMB" | 
|---|
| 987 | echo -n $"Starting $KIND services: " | 
|---|
| 988 | daemon /usr/local/samba/bin/smbd $SMBDOPTIONS | 
|---|
| 989 | RETVAL=$? | 
|---|
| 990 | echo | 
|---|
| 991 | KIND="NMB" | 
|---|
| 992 | echo -n $"Starting $KIND services: " | 
|---|
| 993 | daemon /usr/local/samba/bin/nmbd $NMBDOPTIONS | 
|---|
| 994 | RETVAL2=$? | 
|---|
| 995 | echo | 
|---|
| 996 | KIND="Winbind" | 
|---|
| 997 | echo -n $"Starting $KIND services: " | 
|---|
| 998 | daemon /usr/local/samba/sbin/winbindd | 
|---|
| 999 | RETVAL3=$? | 
|---|
| 1000 | echo | 
|---|
| 1001 | [ $RETVAL -eq 0 -a $RETVAL2 -eq 0 -a $RETVAL3 -eq 0 ] && \ | 
|---|
| 1002 | touch /var/lock/subsys/smb || RETVAL=1 | 
|---|
| 1003 | return $RETVAL | 
|---|
| 1004 | } | 
|---|
| 1005 | </programlisting></para> | 
|---|
| 1006 |  | 
|---|
| 1007 | <para>If you would like to run winbindd in dual daemon mode, replace the line: | 
|---|
| 1008 | <programlisting> | 
|---|
| 1009 | daemon /usr/local/samba/sbin/winbindd | 
|---|
| 1010 | </programlisting> | 
|---|
| 1011 |  | 
|---|
| 1012 | in the example above with: | 
|---|
| 1013 |  | 
|---|
| 1014 | <programlisting> | 
|---|
| 1015 | daemon /usr/local/samba/sbin/winbindd -D | 
|---|
| 1016 | </programlisting>. | 
|---|
| 1017 | </para> | 
|---|
| 1018 |  | 
|---|
| 1019 | <para> | 
|---|
| 1020 | The <command>stop</command> function has a corresponding entry to shut down the services and looks like this: | 
|---|
| 1021 | </para> | 
|---|
| 1022 |  | 
|---|
| 1023 | <para><programlisting> | 
|---|
| 1024 | stop() { | 
|---|
| 1025 | KIND="SMB" | 
|---|
| 1026 | echo -n $"Shutting down $KIND services: " | 
|---|
| 1027 | killproc smbd | 
|---|
| 1028 | RETVAL=$? | 
|---|
| 1029 | echo | 
|---|
| 1030 | KIND="NMB" | 
|---|
| 1031 | echo -n $"Shutting down $KIND services: " | 
|---|
| 1032 | killproc nmbd | 
|---|
| 1033 | RETVAL2=$? | 
|---|
| 1034 | echo | 
|---|
| 1035 | KIND="Winbind" | 
|---|
| 1036 | echo -n $"Shutting down $KIND services: " | 
|---|
| 1037 | killproc winbindd | 
|---|
| 1038 | RETVAL3=$? | 
|---|
| 1039 | [ $RETVAL -eq 0 -a $RETVAL2 -eq 0 -a $RETVAL3 -eq 0 ] && \ | 
|---|
| 1040 | rm -f /var/lock/subsys/smb | 
|---|
| 1041 | echo "" | 
|---|
| 1042 | return $RETVAL | 
|---|
| 1043 | } | 
|---|
| 1044 | </programlisting></para> | 
|---|
| 1045 | </sect4> | 
|---|
| 1046 |  | 
|---|
| 1047 | <sect4> | 
|---|
| 1048 | <title>Solaris</title> | 
|---|
| 1049 |  | 
|---|
| 1050 | <para> | 
|---|
| 1051 | Winbind does not work on Solaris 9; see <link linkend="winbind-solaris9">Winbind on Solaris 9 section</link> | 
|---|
| 1052 | for details. | 
|---|
| 1053 | </para> | 
|---|
| 1054 |  | 
|---|
| 1055 | <para> | 
|---|
| 1056 | <indexterm><primary>Solaris 9</primary></indexterm> | 
|---|
| 1057 | <indexterm><primary>/etc/init.d/samba.server</primary></indexterm> | 
|---|
| 1058 | <indexterm><primary>/usr/local/samba/bin</primary></indexterm> | 
|---|
| 1059 | <indexterm><primary>smbd</primary></indexterm> | 
|---|
| 1060 | <indexterm><primary>nmbd</primary></indexterm> | 
|---|
| 1061 | <indexterm><primary>winbindd</primary></indexterm> | 
|---|
| 1062 | On Solaris, you need to modify the <filename>/etc/init.d/samba.server</filename> startup script. It | 
|---|
| 1063 | usually only starts smbd and nmbd but should now start winbindd, too. If you have Samba installed in | 
|---|
| 1064 | <filename>/usr/local/samba/bin</filename>, the file could contains something like this: | 
|---|
| 1065 | </para> | 
|---|
| 1066 |  | 
|---|
| 1067 | <para> | 
|---|
| 1068 | <programlisting> | 
|---|
| 1069 | ## | 
|---|
| 1070 | ## samba.server | 
|---|
| 1071 | ## | 
|---|
| 1072 |  | 
|---|
| 1073 | if [ ! -d /usr/bin ] | 
|---|
| 1074 | then                    # /usr not mounted | 
|---|
| 1075 | exit | 
|---|
| 1076 | fi | 
|---|
| 1077 |  | 
|---|
| 1078 | killproc() {            # kill the named process(es) | 
|---|
| 1079 | pid=`/usr/bin/ps -e | | 
|---|
| 1080 | /usr/bin/grep -w $1 | | 
|---|
| 1081 | /usr/bin/sed -e 's/^  *//' -e 's/ .*//'` | 
|---|
| 1082 | [ "$pid" != "" ] && kill $pid | 
|---|
| 1083 | } | 
|---|
| 1084 |  | 
|---|
| 1085 | # Start/stop processes required for Samba server | 
|---|
| 1086 |  | 
|---|
| 1087 | case "$1" in | 
|---|
| 1088 |  | 
|---|
| 1089 | 'start') | 
|---|
| 1090 | # | 
|---|
| 1091 | # Edit these lines to suit your installation (paths, workgroup, host) | 
|---|
| 1092 | # | 
|---|
| 1093 | echo Starting SMBD | 
|---|
| 1094 | /usr/local/samba/bin/smbd -D -s \ | 
|---|
| 1095 | /usr/local/samba/smb.conf | 
|---|
| 1096 |  | 
|---|
| 1097 | echo Starting NMBD | 
|---|
| 1098 | /usr/local/samba/bin/nmbd -D -l \ | 
|---|
| 1099 | /usr/local/samba/var/log -s /usr/local/samba/smb.conf | 
|---|
| 1100 |  | 
|---|
| 1101 | echo Starting Winbind Daemon | 
|---|
| 1102 | /usr/local/samba/sbin/winbindd | 
|---|
| 1103 | ;; | 
|---|
| 1104 |  | 
|---|
| 1105 | 'stop') | 
|---|
| 1106 | killproc nmbd | 
|---|
| 1107 | killproc smbd | 
|---|
| 1108 | killproc winbindd | 
|---|
| 1109 | ;; | 
|---|
| 1110 |  | 
|---|
| 1111 | *) | 
|---|
| 1112 | echo "Usage: /etc/init.d/samba.server { start | stop }" | 
|---|
| 1113 | ;; | 
|---|
| 1114 | esac | 
|---|
| 1115 | </programlisting></para> | 
|---|
| 1116 |  | 
|---|
| 1117 | <para> | 
|---|
| 1118 | Again, if you would like to run winbindd in dual daemon mode, replace: | 
|---|
| 1119 | <programlisting> | 
|---|
| 1120 | /usr/local/samba/sbin/winbindd | 
|---|
| 1121 | </programlisting> | 
|---|
| 1122 | in the script above with: | 
|---|
| 1123 | <programlisting> | 
|---|
| 1124 | /usr/local/samba/sbin/winbindd -D | 
|---|
| 1125 | </programlisting> | 
|---|
| 1126 | </para> | 
|---|
| 1127 |  | 
|---|
| 1128 | </sect4> | 
|---|
| 1129 |  | 
|---|
| 1130 | <sect4> | 
|---|
| 1131 | <title>Restarting</title> | 
|---|
| 1132 | <para> | 
|---|
| 1133 | <indexterm><primary>daemons</primary></indexterm> | 
|---|
| 1134 | <indexterm><primary>local user</primary></indexterm> | 
|---|
| 1135 | If you restart the &smbd;, &nmbd;, and &winbindd; daemons at this point, you | 
|---|
| 1136 | should be able to connect to the Samba server as a domain member just as | 
|---|
| 1137 | if you were a local user. | 
|---|
| 1138 | </para> | 
|---|
| 1139 | </sect4> | 
|---|
| 1140 | </sect3> | 
|---|
| 1141 |  | 
|---|
| 1142 | <sect3> | 
|---|
| 1143 | <title>Configure Winbind and PAM</title> | 
|---|
| 1144 |  | 
|---|
| 1145 | <para> | 
|---|
| 1146 | <indexterm><primary>winbindd</primary></indexterm> | 
|---|
| 1147 | <indexterm><primary>authentication</primary></indexterm> | 
|---|
| 1148 | <indexterm><primary>PAM</primary></indexterm> | 
|---|
| 1149 | <indexterm><primary>/etc/pam.d</primary></indexterm> | 
|---|
| 1150 | If you have made it this far, you know that <command>winbindd</command> and Samba are working together. If you | 
|---|
| 1151 | want to use Winbind to provide authentication for other services, keep reading. The PAM configuration files | 
|---|
| 1152 | need to be altered in this step. (Did you remember to make backups of your original | 
|---|
| 1153 | <filename>/etc/pam.d</filename> files? If not, do it now.) | 
|---|
| 1154 | </para> | 
|---|
| 1155 |  | 
|---|
| 1156 | <para> | 
|---|
| 1157 | <indexterm><primary>NSS</primary></indexterm> | 
|---|
| 1158 | <indexterm><primary>../source/nsswitch</primary></indexterm> | 
|---|
| 1159 | <indexterm><primary>pam_winbind.so</primary></indexterm> | 
|---|
| 1160 | <indexterm><primary>/lib/security</primary></indexterm> | 
|---|
| 1161 | <indexterm><primary>Solaris</primary></indexterm> | 
|---|
| 1162 | <indexterm><primary>/usr/lib/security</primary></indexterm> | 
|---|
| 1163 | You will need a PAM module to use winbindd with these other services. This module will be compiled in the | 
|---|
| 1164 | <filename>../source/nsswitch</filename> directory by invoking the command: | 
|---|
| 1165 | <screen> | 
|---|
| 1166 | &rootprompt;<userinput>make nsswitch/pam_winbind.so</userinput> | 
|---|
| 1167 | </screen> | 
|---|
| 1168 | from the <filename>../source</filename> directory. The <filename>pam_winbind.so</filename> file should be | 
|---|
| 1169 | copied to the location of your other PAM security modules. On my Red Hat system, this was the | 
|---|
| 1170 | <filename>/lib/security</filename> directory. On Solaris, the PAM security modules reside in | 
|---|
| 1171 | <filename>/usr/lib/security</filename>. | 
|---|
| 1172 | <screen> | 
|---|
| 1173 | &rootprompt;<userinput>cp ../samba/source/nsswitch/pam_winbind.so /lib/security</userinput> | 
|---|
| 1174 | </screen> | 
|---|
| 1175 | </para> | 
|---|
| 1176 |  | 
|---|
| 1177 | <sect4> | 
|---|
| 1178 | <title>Linux/FreeBSD-Specific PAM Configuration</title> | 
|---|
| 1179 |  | 
|---|
| 1180 | <para> | 
|---|
| 1181 | <indexterm><primary>/etc/pam.d/samba</primary></indexterm> | 
|---|
| 1182 | The <filename>/etc/pam.d/samba</filename> file does not need to be changed. I just left this file as it was: | 
|---|
| 1183 | <programlisting> | 
|---|
| 1184 | auth    required  /lib/security/pam_stack.so service=system-auth | 
|---|
| 1185 | account required  /lib/security/pam_stack.so service=system-auth | 
|---|
| 1186 | </programlisting></para> | 
|---|
| 1187 |  | 
|---|
| 1188 | <para> | 
|---|
| 1189 | <indexterm><primary>Winbind</primary></indexterm> | 
|---|
| 1190 | <indexterm><primary>authentication service</primary></indexterm> | 
|---|
| 1191 | <indexterm><primary>login</primary></indexterm> | 
|---|
| 1192 | <indexterm><primary>console</primary></indexterm> | 
|---|
| 1193 | <indexterm><primary>telnet logins</primary></indexterm> | 
|---|
| 1194 | <indexterm><primary>ftp service</primary></indexterm> | 
|---|
| 1195 | <indexterm><primary>/etc/xinetd.d</primary></indexterm> | 
|---|
| 1196 | <indexterm><primary>/etc/inetd.conf</primary></indexterm> | 
|---|
| 1197 | <indexterm><primary>/etc/xinetd.d/telnet</primary></indexterm> | 
|---|
| 1198 | The other services that I modified to allow the use of Winbind as an authentication service were the normal | 
|---|
| 1199 | login on the console (or a terminal session), telnet logins, and ftp service. In order to enable these | 
|---|
| 1200 | services, you may first need to change the entries in <filename>/etc/xinetd.d</filename> (or | 
|---|
| 1201 | <filename>/etc/inetd.conf</filename>).  Red Hat Linux 7.1 and later uses the new xinetd.d structure, in this | 
|---|
| 1202 | case you need to change the lines in <filename>/etc/xinetd.d/telnet</filename> and | 
|---|
| 1203 | <filename>/etc/xinetd.d/wu-ftp</filename> from: | 
|---|
| 1204 | <programlisting> | 
|---|
| 1205 | enable = no | 
|---|
| 1206 | </programlisting> | 
|---|
| 1207 | to | 
|---|
| 1208 | <programlisting> | 
|---|
| 1209 | enable = yes | 
|---|
| 1210 | </programlisting></para> | 
|---|
| 1211 |  | 
|---|
| 1212 | <para> | 
|---|
| 1213 | <indexterm><primary>ftp services</primary></indexterm> | 
|---|
| 1214 | <indexterm><primary>home directory template</primary></indexterm> | 
|---|
| 1215 | <indexterm><primary>domain users</primary></indexterm> | 
|---|
| 1216 | For ftp services to work properly, you will also need to either have individual directories for the domain | 
|---|
| 1217 | users already present on the server or change the home directory template to a general directory for all | 
|---|
| 1218 | domain users. These can be easily set using the &smb.conf; global entry <smbconfoption name="template | 
|---|
| 1219 | homedir"/>. | 
|---|
| 1220 | </para> | 
|---|
| 1221 |  | 
|---|
| 1222 | <note><para> | 
|---|
| 1223 | <indexterm><primary>pam_mkhomedir</primary></indexterm> | 
|---|
| 1224 | The directory in <smbconfoption name="template homedir"/> is not created automatically! Use pam_mkhomedir or | 
|---|
| 1225 | pre-create the directories of users to make sure users can log in on UNIX with their own home directory. | 
|---|
| 1226 | </para></note> | 
|---|
| 1227 |  | 
|---|
| 1228 | <para> | 
|---|
| 1229 | <indexterm><primary>/etc/pam.d/ftp</primary></indexterm> | 
|---|
| 1230 | <indexterm><primary>Winbind</primary></indexterm> | 
|---|
| 1231 | <indexterm><primary>ftp access</primary></indexterm> | 
|---|
| 1232 | The <filename>/etc/pam.d/ftp</filename> file can be changed to allow Winbind ftp access in a manner similar to | 
|---|
| 1233 | the <filename>/etc/pam.d/samba</filename>Samba file. My <filename>/etc/pam.d/ftp</filename> file was changed to look like this: | 
|---|
| 1234 | <programlisting> | 
|---|
| 1235 | auth       required     /lib/security/pam_listfile.so item=user sense=deny \ | 
|---|
| 1236 | file=/etc/ftpusers onerr=succeed | 
|---|
| 1237 | auth       sufficient   /lib/security/pam_winbind.so | 
|---|
| 1238 | auth       required     /lib/security/pam_stack.so service=system-auth | 
|---|
| 1239 | auth       required     /lib/security/pam_shells.so | 
|---|
| 1240 | account    sufficient   /lib/security/pam_winbind.so | 
|---|
| 1241 | account    required     /lib/security/pam_stack.so service=system-auth | 
|---|
| 1242 | session    required     /lib/security/pam_stack.so service=system-auth | 
|---|
| 1243 | </programlisting></para> | 
|---|
| 1244 |  | 
|---|
| 1245 | <para> | 
|---|
| 1246 | <indexterm><primary>/etc/pam.d/login</primary></indexterm> | 
|---|
| 1247 | The <filename>/etc/pam.d/login</filename> file can be changed in nearly the same way. It now looks like this: | 
|---|
| 1248 | <programlisting> | 
|---|
| 1249 | auth       required     /lib/security/pam_securetty.so | 
|---|
| 1250 | auth       sufficient   /lib/security/pam_winbind.so | 
|---|
| 1251 | auth       sufficient   /lib/security/pam_unix.so use_first_pass | 
|---|
| 1252 | auth       required     /lib/security/pam_stack.so service=system-auth | 
|---|
| 1253 | auth       required     /lib/security/pam_nologin.so | 
|---|
| 1254 | account    sufficient   /lib/security/pam_winbind.so | 
|---|
| 1255 | account    required     /lib/security/pam_stack.so service=system-auth | 
|---|
| 1256 | password   required     /lib/security/pam_stack.so service=system-auth | 
|---|
| 1257 | session    required     /lib/security/pam_stack.so service=system-auth | 
|---|
| 1258 | session    optional     /lib/security/pam_console.so | 
|---|
| 1259 | </programlisting> | 
|---|
| 1260 | <indexterm><primary>pam_winbind.so</primary></indexterm> | 
|---|
| 1261 | <indexterm><primary>pam_securetty.so</primary></indexterm> | 
|---|
| 1262 | <indexterm><primary>pam_unix.so</primary></indexterm> | 
|---|
| 1263 | In this case, I added the <programlisting>auth sufficient /lib/security/pam_winbind.so</programlisting> lines | 
|---|
| 1264 | as before, but also added the <programlisting>required pam_securetty.so</programlisting> above it to disallow | 
|---|
| 1265 | root logins over the network. I also added a <programlisting>sufficient /lib/security/pam_unix.so | 
|---|
| 1266 | use_first_pass</programlisting> line after the <command>winbind.so</command> line to get rid of annoying | 
|---|
| 1267 | double prompts for passwords. | 
|---|
| 1268 | </para> | 
|---|
| 1269 |  | 
|---|
| 1270 | </sect4> | 
|---|
| 1271 |  | 
|---|
| 1272 | <sect4> | 
|---|
| 1273 | <title>Solaris-Specific Configuration</title> | 
|---|
| 1274 |  | 
|---|
| 1275 | <para> | 
|---|
| 1276 | <indexterm><primary>/etc/pam.conf</primary></indexterm> | 
|---|
| 1277 | <indexterm><primary></primary></indexterm> | 
|---|
| 1278 | The <filename>/etc/pam.conf</filename> needs to be changed. I changed this file so my Domain | 
|---|
| 1279 | users can log on both locally as well as with telnet. The following are the changes | 
|---|
| 1280 | that I made. You can customize the <filename>pam.conf</filename> file as per your requirements, but | 
|---|
| 1281 | be sure of those changes because in the worst case it will leave your system | 
|---|
| 1282 | nearly impossible to boot. | 
|---|
| 1283 | <programlisting> | 
|---|
| 1284 | # | 
|---|
| 1285 | #ident "@(#)pam.conf 1.14 99/09/16 SMI" | 
|---|
| 1286 | # | 
|---|
| 1287 | # Copyright (c) 1996-1999, Sun Microsystems, Inc. | 
|---|
| 1288 | # All Rights Reserved. | 
|---|
| 1289 | # | 
|---|
| 1290 | # PAM configuration | 
|---|
| 1291 | # | 
|---|
| 1292 | # Authentication management | 
|---|
| 1293 | # | 
|---|
| 1294 | login   auth required   /usr/lib/security/pam_winbind.so | 
|---|
| 1295 | login auth required  /usr/lib/security/$ISA/pam_unix.so.1 try_first_pass | 
|---|
| 1296 | login auth required  /usr/lib/security/$ISA/pam_dial_auth.so.1 try_first_pass | 
|---|
| 1297 | # | 
|---|
| 1298 | rlogin  auth sufficient /usr/lib/security/pam_winbind.so | 
|---|
| 1299 | rlogin  auth sufficient /usr/lib/security/$ISA/pam_rhosts_auth.so.1 | 
|---|
| 1300 | rlogin auth required  /usr/lib/security/$ISA/pam_unix.so.1 try_first_pass | 
|---|
| 1301 | # | 
|---|
| 1302 | dtlogin auth sufficient /usr/lib/security/pam_winbind.so | 
|---|
| 1303 | dtlogin auth required  /usr/lib/security/$ISA/pam_unix.so.1 try_first_pass | 
|---|
| 1304 | # | 
|---|
| 1305 | rsh auth required /usr/lib/security/$ISA/pam_rhosts_auth.so.1 | 
|---|
| 1306 | other   auth sufficient /usr/lib/security/pam_winbind.so | 
|---|
| 1307 | other auth required /usr/lib/security/$ISA/pam_unix.so.1 try_first_pass | 
|---|
| 1308 | # | 
|---|
| 1309 | # Account management | 
|---|
| 1310 | # | 
|---|
| 1311 | login   account sufficient      /usr/lib/security/pam_winbind.so | 
|---|
| 1312 | login account requisite /usr/lib/security/$ISA/pam_roles.so.1 | 
|---|
| 1313 | login account required /usr/lib/security/$ISA/pam_unix.so.1 | 
|---|
| 1314 | # | 
|---|
| 1315 | dtlogin account sufficient      /usr/lib/security/pam_winbind.so | 
|---|
| 1316 | dtlogin account requisite /usr/lib/security/$ISA/pam_roles.so.1 | 
|---|
| 1317 | dtlogin account required /usr/lib/security/$ISA/pam_unix.so.1 | 
|---|
| 1318 | # | 
|---|
| 1319 | other   account sufficient      /usr/lib/security/pam_winbind.so | 
|---|
| 1320 | other account requisite /usr/lib/security/$ISA/pam_roles.so.1 | 
|---|
| 1321 | other account required /usr/lib/security/$ISA/pam_unix.so.1 | 
|---|
| 1322 | # | 
|---|
| 1323 | # Session management | 
|---|
| 1324 | # | 
|---|
| 1325 | other session required /usr/lib/security/$ISA/pam_unix.so.1 | 
|---|
| 1326 | # | 
|---|
| 1327 | # Password management | 
|---|
| 1328 | # | 
|---|
| 1329 | #other   password sufficient     /usr/lib/security/pam_winbind.so | 
|---|
| 1330 | other password required /usr/lib/security/$ISA/pam_unix.so.1 | 
|---|
| 1331 | dtsession auth required /usr/lib/security/$ISA/pam_unix.so.1 | 
|---|
| 1332 | # | 
|---|
| 1333 | # Support for Kerberos V5 authentication (uncomment to use Kerberos) | 
|---|
| 1334 | # | 
|---|
| 1335 | #rlogin auth optional /usr/lib/security/$ISA/pam_krb5.so.1 try_first_pass | 
|---|
| 1336 | #login auth optional /usr/lib/security/$ISA/pam_krb5.so.1 try_first_pass | 
|---|
| 1337 | #dtlogin auth optional /usr/lib/security/$ISA/pam_krb5.so.1 try_first_pass | 
|---|
| 1338 | #other auth optional /usr/lib/security/$ISA/pam_krb5.so.1 try_first_pass | 
|---|
| 1339 | #dtlogin account optional /usr/lib/security/$ISA/pam_krb5.so.1 | 
|---|
| 1340 | #other account optional /usr/lib/security/$ISA/pam_krb5.so.1 | 
|---|
| 1341 | #other session optional /usr/lib/security/$ISA/pam_krb5.so.1 | 
|---|
| 1342 | #other password optional /usr/lib/security/$ISA/pam_krb5.so.1 try_first_pass | 
|---|
| 1343 | </programlisting></para> | 
|---|
| 1344 |  | 
|---|
| 1345 | <para> | 
|---|
| 1346 | <indexterm><primary>winbind.so</primary></indexterm> | 
|---|
| 1347 | I also added a <parameter>try_first_pass</parameter> line after the <filename>winbind.so</filename> | 
|---|
| 1348 | line to get rid of annoying double prompts for passwords. | 
|---|
| 1349 | </para> | 
|---|
| 1350 |  | 
|---|
| 1351 | <para> | 
|---|
| 1352 | Now restart your Samba and try connecting through your application that you | 
|---|
| 1353 | configured in the pam.conf. | 
|---|
| 1354 | </para> | 
|---|
| 1355 |  | 
|---|
| 1356 | </sect4> | 
|---|
| 1357 |  | 
|---|
| 1358 | </sect3> | 
|---|
| 1359 |  | 
|---|
| 1360 | </sect2> | 
|---|
| 1361 |  | 
|---|
| 1362 | </sect1> | 
|---|
| 1363 |  | 
|---|
| 1364 | <sect1> | 
|---|
| 1365 | <title>Conclusion</title> | 
|---|
| 1366 |  | 
|---|
| 1367 | <para> | 
|---|
| 1368 | <indexterm><primary>Winbind</primary></indexterm> | 
|---|
| 1369 | <indexterm><primary>NSS</primary></indexterm> | 
|---|
| 1370 | <indexterm><primary>PAM</primary></indexterm> | 
|---|
| 1371 | <indexterm><primary>RPC calls</primary></indexterm> | 
|---|
| 1372 | <indexterm><primary>domain users</primary></indexterm> | 
|---|
| 1373 | The Winbind system, through the use of the NSS, PAMs, and appropriate Microsoft RPC calls, have allowed us to | 
|---|
| 1374 | provide seamless integration of Microsoft Windows NT domain users on a UNIX system. The result is a great | 
|---|
| 1375 | reduction in the administrative cost of running a mixed UNIX and NT network. | 
|---|
| 1376 | </para> | 
|---|
| 1377 |  | 
|---|
| 1378 | </sect1> | 
|---|
| 1379 |  | 
|---|
| 1380 | <sect1> | 
|---|
| 1381 | <title>Common Errors</title> | 
|---|
| 1382 |  | 
|---|
| 1383 | <para> | 
|---|
| 1384 | Winbind has a number of limitations in its current released version that we hope to overcome in future releases: | 
|---|
| 1385 | </para> | 
|---|
| 1386 |  | 
|---|
| 1387 | <itemizedlist> | 
|---|
| 1388 | <listitem><para> | 
|---|
| 1389 | Winbind is currently only available for the Linux, Solaris, AIX, and IRIX operating systems, although | 
|---|
| 1390 | ports to other operating systems are certainly possible. For such ports to be feasible, we require the C | 
|---|
| 1391 | library of the target operating system to support the NSS and PAM systems. This is becoming more common as NSS | 
|---|
| 1392 | and PAM gain support among UNIX vendors. | 
|---|
| 1393 | </para></listitem> | 
|---|
| 1394 |  | 
|---|
| 1395 | <listitem><para> | 
|---|
| 1396 | The mappings of Windows NT RIDs to UNIX IDs is not made algorithmically and depends on the order in | 
|---|
| 1397 | which unmapped users or groups are seen by Winbind. It may be difficult to recover the mappings of RID to UNIX | 
|---|
| 1398 | ID if the file containing this information is corrupted or destroyed. | 
|---|
| 1399 | </para></listitem> | 
|---|
| 1400 |  | 
|---|
| 1401 | <listitem><para> | 
|---|
| 1402 | Currently the Winbind PAM module does not take into account possible workstation and logon time | 
|---|
| 1403 | restrictions that may be set for Windows NT users; this is instead up to the PDC to enforce. | 
|---|
| 1404 | </para></listitem> | 
|---|
| 1405 | </itemizedlist> | 
|---|
| 1406 |  | 
|---|
| 1407 | <sect2> | 
|---|
| 1408 | <title>NSCD Problem Warning</title> | 
|---|
| 1409 |  | 
|---|
| 1410 | <warning><para> | 
|---|
| 1411 | Do not under any circumstances run <command>nscd</command> on any system | 
|---|
| 1412 | on which <command>winbindd</command> is running. | 
|---|
| 1413 | </para></warning> | 
|---|
| 1414 |  | 
|---|
| 1415 | <para> | 
|---|
| 1416 | If <command>nscd</command> is running on the UNIX/Linux system, then | 
|---|
| 1417 | even though NSSWITCH is correctly configured, it will not be possible to resolve | 
|---|
| 1418 | domain users and groups for file and directory controls. | 
|---|
| 1419 | </para> | 
|---|
| 1420 |  | 
|---|
| 1421 | </sect2> | 
|---|
| 1422 |  | 
|---|
| 1423 | <sect2> | 
|---|
| 1424 | <title>Winbind Is Not Resolving Users and Groups</title> | 
|---|
| 1425 |  | 
|---|
| 1426 | <para><quote> | 
|---|
| 1427 | My &smb.conf; file is correctly configured. I have specified <smbconfoption name="idmap uid">12000</smbconfoption>, | 
|---|
| 1428 | and <smbconfoption name="idmap gid">3000-3500</smbconfoption> and <command>winbind</command> is running. | 
|---|
| 1429 | When I do the following, it all works fine. | 
|---|
| 1430 | </quote></para> | 
|---|
| 1431 |  | 
|---|
| 1432 | <para><screen> | 
|---|
| 1433 | &rootprompt;<userinput>wbinfo -u</userinput> | 
|---|
| 1434 | MIDEARTH\maryo | 
|---|
| 1435 | MIDEARTH\jackb | 
|---|
| 1436 | MIDEARTH\ameds | 
|---|
| 1437 | ... | 
|---|
| 1438 | MIDEARTH\root | 
|---|
| 1439 |  | 
|---|
| 1440 | &rootprompt;<userinput>wbinfo -g</userinput> | 
|---|
| 1441 | MIDEARTH\Domain Users | 
|---|
| 1442 | MIDEARTH\Domain Admins | 
|---|
| 1443 | MIDEARTH\Domain Guests | 
|---|
| 1444 | ... | 
|---|
| 1445 | MIDEARTH\Accounts | 
|---|
| 1446 |  | 
|---|
| 1447 | &rootprompt;<userinput>getent passwd</userinput> | 
|---|
| 1448 | root:x:0:0:root:/root:/bin/bash | 
|---|
| 1449 | bin:x:1:1:bin:/bin:/bin/bash | 
|---|
| 1450 | ... | 
|---|
| 1451 | maryo:x:15000:15003:Mary Orville:/home/MIDEARTH/maryo:/bin/false | 
|---|
| 1452 | </screen></para> | 
|---|
| 1453 |  | 
|---|
| 1454 | <para><quote> | 
|---|
| 1455 | But the following command just fails: | 
|---|
| 1456 | </quote> | 
|---|
| 1457 | <screen> | 
|---|
| 1458 | &rootprompt;<userinput>chown maryo a_file</userinput> | 
|---|
| 1459 | chown: `maryo': invalid user | 
|---|
| 1460 | </screen> | 
|---|
| 1461 | <quote> | 
|---|
| 1462 | This is driving me nuts! What can be wrong? | 
|---|
| 1463 | </quote></para> | 
|---|
| 1464 |  | 
|---|
| 1465 | <para> | 
|---|
| 1466 | Same problem as the one above. | 
|---|
| 1467 | Your system is likely running <command>nscd</command>, the name service | 
|---|
| 1468 | caching daemon. Shut it down, do not restart it! You will find your problem resolved. | 
|---|
| 1469 | Alternately, fix the operation of nscd to resolve the problem. | 
|---|
| 1470 | </para> | 
|---|
| 1471 |  | 
|---|
| 1472 | </sect2> | 
|---|
| 1473 | </sect1> | 
|---|
| 1474 |  | 
|---|
| 1475 | </chapter> | 
|---|