This commit was manufactured by cvs2svn to create branch 'SAMBA_3_0'.
[sfrench/samba-autobuild/.git] / docs / docbook / projdoc / security_level.sgml
1 <chapter id="securitylevels">
2 <chapterinfo>
3         <author>
4                 <firstname>Andrew</firstname><surname>Tridgell</surname>
5                 <affiliation>
6                         <orgname>Samba Team</orgname>
7                         <address><email>samba@samba.org</email></address>
8                 </affiliation>
9         </author>
10 </chapterinfo>
11
12 <title>Security levels</title>
13
14 <sect1>
15 <title>Introduction</title>
16
17 <para>
18 Samba supports the following options to the global smb.conf parameter
19 </para>
20
21 <para><programlisting>
22 [global]
23 <ulink url="smb.conf.5.html#SECURITY"><parameter>security</parameter></ulink> = [share|user(default)|domain|ads]
24 </programlisting></para>
25
26 <para>
27 Please refer to the smb.conf man page for usage information and to the document
28 <ulink url="DOMAIN_MEMBER.html">DOMAIN_MEMBER.html</ulink> for further background details
29 on domain mode security.  The Windows 2000 Kerberos domain security model
30 (security = ads) is described in the <ulink url="ADS-HOWTO.html">ADS-HOWTO.html</ulink>.
31 </para>
32
33 <para>
34 Of the above, "security = server" means that Samba reports to clients that
35 it is running in "user mode" but actually passes off all authentication
36 requests to another "user mode" server. This requires an additional
37 parameter "password server =" that points to the real authentication server.
38 That real authentication server can be another Samba server or can be a
39 Windows NT server, the later natively capable of encrypted password support.
40 </para>
41
42 </sect1>
43
44 <sect1>
45 <title>More complete description of security levels</title>
46
47 <para>
48 A SMB server tells the client at startup what "security level" it is
49 running. There are two options "share level" and "user level". Which
50 of these two the client receives affects the way the client then tries
51 to authenticate itself. It does not directly affect (to any great
52 extent) the way the Samba server does security. I know this is
53 strange, but it fits in with the client/server approach of SMB. In SMB
54 everything is initiated and controlled by the client, and the server
55 can only tell the client what is available and whether an action is
56 allowed. 
57 </para>
58
59 <para>
60 I'll describe user level security first, as its simpler. In user level
61 security the client will send a "session setup" command directly after
62 the protocol negotiation. This contains a username and password. The
63 server can either accept or reject that username/password
64 combination. Note that at this stage the server has no idea what
65 share the client will eventually try to connect to, so it can't base
66 the "accept/reject" on anything other than:
67 </para>
68
69 <orderedlist>
70 <listitem><para>the username/password</para></listitem>
71 <listitem><para>the machine that the client is coming from</para></listitem>
72 </orderedlist>
73
74 <para>
75 If the server accepts the username/password then the client expects to
76 be able to mount any share (using a "tree connection") without
77 specifying a password. It expects that all access rights will be as
78 the username/password specified in the "session setup". 
79 </para>
80
81 <para>
82 It is also possible for a client to send multiple "session setup"
83 requests. When the server responds it gives the client a "uid" to use
84 as an authentication tag for that username/password. The client can
85 maintain multiple authentication contexts in this way (WinDD is an
86 example of an application that does this)
87 </para>
88
89 <para>
90 Ok, now for share level security. In share level security the client
91 authenticates itself separately for each share. It will send a
92 password along with each "tree connection" (share mount). It does not
93 explicitly send a username with this operation. The client is
94 expecting a password to be associated with each share, independent of
95 the user. This means that samba has to work out what username the
96 client probably wants to use. It is never explicitly sent the
97 username. Some commercial SMB servers such as NT actually associate
98 passwords directly with shares in share level security, but samba
99 always uses the unix authentication scheme where it is a
100 username/password that is authenticated, not a "share/password".
101 </para>
102
103 <para>
104 Many clients send a "session setup" even if the server is in share
105 level security. They normally send a valid username but no
106 password. Samba records this username in a list of "possible
107 usernames". When the client then does a "tree connection" it also adds
108 to this list the name of the share they try to connect to (useful for
109 home directories) and any users listed in the "user =" smb.conf
110 line. The password is then checked in turn against these "possible
111 usernames". If a match is found then the client is authenticated as
112 that user.
113 </para>
114
115 <para>
116 Finally "server level" security. In server level security the samba
117 server reports to the client that it is in user level security. The
118 client then does a "session setup" as described earlier. The samba
119 server takes the username/password that the client sends and attempts
120 to login to the "password server" by sending exactly the same
121 username/password that it got from the client. If that server is in
122 user level security and accepts the password then samba accepts the
123 clients connection. This allows the samba server to use another SMB
124 server as the "password server". 
125 </para>
126
127 <para>
128 You should also note that at the very start of all this, where the
129 server tells the client what security level it is in, it also tells
130 the client if it supports encryption. If it does then it supplies the
131 client with a random "cryptkey". The client will then send all
132 passwords in encrypted form. You have to compile samba with encryption
133 enabled to support this feature, and you have to maintain a separate
134 smbpasswd file with SMB style encrypted passwords. It is
135 cryptographically impossible to translate from unix style encryption
136 to SMB style encryption, although there are some fairly simple management
137 schemes by which the two could be kept in sync.
138 </para>
139 </sect1>
140 </chapter>