f238e8e1b0c439b896fe7de9ced3bd57a4c445d4
[gd/samba-autobuild/.git] / docs / docbook / projdoc / SWAT.xml
1 <chapter id="SWAT">
2 <chapterinfo>
3         &author.jht;
4         <pubdate>April 21, 2003</pubdate>
5 </chapterinfo>
6
7 <title>SWAT - The Samba Web Admininistration Tool</title>
8
9 <para>
10 There are many and varied opinions regarding the usefulness or otherwise of SWAT.
11 No matter how hard one tries to produce the perfect configuration tool it remains
12 an object of personal taste. SWAT is a tool that will allow web based configuration
13 of samba. It has a wizard that may help to get samba configured quickly, it has context
14 sensitive help on each smb.conf parameter, it provides for monitoring of current state
15 of connection information, and it allows network wide MS Windows network password
16 management.
17 </para>
18
19 <sect1>
20 <title>SWAT Features and Benefits</title>
21
22 <para>
23 There are network administrators who believe that it is a good idea to write systems
24 documentation inside configuration files, for them SWAT will aways be a nasty tool. SWAT
25 does not store the configuration file in any intermediate form, rather, it stores only the
26 parameter settings, so when SWAT writes the smb.conf file to disk it will write only
27 those parameters that are at other than the default settings. The result is that all comments
28 will be lost from the smb.conf file. Additionally, the parameters will be written back in
29 internal ordering.
30 </para>
31
32 <note><para>
33 So before using SWAT please be warned - SWAT will completely replace your smb.conf with
34 a fully optimised file that has been stripped of all comments you might have placed there
35 and only non-default settings will be written to the file.
36 </para></note>
37
38 <sect2>
39 <title>Enabling SWAT for use</title>
40
41 <para>
42 SWAT should be installed to run via the network super daemon. Depending on which system
43 your Unix/Linux system has you will have either an <filename>inetd</filename> or
44 <filename>xinetd</filename> based system.
45 </para>
46
47 <para>
48 The nature and location of the network super-daemon varies with the operating system
49 implementation. The control file (or files) can be located in the file 
50 <filename>/etc/inetd.conf</filename> or in the directory <filename>/etc/[x]inet.d</filename>
51 or similar.
52 </para>
53
54 <para>
55 The control entry for the older style file might be:
56 </para>
57
58 <para><programlisting>
59         # swat is the Samba Web Administration Tool
60         swat stream tcp nowait.400 root /usr/sbin/swat swat
61 </programlisting></para>
62
63 <para>
64 A control file for the newer style xinetd could be:
65 </para>
66
67 <para>
68 <programlisting>
69         # default: off
70         # description: SWAT is the Samba Web Admin Tool. Use swat \
71         #              to configure your Samba server. To use SWAT, \
72         #              connect to port 901 with your favorite web browser.
73         service swat
74         {
75                 port    = 901
76                 socket_type     = stream
77                 wait    = no
78                 only_from = localhost
79                 user    = root
80                 server  = /usr/sbin/swat
81                 log_on_failure  += USERID
82                 disable = yes
83         }
84 </programlisting>
85
86 </para>
87
88 <para>
89 Both the above examples assume that the <filename>swat</filename> binary has been
90 located in the <filename>/usr/sbin</filename> directory. In addition to the above
91 SWAT will use a directory access point from which it will load it's help files
92 as well as other control information. The default location for this on most Linux
93 systems is in the directory <filename>/usr/share/samba/swat</filename>. The default
94 location using samba defaults will be <filename>/usr/local/samba/swat</filename>.
95 </para>
96
97 <para>
98 Access to SWAT will prompt for a logon. If you log onto SWAT as any non-root user
99 the only permission allowed is to view certain aspects of configuration as well as
100 access to the password change facility. The buttons that will be exposed to the non-root
101 user are: <emphasis>HOME, STATUS, VIEW, PASSWORD</emphasis>. The only page that allows
102 change capability in this case is <emphasis>PASSWORD</emphasis>.
103 </para>
104
105 <para>
106 So long as you log onto SWAT as the user <command>root</command> you should obtain
107 full change and commit ability. The buttons that will be exposed includes:
108 <emphasis>HOME, GLOBALS, SHARES, PRINTERS, WIZARD, STATUS, VIEW, PASSWORD</emphasis>.
109 </para>
110
111 </sect2>
112
113 <sect2>
114 <title>Securing SWAT through SSL</title>
115
116 <para>
117 Lots of people have asked about how to setup SWAT with SSL to allow for secure remote
118 administration of Samba. Here is a method that works, courtesy of Markus Krieger
119 </para>
120
121 <para>
122 Modifications to the swat setup are as following: 
123 </para>
124
125 <itemizedlist>
126         <listitem><para>
127         install OpenSSL 
128         </para></listitem>
129
130         <listitem><para>
131         generate certificate and private key
132
133         <programlisting>
134         root# /usr/bin/openssl req -new -x509 -days 365 -nodes -config \
135                 /usr/share/doc/packages/stunnel/stunnel.cnf \
136                 -out /etc/stunnel/stunnel.pem -keyout /etc/stunnel/stunnel.pem
137         </programlisting></para></listitem>
138
139         <listitem><para>
140         remove swat-entry from [x]inetd 
141         </para></listitem>
142
143         <listitem><para>
144         start stunnel
145
146         <programlisting>
147         root# stunnel -p /etc/stunnel/stunnel.pem -d 901 \
148                  -l /usr/local/samba/bin/swat swat 
149         </programlisting></para></listitem>
150 </itemizedlist>
151
152 <para>
153 afterwards simply contact to swat by using the URL "https://myhost:901", accept the certificate
154 and the SSL connection is up.
155 </para>
156
157 </sect2>
158
159 <sect2>
160 <title>The SWAT Home Page</title>
161
162 <para>
163 The SWAT title page provides access to the latest Samba documentation. The manual page for
164 each samba component is accessible from this page as are the Samba-HOWTO-Collection (this 
165 document) as well as the O'Reilly book "Using Samba".
166 </para>
167
168 <para>
169 Administrators who wish to validate their samba configuration may obtain useful information
170 from the man pages for the diganostic utilities. These are available from the SWAT home page
171 also. One diagnostic tool that is NOT mentioned on this page, but that is particularly
172 useful is <command>ethereal</command>, available from <ulink url="http://www.ethereal.com">
173 http://www.ethereal.com</ulink>.
174 </para>
175
176 <note><para>
177 SWAT can be configured to run in <emphasis>demo</emphasis> mode. This is NOT recommended
178 as it runs SWAT without authentication and with full administrative ability. ie: Allows
179 changes to smb.conf as well as general operation with root privilidges. The option that
180 creates this ability is the <command>-a</command> flag to swat. DO NOT USE THIS IN ANY
181 PRODUCTION ENVIRONMENT - you have been warned!
182 </para></note>
183
184 </sect2>
185
186 <sect2>
187 <title>Global Settings</title>
188
189 <para>
190 The Globals button will expose a page that allows configuration of the global parameters
191 in smb.conf. There are three levels of exposure of the parameters:
192 </para>
193
194 <itemizedlist>
195         <listitem><para>
196         <command>Basic</command> - exposes common configuration options.
197         </para></listitem>
198
199         <listitem><para>
200         <command>Advanced</command> - exposes  configuration options needed in more 
201         complex environments.
202         </para></listitem>
203
204         <listitem><para>
205         <command>Developer</command> - exposes configuration options that only the brave
206         will want to tamper with.
207         </para></listitem>
208 </itemizedlist>
209
210 <para>
211 To switch to other than <emphasis>Basic</emphasis> editing ability click on either the
212 <emphasis>Advanced</emphasis> or the <emphasis>Developer</emphasis> dial, then click the
213 <emphasis>Commit Changes</emphasis> button.
214 </para>
215
216 <para>
217 After making any changes to configuration parameters make sure that you click on the 
218 <emphasis>Commit Changes</emphasis> button before moving to another area otherwise
219 your changes will be immediately lost.
220 </para>
221
222 <note><para>
223 SWAT has context sensitive help. To find out what each parameter is for simply click the
224 <command>Help</command> link to the left of the configurartion parameter.
225 </para></note>
226
227 </sect2>
228
229 <sect2>
230 <title>Share Settings</title>
231
232 <para>
233 To affect a currenly configured share, simply click on the pull down button between the
234 <emphasis>Choose Share</emphasis> and the <emphasis>Delete Share</emphasis> buttons,
235 select the share you wish to operate on, then to edit the settings click on the
236 <emphasis>Choose Share</emphasis> button, to delete the share simply press the
237 <emphasis>Delete Share</emphasis> button.
238 </para>
239
240 <para>
241 To create a new share, next to the button labelled <emphasis>Create Share</emphasis> enter
242 into the text field the name of the share to be created, then click on the 
243 <emphasis>Create Share</emphasis> button.
244 </para>
245
246 </sect2>
247
248 <sect2>
249 <title>Printers Settings</title>
250
251 <para>
252 To affect a currenly configured printer, simply click on the pull down button between the
253 <emphasis>Choose Printer</emphasis> and the <emphasis>Delete Printer</emphasis> buttons,
254 select the printer you wish to operate on, then to edit the settings click on the
255 <emphasis>Choose Printer</emphasis> button, to delete the share simply press the
256 <emphasis>Delete Printer</emphasis> button.
257 </para>
258
259 <para>
260 To create a new printer, next to the button labelled <emphasis>Create Printer</emphasis> enter
261 into the text field the name of the share to be created, then click on the 
262 <emphasis>Create Printer</emphasis> button.
263 </para>
264
265 </sect2>
266
267 <sect2>
268 <title>The SWAT Wizard</title>
269
270 <para>
271 The purpose if the SWAT Wizard is to help the Microsoft knowledgable network administrator
272 to configure Samba with a minimum of effort.
273 </para>
274
275 <para>
276 The Wizard page provides a tool for rewiting the smb.conf file in fully optimised format.
277 This will also happen if you press the commit button. The two differ in the the rewrite button
278 ignores any changes that may have been made, while the Commit button causes all changes to be
279 affected.
280 </para>
281
282 <para>
283 The <emphasis>Edit</emphasis> button permits the editing (setting) of the minimal set of
284 options that may be necessary to create a working samba server.
285 </para>
286
287 <para>
288 Finally, there are a limited set of options that will determine what type of server samba
289 will be configured for, whether it will be a WINS server, participate as a WINS client, or
290 operate with no WINS support. By clicking on one button you can elect to epose (or not) user
291 home directories.
292 </para>
293
294 </sect2>
295
296 <sect2>
297 <title>The Status Page</title>
298
299 <para>
300 The status page serves a limited purpose. Firstly, it allows control of the samba daemons.
301 The key daemons that create the samba server environment are: <command> smbd, nmbd, winbindd</command>.
302 </para>
303
304 <para>
305 The daemons may be controlled individually or as a total group. Additionally, you may set
306 an automatic screen refresh timing. As MS Windows clients interact with Samba new smbd processes
307 will be continually spawned. The auto-refresh facility will allow you to track the changing
308 conditions with minimal effort.
309 </para>
310
311 <para>
312 Lastly, the Status page may be used to terminate specific smbd client connections in order to
313 free files that may be locked.
314 </para>
315
316 </sect2>
317
318 <sect2>
319 <title>The View Page</title>
320
321 <para>
322 This page allows the administrator to view the optimised smb.conf file and if you are
323 particularly massochistic will permit you also to see all possible global configuration
324 parameters and their settings.
325 </para>
326
327 </sect2>
328
329 <sect2>
330 <title>The Password Change Page</title>
331
332 <para>
333 The Password Change page is a popular tool. This tool allows the creation, deletion, deactivation
334 and reactivation of MS Windows networking users on the local machine. Alternatively, you can use
335 this tool to change a local password for a user account.
336 </para>
337
338 <para>
339 When logged in as a non-root account the user will have to provide the old password as well as
340 the new password (twice). When logged in as <command>root</command> only the new password is
341 required.
342 </para>
343
344 <para>
345 One popular use for this tool is to change user passwords across a range of remote MS Windows
346 servers.
347 </para>
348
349 </sect2>
350 </sect1>
351 </chapter>