merge from 2.2
[Samba/gbeck.git] / docs / textdocs / security_level.txt
blobf4e0df7139c0a132ffed017ebb5cb8a9df9a7657
1 Contributor:    Andrew Tridgell
2 Updated:        June 27, 1997
3 Status:         Current
5 Subject:        Description of SMB security levels.
6 ===========================================================================
8 Samba supports the following options to the global smb.conf parameter
9 "security =":
10         share, user, server
12 Note: Samba-2.0.0 now adds the "domain" security mode. Please refer to
13 the smb.conf man page for usage information and to the document
14 docs/textdocs/DOMAIN_MEMBER.txt for further background details.
16 Of the above, "security = server" means that Samba reports to clients that
17 it is running in "user mode" but actually passes off all authentication
18 requests to another "user mode" server. This requires an additional
19 parameter "password server =" that points to the real authentication server.
20 That real authentication server can be another Samba server or can be a
21 Windows NT server, the later natively capable of encrypted password support.
23 Below is a more complete description of security levels.
24 ===========================================================================
26 A SMB server tells the client at startup what "security level" it is
27 running. There are two options "share level" and "user level". Which
28 of these two the client receives affects the way the client then tries
29 to authenticate itself. It does not directly affect (to any great
30 extent) the way the Samba server does security. I know this is
31 strange, but it fits in with the client/server approach of SMB. In SMB
32 everything is initiated and controlled by the client, and the server
33 can only tell the client what is available and whether an action is
34 allowed. 
36 I'll describe user level security first, as its simpler. In user level
37 security the client will send a "session setup" command directly after
38 the protocol negotiation. This contains a username and password. The
39 server can either accept or reject that username/password
40 combination. Note that at this stage the server has no idea what
41 share the client will eventually try to connect to, so it can't base
42 the "accept/reject" on anything other than:
44 - the username/password
45 - the machine that the client is coming from
47 If the server accepts the username/password then the client expects to
48 be able to mount any share (using a "tree connection") without
49 specifying a password. It expects that all access rights will be as
50 the username/password specified in the "session setup". 
52 It is also possible for a client to send multiple "session setup"
53 requests. When the server responds it gives the client a "uid" to use
54 as an authentication tag for that username/password. The client can
55 maintain multiple authentication contexts in this way (WinDD is an
56 example of an application that does this)
59 Ok, now for share level security. In share level security the client
60 authenticates itself separately for each share. It will send a
61 password along with each "tree connection" (share mount). It does not
62 explicitly send a username with this operation. The client is
63 expecting a password to be associated with each share, independent of
64 the user. This means that samba has to work out what username the
65 client probably wants to use. It is never explicitly sent the
66 username. Some commercial SMB servers such as NT actually associate
67 passwords directly with shares in share level security, but samba
68 always uses the unix authentication scheme where it is a
69 username/password that is authenticated, not a "share/password".
71 Many clients send a "session setup" even if the server is in share
72 level security. They normally send a valid username but no
73 password. Samba records this username in a list of "possible
74 usernames". When the client then does a "tree connection" it also adds
75 to this list the name of the share they try to connect to (useful for
76 home directories) and any users listed in the "user =" smb.conf
77 line. The password is then checked in turn against these "possible
78 usernames". If a match is found then the client is authenticated as
79 that user.
81 Finally "server level" security. In server level security the samba
82 server reports to the client that it is in user level security. The
83 client then does a "session setup" as described earlier. The samba
84 server takes the username/password that the client sends and attempts
85 to login to the "password server" by sending exactly the same
86 username/password that it got from the client. If that server is in
87 user level security and accepts the password then samba accepts the
88 clients connection. This allows the samba server to use another SMB
89 server as the "password server". 
91 You should also note that at the very start of all this, where the
92 server tells the client what security level it is in, it also tells
93 the client if it supports encryption. If it does then it supplies the
94 client with a random "cryptkey". The client will then send all
95 passwords in encrypted form. You have to compile samba with encryption
96 enabled to support this feature, and you have to maintain a separate
97 smbpasswd file with SMB style encrypted passwords. It is
98 cryptographically impossible to translate from unix style encryption
99 to SMB style encryption, although there are some fairly simple management
100 schemes by which the two could be kept in sync.