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