handbook22.xml

Eric Leblond, 03/02/2010 01:34 am

Download (96.6 )

 
1
<?xml version='1.0'?>
2
<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN" "http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd">
3
<book><title>NuFW Handbook</title>
4
  <bookinfo>
5
    <author>
6
      <firstname>Eric</firstname>
7
      <surname>Leblond</surname>
8
      <email>eric at inl dot fr</email>
9
    </author>
10
    <author>
11
      <firstname>Vincent</firstname>
12
      <surname>Deffontaines</surname>
13
      <email>gryzor at inl dot fr</email>
14
    </author>
15
    <author>
16
      <firstname>Pierre</firstname>
17
      <surname>Chifflier</surname>
18
      <email>chifflier at inl dot fr</email>
19
    </author>
20
    <copyright>
21
      <year>2005-2008</year>
22
      <holder>INL</holder>
23
    </copyright>
24
    <revhistory>
25
    <revision>
26
              <revnumber>1.0.3</revnumber>
27
        <date>2009/01/20</date>
28
        <revdescription>
29
        <para>Added a short note about OCSP support.</para>
30
        </revdescription>
31
    </revision>
32
    <revision>
33
              <revnumber>1.0.2</revnumber>
34
        <date>2008/12/10</date>
35
        <revdescription>
36
        <para>Updated the nuauth_command description. Synchronized nuauth and nufw output with current version in debug section.</para>
37
        </revdescription>
38
    </revision>
39
40
    <revision>
41
              <revnumber>1.0.1</revnumber>
42
        <date>2008/12/01</date>
43
        <revdescription>
44
        <para>Updated the recommended setup section, fixed image inclusions. Added a version choosing section. Better documentation for nuauth's user session disconnection.</para>
45
        </revdescription>
46
    </revision>
47
    <revision>
48
              <revnumber>1.0.0</revnumber>
49
        <date>2008/11/25</date>
50
        <revdescription>
51
        <para>This handbook is based on the original howto document, and has been dramatically enhanced (countless changes).</para>
52
        </revdescription>
53
    </revision>
54
    </revhistory>
55
  </bookinfo>
56
  <chapter><title>License</title>
57
  <para>
58
  This document is copyrighted by INL, and distributed under the Creative Commons <command>by-nc-sa</command> license. The full text of the license is available at  <ulink url="http://creativecommons.org/licenses/by-nc-sa/3.0/legalcode">http://creativecommons.org/licenses/by-nc-sa/3.0/legalcode</ulink>.
59
  </para>
60
  </chapter>
61
  <chapter><title>Introduction</title>
62
   <section><title>Presentation</title>
63
<para>
64
NuFW is an enterprise grade firewall that performs an authentication of every single connection passing through the IP filter, by transparently requesting user's credentials before any filtering decision is taken. Practically, this means security policies can integrate with the user directory, and bring the notion of user ID down to the IP layers.
65
66
NuFW lays on Netfilter, the state of the art IP filtering layer from the Linux kernel. It fully integrates with Netfilter and extends its capabilities.
67
68
The daemons currently run on Linux and software clients are available for Windows, Linux, FreeBSD et Mac OSX.
69
</para>
70
<para>
71
NuFW can:
72
<itemizedlist>
73
<listitem><para>
74
Authenticate any connection that goes through your gateway or only from/to a chosen subset or a specific protocol (iptables is used to select the connections to authenticate).</para></listitem>
75
<listitem><para>Perform accounting, routing and quality of service based on users and not simply on IP.</para></listitem>
76
<listitem><para> Filter packets with criteria such as application and OS used by remote users.</para></listitem>
77
<listitem><para> Be the key of a secure and simple Single Sign On system.</para></listitem>
78
</itemizedlist>
79
</para>
80
<para>
81
NuFW is composed of two daemons that can be put on different systems and the
82
main daemon nuauth is heavily multi-threaded.  nuauth uses loadable modules to
83
add features, like SQL logging, reporting alert to IDS using Prelude, etc.
84
</para>
85
   </section>
86
   <section><title>Architecture</title>
87
   <para>
88
    NuFW has very little needs in terms of architecture. It is a firewall, so it needs to be installed between the client and the server, concerning connections the admin wills to authenticate. In other words, if you look at the figure below, the requisite is that the firewall running NuFW is set between the client host (M) and the server (T). It doesn't matter whether you administrate the server (T) or whether it is a random host on the internet : NuFW authentication occurs at the time the firewall decision is taken for each connection.</para>
89
    <para>
90
    A very typical setup is to use NuFW on a central firewall, so that it can filter connections from LAN to DMZ, from LAN to Internet, from WAN to LAN, etc. Of course, this is no requisite and you can always chain NuFW with another implementation. Technically, NuFW has one requisite : no NAT should be applied on connections between the client and NuFW itself. If that occurs, NuFW authentication will not work. This can easily be turned around if you want to identify your users from the Internet, by setting up a VPN (road-warrior or network to network) tunnel.
91
    </para>
92
    <para>
93
    A typical architecture is as follows :
94
    <figure><title>NuFW Algorithm resume</title>
95
    <imageobject>
96
      <imagedata fileref="algorythm.png"/>
97
    </imageobject>
98
    </figure>
99
    <orderedlist>
100
      <listitem><para>A standard application sends a packet.</para></listitem>
101
      <listitem><para>The Nufw server queues the packet and sends an auth request packet to the Nuauth server.</para></listitem>
102
      <listitem><para>The Nuauth server sends to all nufw agents running on the client computer an authentication request.</para></listitem>
103
      <listitem><para>The Nufw client run by the user whose application sent traffic sees that a connection is being initiated and sends a user request packet. The Nuauth server sums the auth request and the user request packet and checks this against an authentication authority.</para></listitem>
104
      <listitem><para>The Nuauth server replies to the Nufw server accordingly.</para></listitem>
105
      <listitem><para>The Nufw server transmits the packet following the answer given to its request.</para></listitem>
106
      <listitem><para>The flow of the connection is handled by Netfilter's state table (the conntrack), like for any firewalling rule.</para></listitem>
107
    </orderedlist>
108
    </para>
109
    </section>
110
    <section><title>Requirements</title>
111
      <para>In this section, each invoked library will have to be installed and the
112
header files have to be in standard places (so <command>./configure</command> can
113
                find them).
114
</para>
115
      <section><title>General</title>
116
      <para>NuFW is an advanced network filtering solution. For logging, as well as for domain integrations, it is highly recommended that all servers hosting NuFW services (<command>nufw</command>, <command>nuauth</command>, <command>LDAP/Active Directory</command>, and <command>the logging server (SQLi/syslog/prelude)</command>) be time-synchronized with a protocol such as NTP. NuFW does not provide time synchronization per se.
117
      </para>
118
      </section>
119
      <section><title>Nuauth dependencies</title>
120
       <section><title>nuauth core daemon</title>
121
        <para>
122
nuauth dependencies are as follows:
123
<itemizedlist>
124
            <listitem><para><filename>libglib2.0</filename>: nuauth heavily uses this library which provides a set of very useful high level objects. It needs at least 2.4 release.</para></listitem>
125
            <listitem><para><filename>libgnutls</filename>: communications between components are encrypted using TLS v1</para></listitem>
126
            <listitem><para><filename>libsasl2</filename>: authentication is done via sasl</para></listitem>
127
            <listitem><para><filename>libtool</filename>: It's needed for the compilation of library and modules</para></listitem>
128
          </itemizedlist>
129
        <note><para>Be careful when choosing your GnuTLS version : old versions may contain security breaches. Check the <ulink url="http://www.gnu.org/software/gnutls/security.html">GnuTLS security advisories page</ulink> or make sure your distribution is reactive enough with updates.</para>
130
        </note>
131
</para>
132
      </section>
133
      <section><title>MySQL logging</title>
134
        <para>
135
The <filename>libmysqlclient</filename> library is required for compiling of this module.
136
</para>
137
      </section>
138
      <section><title>PostgreSQL logging</title>
139
        <para>
140
The <filename>libpq</filename> library is required for compiling this module.
141
</para>
142
      </section>
143
      <section><title>Prelude IDS alerts</title>
144
        <para>
145
The <filename>libprelude</filename> library is required for compiling this module.
146
Prelude allows for gathering security events at the scale of any organization, and NuFW can send Prelude the following events :
147
<itemizedlist>
148
<listitem><para>User authentication failures</para></listitem>
149
<listitem><para>User authentication successes</para></listitem>
150
<listitem><para>Start and end of user sessions</para></listitem>
151
<listitem><para>Start and end of authenticated connections</para></listitem>
152
<listitem><para>Rejected connections</para></listitem>
153
</itemizedlist>
154
NuFW is a native sensor for Prelude, allowing tight integration with any IDS based the IDMEF standard (RFC 4765).
155
156
All information about the Prelude project is available at <ulink url="http://prelude-ids.org/">http://prelude-ids.org</ulink>
157
        </para>
158
159
      </section>
160
161
      <section><title>LDAP authentication and acl check</title>
162
        <para>
163
<filename>libldap</filename> library is needed (version 2 or better).
164
</para>
165
      </section>
166
      </section>
167
      <section><title>nufw dependencies</title>
168
        <para>The nufw daemon only depends on:
169
<itemizedlist>
170
            <listitem><para><filename>iptables</filename>: <filename>libipq.a</filename> is necessary to compile the nufw server</para></listitem>
171
            <listitem><para><filename>libgnutls</filename>: nufw is connected to nuauth using a TLS encrypted channel</para></listitem>
172
          </itemizedlist>
173
</para>
174
      </section>
175
      <section><title>User marking requirement on old kernel</title>
176
        <para>
177
A system with a kernel prior to 2.6.14 needs a patched version of the ip_queue module and of
178
its "sibling" library libipq.
179
</para>
180
      </section>
181
      <section><title>Using nfnetlink and getting all latest NuFW features</title>
182
        <para>
183
On kernel superior to 2.6.14, ipq is now deprecated in favor of libnetfilter_queue which
184
uses the new nfnetlink system.
185
On top of that nfnetlink also provides libnetfilter_conntrack which is used by NuFW to implement
186
connection tracking, and strict time-based acls.
187
        </para>
188
        <para>To use this features, the following libraries are needed:
189
        <itemizedlist>
190
        <listitem><para>libnfnetlink</para></listitem>
191
        <listitem><para>libnetfilter_queue</para></listitem>
192
        <listitem><para>libnetfilter_conntrack</para></listitem>
193
        </itemizedlist>
194
        You can find working versions of these libraries at <ulink url="http://nufw.org/download/libs/index.html">http://nufw.org/download/libs/index.html</ulink>
195
        Debian packages are available at <ulink url="http://www.nufw.org/debian/">http://www.nufw.org/debian/</ulink>
196
        </para>
197
        <para>
198
If you plan to use NuFW time-based acls, it is best to use a kernel superior to 2.6.18 or
199
to apply patches provided on NuFW site.
200
        </para>
201
      </section>
202
    </section>
203
    <section><title>Recommended setup</title>
204
    <para>
205
    This section's aim is to provide the best practises to help admins start a NuFW installation.
206
    We recommend that you use :
207
    <itemizedlist>
208
     <listitem><para>A MySQL database for logs. Though nuauth as well as single sign on modules support PostgreSQL logging, NuLog PostgreSQL support should be considered experimental for now.</para></listitem>
209
     <listitem><para>A <command>NuLog</command> installation. This is not a formal requisite for setting up and using NuFW, but <ulink url="http://software.inl.fr/trac/wiki/EdenWall/NuLog">NuLog</ulink> is a great tool to keep track of what is going on on your firewall. It analyses data from a ulog SQL database.
210
    <figure><title>A Nulog screenshot</title>
211
    <imageobject>
212
      <imagedata fileref="nulog_scr.png"/>
213
    </imageobject>
214
    </figure>
215
     </para></listitem>
216
     <listitem><para>A <command>NuFace</command> installation. <ulink url="http://software.inl.fr/trac/wiki/EdenWall/NuFace">NuFace</ulink> is INL's tool to build consistent <command>Netfilter</command> + <command>nuauth</command> rules. You really should consider using <command>NuFace</command> unless you plan to write your own tool : dealing with filtering rules by hand can be tricky because you need to synchronise authenticating rules at <command>Netfilter</command> and <command>nuauth</command> levels.
217
    <figure><title>A NuFace screenshot</title>
218
    <imageobject>
219
      <imagedata fileref="nuface_scr.png"/>
220
    </imageobject>
221
    </figure>
222
     </para></listitem>
223
     <listitem><para>A <ulink url="http://www.netfilter.org/projects/ulogd/index.html">ulogd</ulink> daemon setup for Netfilter logging. Ulogd can log Netfilter flows into the same database as nuauth, in order to provide a consistent log for both authenticated and unauthenticated connections. For now we recommend you use ulogd in version 1.X. Ulogd should run on the same host as your <computeroutput>nufw</computeroutput> daemon, and log in the same MySQL database as nuauth. The <link linkend='mysql_log' endterm='mysql_log.title'/> section describes a MySQL installation.</para></listitem>
224
     <listitem><para>A user directory, supported by PAM. This means Active Directory, LDAP, Novell e-directory, and other directories are supported. This is actually a PAM matter, see section <link linkend='nuauth_auth' endterm="nuauth_auth.title"/> for details. A plaintext nuauth module exists for user authentication, but it should be used for quick testing only. We really advise you have nuauth lay on a user directory. For instance, adding/removing users from the plaintext file requires that you restart nuauth, while those changes are transparent if nuauth uses the <computeroutput>system</computeroutput> module.</para></listitem>
225
     <listitem><para>A LDAP (local) directory, to store nuauth ACLs. Again, user authentication can be setup on a plaintext file, but this means you will need to handle it by hand, with a text editor, and warranty that your nuauth rules are consistent with Netfilter rules. On the other hand, <ulink url="http://software.inl.fr/trac/wiki/EdenWall/NuFace">Nuface</ulink> can deal with both Netfilter and LDAP rules. Again, nuauth will need to be restarted if you make changes in the plaintext file, while the LDAP changes will apply on the fly. The LDAP ACL directory needs not formally be local, it can be hosted on any LDAP directory that <computeroutput>nuauth</computeroutput> can reach. See the <link linkend='LDAP_acls' endterm='LDAP_acls.title'/> section for details about how to setup your LDAP acl tree.</para></listitem>
226
    </itemizedlist>
227
    </para>
228
    </section>
229
    <section><title>How to choose your NuFW version</title>
230
      <section><title>Installing</title>
231
       <para>If you are installing NuFW from scratch, it is advised that you use the latest stable version. You should avoid distribution packages if they distribute old versions, especially if security upgrades have been notified in latest versions. NuFW security announces are always available at <ulink url="http://nufw.org/-Security-announces-.html">this URL</ulink>.
232
        <note><para>Up to date Debian packages are distributed by INL, and can be used on your Debian systems by setting :
233
         <screen>
234
          deb http://packages.inl.fr/ testing/
235
         </screen>
236
         or
237
         <screen>
238
          deb http://packages.inl.fr/ stable/
239
         </screen>
240
         to your <computeroutput>/etc/apt/sources.list</computeroutput> file. Also note that this URL makes the <computeroutput>inl-keyring</computeroutput> package available, for package GPG signatures.
241
        </para>
242
        </note>
243
       </para>
244
       <para>Unless you are a developer or a very advanced user, we recommend that you do not attempt to use the trunk version of NuFW.
245
       </para>
246
      </section>
247
      <section><title>Upgrading</title>
248
       <para>You should upgrade your installation at least when security announces are released in new versions. Security announces are always available at <ulink url="http://nufw.org/-Security-announces-.html">this URL</ulink>.</para>
249
      </section>
250
      <section><title>Finding out the installed version</title>
251
       <para>You can easily find out which version of the software you are using, with each NuFW component, by using the <computeroutput>-V</computeroutput> switch with any program that we distribute :
252
        <screen>
253
# nuauth -V
254
nuauth (version 2.2.18 ($Revision: 5020 $))
255
# nufw -V
256
NuFW (version 2.2.19)
257
# nutcpc -V
258
nutcpc (version 2.2.19 $Revision: 5350 $)
259
        </screen>
260
        As an alternative, you can also use your distribution's package manager to find out, for instance :
261
        <screen>
262
$ dpkg -l nutcpc
263
[...]
264
ii  nutcpc         2.2.19-1+inl1  The authentication firewall [client]
265
        </screen>
266
       </para>
267
      </section>
268
    </section>
269
  </chapter>
270
271
  <chapter><title>Compilation and installation</title>
272
    <section><title>Default distribution kernels</title>
273
      <para>
274
      The following distributions do NOT need a kernel recompilation to run NuFW <footnote><para>Please let us know if you find others ;)</para></footnote>:
275
      <itemizedlist>
276
        <listitem><para>Fedora Core 6 (kernel 2.6.18)</para></listitem>
277
        <listitem><para>Debian Etch (kernel 2.6.18)</para></listitem>
278
        <listitem><para>Debian Lenny</para></listitem>
279
      </itemizedlist>
280
      </para>
281
      <para>
282
      Please note that a Linux kernel recompilation will only be needed on the Firewall itself (the host running the nufw daemon). The nuauth daemon should run on any POSIX system, and clients are, by essence, multi-platform (meaning, NO kernel dependency).</para>
283
    </section>
284
    <section><title>Kernel preparation</title>
285
      <para>You only need to patch your kernel sources with patch-o-matic if you want to use userid marking (from Linux 2.6.14 there is no need to patch the kernel as this option is available in vanilla). This is necessary if you need to mark your network flows depending on the originating user ID, for instance, to perform per user Quality of Service. This is not needed to use NuFW. To do so, install patch-o-matic as usual and
286
      run <screen>$./runme ip_queue_vwmark</screen></para>
287
      <para>Important note : it seems 2.6.24 netfilter_netlink capabilities only work if they are compiled as modules. Always compile these options as modules :
288
      <itemizedlist>
289
        <listitem><para>CONFIG_NETFILTER_NETLINK</para></listitem>
290
        <listitem><para>CONFIG_NETFILTER_NETLINK_QUEUE</para></listitem>
291
        <listitem><para>CONFIG_NETFILTER_NETLINK_LOG</para></listitem>
292
        <listitem><para>CONFIG_NF_CT_NETLINK</para></listitem>
293
      </itemizedlist>
294
      Most distribution kernels come with these options compiled as modules.
295
      </para>
296
    </section>
297
    <section><title>Linux 2.6.14 and higher</title>
298
        <para>
299
        If you run a kernel higher than 2.6.14 (and you should!), you should set the following options:
300
<screen>
301
CONFIG_NETFILTER_XT_TARGET_NFQUEUE=Y or m
302
CONFIG_NETFILTER_NETLINK=Y or m
303
CONFIG_IP_NF_CONNTRACK=m (we advise you don't set this option statically)
304
CONFIG_IP_NF_CONNTRACK_EVENTS=Y
305
</screen>
306
        Setting these options will allow you to use the NFQUEUE target, and use very simple Netfilter rules.
307
        </para>
308
    </section>
309
    <section><title>NuFW compilation</title>
310
      <para>Extract the source to the directory of your choice and
311
go to the created directory.</para>
312
      <para>
313
NuFW uses autoconf and automake for compilation and a standard <command>configure</command> script
314
is provided.
315
Above standard options, the following flags (among other) are provided:
316
<itemizedlist>
317
          <listitem><para> <option>--with-mysql-log </option>   Support user activity logging in MySQL database</para></listitem>
318
          <listitem><para> <option>--with-pgsql-log </option>   Support user activity logging in PostgreSQL database</para></listitem>
319
          <listitem><para> <option>--with-system-auth </option>   Support PAM+NSS authentication</para></listitem>
320
          <listitem><para> <option>--with-ldap </option>   Support LDAP directory for users and acl lookups</para></listitem>
321
        </itemizedlist>
322
A detailed list of the options is available via
323
<screen>$./configure --help</screen>
324
Thus you can run <command>./configure</command> with the options you want and launch compilation and installation:
325
<screen linenumbering="numbered">$ ./configure --with-ldap --with-system-auth --with-mysql-log \\
326
                --sysconfdir=/etc/nufw/
327
$ make
328
$ sudo make install</screen>
329
330
If you want to install default configuration files :
331
<screen>sudo make install-conf</screen>
332
This will only copy new configuration files when an old version of the file does not already exist in your <command>$prefix/conf</command> directory
333
334
</para>
335
    </section>
336
    <section><title>Initial setup and tests</title>
337
      <section><title>Certificates and client installation</title>
338
        <para>This is about copying the default certificates. Don't do that unless on very early tests ; you probably want to generate your own certificates: see next section.</para>
339
        <para>For nufw
340
<screen>cp conf/certs/nufw-*.pem /etc/nufw/</screen>
341
                For nuauth:
342
<screen>cp conf/certs/nuauth*.pem /etc/nufw/
343
cp conf/certs/NuFW*.pem /etc/nufw/</screen>
344
</para>
345
      </section>
346
      <section><title>Creating your own certificates</title>
347
      <para>The management of certificates, or the use of a Public Key Infrastructure (PKI), is
348
      not covered in this howto. Using a dedicated software, like
349
      <ulink url="http://www.openca.org/">OpenCA</ulink> or
350
      <ulink url="http://ejbca.sourceforge.net/">EBJCA</ulink>,
351
      is suggested.
352
      </para>
353
354
      <para>See section <link linkend='hardening' endterm="hardening.title"/> for details on how
355
      certificates are used in NuFW.
356
      </para>
357
358
      <para>The following commands show how to quickly create a Certificate Authority, and some
359
      certificates for nufw and nuauth.
360
      </para>
361
      <para>Generating your own Certificate authority:
362
      <screen>mkdir private
363
chmod 700 private
364
openssl req -new -x509 -keyout private/CAkey.pem -out private/CAcert.pem</screen>
365
You have to set a strong password here and keep it secret.
366
      </para>
367
      <para>Generating nufw and nuauth private keys:
368
      <screen>openssl genrsa -out private/nufw-key.pem</screen>
369
      <screen>openssl genrsa -out private/nuauth-key.pem</screen>
370
      </para>
371
      <para>Generating Certificate Signing Requests for both nufw and nuauth
372
      keys:
373
      <screen>openssl req -new -key private/nufw-key.pem -out nufw.csr</screen>
374
      <screen>openssl req -new -key private/nuauth-key.pem -out nuauth.csr</screen>
375
      </para>
376
      <para>Having our keys signed by the certificate authority we created:
377
      <screen>openssl x509 -req -days 365 -in nufw.csr -CA private/CAcert.pem \
378
      -CAkey private/CAkey.pem -CAcreateserial -out nufw-cert.pem</screen>
379
      <screen>openssl x509 -req -days 365 -in nuauth.csr -CA private/CAcert.pem \
380
      -CAkey private/CAkey.pem -CAcreateserial -out nuauth-cert.pem</screen>
381
      </para>
382
      <para>Then, as in previous section, copy the files where needed:
383
      For nufw:
384
      <screen>cp private/nufw-key.pem /etc/nufw/</screen>
385
      <screen>cp nufw-cert.pem /etc/nufw/</screen>
386
      For nuauth:
387
      <screen>cp private/nuauth-key.pem /etc/nufw/</screen>
388
      <screen>cp nuauth-cert.pem /etc/nufw/</screen>
389
      And don't forget your key files (here, nufw-key.pem and nuauth-key.pem) should always remain private.
390
      </para>
391
      </section>
392
<section><title>Basic nuauth setup</title>
393
<para>NuFW sources provide a sample configuration file for nuauth <filename>nuauth.conf</filename>
394
which is available in the <filename>conf</filename> directory.
395
</para>
396
<para>The two most important configuration variables are:
397
<option>nuauth_client_listen_addr</option> which sets the address
398
where <command>nuauth</command> listens for client requests and <option>nuauth_nufw_listen_addr</option>
399
which sets the address where <command>nuauth</command> listens for nufw requests.
400
The list of <command>nufw</command> servers authorized to connect to server <command>nuauth</command> is the
401
 <varname>nufw_gw_addr</varname>.</para>
402
<para>
403
The next thing to do after setting this variable is to choose
404
your authentication and acl checking module.
405
Authentication modules for user have to be chosen in:
406
<itemizedlist>
407
<listitem><para>plaintext: user credentials are stored in a text file. It is advised not to use this module, except for quick testing :
408
you need to restart nuauth when updating the text file. Instead, on production, you should run the system module. This format supports both
409
plaintext and encrypted passwords, see the sample config file (named <command>users-plaintext.nufw</command>) for formatting and details.</para>
410
            </listitem>
411
<listitem><para>system: authentication is done against PAM and groups are system groups. This provides
412
 a convenient way to use nss features and/or pam-modules. This is the recommended way, as it lets you
413
 authenticate against your LDAP, Active Directory, or any directory.</para>
414
            </listitem>
415
          </itemizedlist>
416
This is set with the option <option>nuauth_user_check_module</option>
417
which default is <varname>libsystem</varname> (if not set in config file).
418
Further choice for the acl checking  module has to be done if you choose:
419
<itemizedlist><listitem><para>libldap : this is the recommended ACL checking module, as it is modular, and does not require a reload of the
420
nuauth server when updating rules. You can manage iptables and LDAP rules in a consistent way, by using <ulink url="http://software.inl.fr/trac/wiki/EdenWall/NuFace">NuFace</ulink></para>
421
            </listitem>
422
<listitem><para>plaintext : this module is intended to be used for quick testing only. It requires that you reload nuauth when modifying rules.</para>
423
            </listitem>
424
          </itemizedlist>
425
by setting the variable <option>nuauth_acl_check_module</option>.
426
</para>
427
      </section>
428
        </section>
429
     <section><title>Testing</title>
430
431
<para>To be able to proceed quickly to test, we will use the system
432
module for user and the plaintext module for acl.
433
A sample file for the plaintext acl check module is available
434
in the <filename>conf</filename> directory, <filename>acls.nufw</filename>.
435
Copy it to <filename>/etc/nufw</filename> and adjust the
436
group of the ssh acl to have it matching the group of a system
437
user you will use later to authenticate on the system.</para>
438
439
        <section><title>Setting up Netfilter rules before 2.6.14</title>
440
          <para>
441
We will test the setup by connecting from the local host ssh server. For this
442
we need to add filtering rules to ask for authentication:
443
<screen>iptables -A OUTPUT -s 192.168.75.0/24 -p tcp --dport 22 -m state --state NEW --syn -j QUEUE
444
iptables -A OUTPUT -m state --state ESTABLISHED,RELATED -j ACCEPT</screen>
445
<footnote><para>
446
Only SYN packets are sent to QUEUE. This is not enough to do advanced
447
user activities logging, but enough for traffic authentication.
448
</para></footnote>
449
</para>
450
        </section>
451
        <section><title>Setting up Netfilter rules from 2.6.14</title>
452
          <para>
453
We will test the setup by connecting from the local host ssh server. For this
454
we need to add filtering rules to ask for authentication:
455
<screen>iptables -A OUTPUT -s 192.168.75.0/24 -p tcp --dport 22 -m state --state NEW --syn -j NFQUEUE
456
iptables -A OUTPUT -m state --state ESTABLISHED,RELATED -j ACCEPT</screen>
457
<footnote><para>
458
Only SYN packets are sent to NFQUEUE. This is enough to do advanced
459
user activities logging, because events on the connections will be automatically sent to nufw by Netfilter.
460
This requires, in particular, that the CONFIG_IP_NF_CONNTRACK_EVENTS kernel option be set.
461
</para></footnote>
462
</para>
463
        </section>
464
465
        <section><title>Testing the authentication system</title>
466
          <para>First, the daemons need to be started. We start nuauth in a terminal
467
<screen>nuauth -vvvvvvvvv</screen>
468
then we start <screen>nufw -s -vvvvvvvvv</screen> in another terminal.
469
</para>
470
<note>
471
<para>When starting <command>nufw</command> or <command>nuauth</command> daemons without the <command>-D</command> switch,
472
they do not run as daemon : they remain attached to the console. In such conditions, both programs log to STDOUT/STDERR instead of
473
using syslog. On production, you should always start the daemons with the <command>-D</command> option.</para>
474
</note>
475
<para>
476
Next, we can try to connect a user. Under Linux it can be done with:
477
<screen>nutcpc -N -d -U [USERNAME] -H [NUAUTH IP]</screen>
478
Next step is to enter the user's password. Without the <command>-U</command> option, the current system user's name is used.</para>
479
<para>At nuauth level, we should see something like:
480
<screen>user bill@nufw uses OS Linux, 3.0.10, #1 Tue Oct 19 23:51:32 CEST 2008</screen>
481
482
If your PAM setup is based on shadow file, you will not be able to authenticate a user different from the one running nuauth. On this kind of setup, nuauth needs to be run as root to authenticate other users.
483
<footnote>
484
      <para> Never launch nutcpc against 'localhost' or '127.0.0.1',
485
even if nuauth is on the same computer.
486
Packets sent to nuauth by the firewall will hardly have the address of the loopback but rather have a
487
source address which is one of the network interface.
488
</para>
489
            </footnote>
490
</para>
491
        </section>
492
493
        <section><title>Initial tests and debug process</title>
494
          <para>
495
        Let's authenticate a ssh connection from the computer.
496
<itemizedlist>
497
              <listitem><para>nufw gets a packet from  Netfilter:
498
    <screen>[PID] Sending request for 12</screen>
499
12 is the ID of the packet inside the kernel.
500
</para>
501
              </listitem>
502
              <listitem><para>nuauth receives nufw's request:
503
    <screen>* Message: NuFW Packet: src=127.0.0.1 dst=127.0.0.1 proto=6 sport=48505 dport=22, IN=lo OUT=, packet_id=12, mark=0</screen></para>
504
              </listitem>
505
              <listitem><para>nuauth sends an authentication request to the clients
506
on IP source:
507
    <screen>** Message: Warn client(s) on IP 127.0.0.1</screen></para>
508
              </listitem>
509
              <listitem><para>nuauth receives packet from the client:
510
    <screen>** Message: User Packet: src=127.0.0.1 dst=127.0.0.1 proto=6 sport=48504 dport=22, mark=0, user=regit, \\
511
OS=Linux 2.6.26-1-amd64 #1 SMP Wed Sep 10 15:31:12 UTC 2008, app=/usr/bin/ssh</screen>
512
    </para>
513
              </listitem>
514
              <listitem><para>nuauth sends back response to nufw:
515
    <screen>** Message: Answ Packet: src=127.0.0.1 dst=127.0.0.1 proto=6 sport=48505 dport=22, decision=ACCEPT, IN=lo OUT=, \\
516
packet_id=12, mark=1000, user=regit, OS=Linux 2.6.26-1-amd64 #1 SMP Wed Sep 10 15:31:12 UTC 2008, app=/usr/bin/ssh</screen>
517
    </para>
518
              </listitem>
519
              <listitem><para>nufw pushes the packet back in the kernel:
520
    <screen>[PID] (*) Accepting packet with id=12</screen>
521
</para>
522
              </listitem>
523
            </itemizedlist>
524
                </para>
525
        </section>
526
      </section>
527
  </chapter>
528
529
530
  <chapter><title>Setting up NuFW</title>
531
    <section id='LDAP_acls'><title id='LDAP_acls.title'>Using the LDAP module for acl checking</title>
532
      <section><title>Installation of OpenLDAP server (slapd)</title>
533
        <para>OpenLDAP server installation is standard. Use your Linux distribution packages,
534
example with Debian:
535
<screen>apt-get install slapd</screen>
536
Read <ulink url="http://www.openldap.org/doc/admin/">OpenLDAP Software
537
Administrator's Guide</ulink>, section "Building and Installing OpenLDAP Software" to get more information.
538
        </para>
539
      </section>
540
      <section><title>Slapd configuration</title>
541
        <para>
542
The file <filename>acls.schema</filename> has to be put in <filename class="directory">/etc/ldap/schema</filename>
543
and a line
544
<screen>include         /etc/ldap/schema/acls.schema</screen>
545
has to be added at the beginning of the <filename>/etc/ldap/slapd.conf</filename>.
546
In the level of access setup in this file, one can add:
547
<screen>#INL access for acls
548
access to  dn="ou=acls,dc=nufw,dc=org"
549
       by dn="uid=nufw,ou=Users,dc=nufw,dc=org" write
550
       by dn="uid=nuauth,ou=Users,dc=nufw,dc=org" read
551
       by dn="cn=admin,dc=nufw,dc=org" write
552
       by * none</screen>
553
nufw user is able to modify the policy and the nuauth user
554
can only read the acls.
555
</para>
556
557
<para>
558
To speed up search request you can add the following index to your <filename>slapd.conf</filename>:
559
<screen>
560
index OsName,OsRelease,OsVersion,AppName pres,eq
561
index SrcIPStart,SrcIPEnd,DstIPStart,DstIPEnd pres,eq
562
index Proto,SrcPortStart,SrcPortEnd,DstPortStart,DstPortEnd pres,eq
563
index SrcPort,DstPort pres,eq
564
</screen>
565
</para>
566
<para>
567
You can start with a LDIF file such as:
568
<screen>dn: dc=nufw,dc=org
569
objectClass: top
570
objectClass: dcObject
571
objectClass: organization
572
o: nufw.org
573
dc: nufw
574
structuralObjectClass: organization
575
576
dn: ou=Users,dc=nufw,dc=org
577
objectClass: organizationalUnit
578
ou: Users
579
structuralObjectClass: organizationalUnit
580
581
dn: ou=acls,dc=nufw,dc=org
582
objectClass: organizationalUnit
583
ou: acls
584
structuralObjectClass: organizationalUnit
585
586
dn: uid=nuauth,ou=Users,dc=nufw,dc=org
587
objectClass: top
588
objectClass: simpleSecurityObject
589
uid: nuauth
590
userPassword: nuauth
591
592
dn: uid=nufw,ou=Users,dc=nufw,dc=org
593
objectClass: top
594
objectClass: simpleSecurityObject
595
uid: nufw
596
userPassword: nufw
597
</screen>
598
</para>
599
      </section>
600
     <section><title>nuauth configuration</title>
601
        <para>
602
To use LDAP support for acl checking, we need to modify the <filename>nuauth.conf</filename> file:
603
<screen>nuauth_acl_check_module="ldap"</screen>
604
and we have to setup the connection parameters:
605
<screen>ldap_bind_dn="uid=nuauth,ou=Users,dc=nufw,dc=org"
606
ldap_bind_password="secretpassword"
607
ldap_basedn="dc=nufw,dc=org"
608
ldap_acls_base_dn="ou=Acls,dc=nufw,dc=org"</screen>
609
</para>
610
      </section>
611
      <section><title>Using nuface, a web-based rules generator</title>
612
<para>
613
<ulink url="http://www.inl.fr">INL</ulink> has released a powerful Netfilter rules generator system for NuFW and Netfilter.
614
It is called Nuface and it is available at:
615
<ulink url="http://software.inl.fr/trac/wiki/EdenWall/NuFace">http://software.inl.fr/trac/wiki/EdenWall/NuFace</ulink>
616
It generates a set of rules for NuFW and Netfilter that can directly be applied from the web interface. All Netfilter rules generated by Netfilter use the stateful capabilities of Netfilter, without user intervention.
617
</para>
618
      </section>
619
      <section><title>nuaclgen configuration</title>
620
      <para>nuaclgen is a script that can help you maintain a simple
621
      set of acls in an LDAP tree.</para>
622
      <para>It is advised that you use Nuface rather than Nuaclgen, if possible, since it makes things simpler. In particular,
623
      be aware that when you use nuaclgen, you need to also modify by hand your Netfilter rules.</para>
624
        <para>
625
The file <filename>nuaclgen.conf</filename> contains the informations about LDAP
626
connections. It needs to be modified to suit your configuration, for example:
627
<screen>$ldap_host="localhost";
628
$username="uid=nufw,ou=Users,dc=nufw,dc=org";
629
$password="writepasswd";
630
$basedn="ou=Acls,dc=nufw,dc=org";</screen>
631
<footnote><para>The nuaclgen.conf file contains sensitive data
632
and thus must have limited rights.</para>
633
          </footnote>
634
635
</para>
636
        <para>To allow ssh for users
637
of group 513 if they use <filename>/usr/bin/ssh</filename> application, we can use:
638
<screen>nuaclgen --Aclname cn=ssh,ou=Acls,dc=nufw,dc=org -p 6 --dport 22 -AppName "/usr/bin/ssh" -j ACCEPT -g 513</screen>
639
</para>
640
        <para>Or for access directed to a web server:
641
<screen>
642
nuaclgen --Aclname cn=apt,ou=Acls,dc=nufw,dc=org -p 6 --dport 80 \
643
  -AppName "/usr/lib/apt/methods/http" -j ACCEPT -g 1042
644
</screen>
645
This ACL gives access to group 1042  which is used by root user of some server of ours.
646
Thus root user can only get file to update the computer, but other users can not access
647
the web.
648
</para>
649
      </section>
650
651
    </section>
652
    <section><title>Setting up NuFW authenticated connections tracking</title>
653
      <section><title>nuauth settings</title>
654
        <para>
655
 To achieve NuFW connection tracking it is necessary to have these options in <filename>nuauth.conf</filename>:
656
 <screen>nuauth_log_users_sync=1
657
nuauth_log_users=9</screen>
658
</para>
659
      </section>
660
661
<section id='mysql_log'><title id='mysql_log.title'>Installation of MySQL server</title>
662
        <para>MySQL server installation is standard. Use your Linux distribution packages,
663
example with Debian:
664
<screen>apt-get install mysql-server</screen>
665
Read <ulink url="http://dev.mysql.com/doc/">MySQL Documentation</ulink>, section
666
"2 Installing and Upgrading MySQL" to get more information.
667
        </para>
668
</section>
669
670
<section><title>Installation of PostgreSQL server</title>
671
        <para>PostgreSQL server installation is standard. Use your Linux distribution packages,
672
example with Debian (replace 8.2 by the latest server version):
673
<screen>apt-get install postgresql-8.2</screen>
674
Read <ulink url="http://www.postgresql.org/docs/">PostgreSQL Documentation</ulink>, section
675
"III. 14. Installation Instructions" to get more information.
676
        </para>
677
        <note>
678
        <para>Note that, even though nuauth PostgreSQL support is complete, you probably want to use
679
        a MySQL server for now, if you want to use <ulink url="http://software.inl.fr/trac/wiki/EdenWall/NuLog">Nulog</ulink>.
680
681
        Single Sign On modules (<ulink url="http://software.inl.fr/trac/wiki/EdenWall/mod_auth_nufw">apache</ulink>
682
        and <ulink url="http://software.inl.fr/trac/wiki/EdenWall/squid_nufw_helper">squid</ulink>) have
683
        PostgreSQL support.</para>
684
        </note>
685
</section>
686
687
<section><title>SQL configuration</title>
688
<para>The connection tracking system is really useful with SQL logging modules.
689
We will describe here the setup of the MySQL module.</para>
690
<para>
691
You have to create the SQL database from the dump file available in the conf/
692
subdir of the archive. Create a SQL account, which must have UPDATE,
693
INSERT privileges on the "conntrack_ulog" table. You will have to set the
694
credentials for that user in the nuauth.conf file.
695
</para>
696
<para>
697
You may choose between to schema an IPv4 only one and an IPv4/IPv6 one.
698
Recent tools like <ulink
699
url="http://software.inl.fr/trac/wiki/EdenWall/NuLog">Nulog2</ulink> are able to use
700
the IPv6 schema. If you have old script or older tools, you better use the IPv4 only schema.
701
To import the IPv4 schema into a newly created database, you can use:
702
</para>
703
<screen>mysqladmin create nufw
704
cat nulog.ipv4.mysql.dump | mysql nufw</screen>
705
<para>For the IPv6 schema, simply use:</para>
706
<screen>mysqladmin create nufw
707
cat nulog.ipv6.mysql.dump | mysql nufw</screen>
708
<para>
709
You may also want to rotate the "ulog" table, so that it doesn't grow to infinite
710
size with time. The ulog_rotate.py script is available in the
711
<ulink url="http://software.inl.fr/trac/wiki/EdenWall/NuLog">Nulog project</ulink>
712
tarball.
713
At the present time, it is assumed those scripts are run as the root SQL user,
714
as cronjobs. Of course the better way to go is to create a separate user for
715
this and grant it the needed privileges. Please provide updates for this
716
document if you implement this before we do.
717
</para>
718
      </section>
719
<section><title>Life of a connection in the SQL table</title>
720
<para>
721
If nuauth is configured to log network flow information in a SQL database, here is how the logging system works :
722
</para>
723
<itemizedlist><listitem><para>When the connexion opening datagram is authenticated (for TCP, that is the SYN datagram), nuauth creates an entry in database, with a request looking like this (for TCP) :
724
<screen>INSERT INTO conntrack_ulog (state, oob_time_sec, ip_protocol, ip_saddr, ip_daddr, oob_in, oob_out, oob_prefix, user_id,
725
username, client_os, client_app, tcp_sport, tcp_dport) VALUES (... our datagram values ...);</screen>
726
If nuauth decision for that datagram is to drop or reject it, log of the "connexion" stops here. The connexion will never be opened, and this database entry will no longer be manipulated by nuauth.
727
</para></listitem>
728
<listitem><para>At the time when connection changes state (For TCP, and for any accepted connection, state changes to ESTABLISHED as soon as the server answers the SYN datagram), this request is performed by nuauth, if the nufw daemon is run with "-C" :
729
<screen>
730
UPDATE conntrack_ulog SET state=ESTABLISHED, start_timestamp=FROM_UNIXTIME(timestamp)
731
WHERE (ip_daddr=%s AND ip_saddr=%s "AND tcp_dport='%hu' AND tcp_sport='%hu' AND state=OPEN)
732
</screen>
733
The only fields that are altered by this request are "state", which changes to "ESTABLISHED", and start_timestamp, which wasn't set before. It is important to note that no information is lost when this modification is performed. It is indeed obvious that the connection was previously in "OPEN" state, since that's a TCP preamble to the "ESTABLISHED" state, and the database keeps track of the timestamp when the connection was opened in the "oob_time_sec" field. The "start_timestamp" field simply marks the timestamp of switch to the "ESTABLISHED" state.
734
</para></listitem>
735
<listitem><para>When the connection expires, this request is executed by nuauth, if the nufw daemon is run with "-C" :
736
<screen>
737
UPDATE conntrack_ulog SET end_timestamp=FROM_UNIXTIME(timestamp), state=CLOSE, packets_in=%d , packets_out=%d , bytes_in=%d , bytes_out=%d
738
WHERE (ip_saddr=%s AND ip_daddr=%sAND tcp_sport='%hu' AND tcp_dport='%hu' AND (state=OPEN OR state=ESTABLISHED))
739
</screen>
740
State is updated, it becomes "CLOSE", and we set the end_timestamp field, which was empty before this, as well as packet number and byte number counters for the now dead connexion. Time of opening and time of establishment of the connection remain available in the oob_time_sec and start_timestamp fields.
741
</para></listitem></itemizedlist>
742
<para>
743
The SQL logging feature keeps track of the whole history of each connexion, and updates that nuauth performs on the database do never erase data that was previously logged. This log mode is the most powerful one that a firewall can achieve, because it is very synthetic : one single SQL entry is maintained for each connection ; and it keeps the whole history of all elements of connections.
744
</para>
745
</section>
746
      <section><title>Netfilter settings</title>
747
      <section><title>Settings on post 2.6.14 kernel</title>
748
      <para>
749
This is the good case compared to pre 2.6.14.
750
To enable authenticated connection tracking,
751
you only have to add the <option>-C</option> to nufw command line.
752
This flag asks nufw to send any ESTABLISHED and DESTROY message coming from Netfilter connections tracking to nuauth.
753
</para>
754
<para>
755
As an important number of events can be sent through this mean, nufw offers the capability to only send a subset.
756
It uses the fact that the initial mark can be put with CONNMARK
757
on every packets of the connection.
758
This mode is activated via the <option>-M</option> flag of nufw.
759
On Netfilter side, the following rules have to be added:
760
<screen>iptables -A PREROUTING -t mangle -j CONNMARK --restore-mark
761
iptables -A POSTROUTING -t mangle -m mark ! --mark 0 -j CONNMARK --save-mark
762
</screen>
763
</para>
764
<para>
765
In short, you should always use <option>-C</option> if you use libnetfilter_conntrack (this is available from linux 2.6.14), and you should use <option>-M</option> if you want all your connections marked per userID (please note that you need to apply <ulink url="http://nufw.org/download/patches/transmit_mark.patch">transmit_mark patch</ulink> on your kernel to use this). Library compatibility is better with a >=2.6.16 kernel.
766
      </para>
767
      </section>
768
      <section><title>Settings on pre 2.6.14 kernel</title>
769
        <para>
770
NuFW stores the following states in the life of a TCP connection:
771
    <itemizedlist><listitem><para>opening: bit SYN is set</para></listitem>
772
            <listitem><para>established: SYN ACK is sent</para></listitem>
773
            <listitem><para>closed: the tcp flags are FIN or FIN,ACK</para></listitem>
774
          </itemizedlist>
775
To match those packets we need to use the <option>--syn</option> and the
776
<option>--tcp-flags</option> options.
777
Let's use the following configuration as an example: our web servers are protected by a NuFW firewall. They are in the network $DMZ.
778
The following rules achieve to realize a user connection tracking on the web
779
server outgoing connections.
780
<screen>iptables -A FORWARD -p tcp -m state --state ESTABLISHED --tcp-flags ACK,FIN NONE -j ACCEPT
781
iptables -A FORWARD -d $DMZ -p tcp -m state --state ESTABLISHED --dport 80 --tcp-flags SYN,RST,ACK RST -j QUEUE
782
iptables -A FORWARD -d $DMZ -p tcp -m state --state ESTABLISHED --dport 80 --tcp-flags FIN FIN -j QUEUE
783
iptables -A FORWARD -s $DMZ -p tcp -m state --state ESTABLISHED --sport 80 --tcp-flags SYN,ACK SYN,ACK -j QUEUE
784
iptables -A FORWARD -p tcp -m state --state ESTABLISHED -j ACCEPT
785
iptables -A FORWARD -d $DMZ -p tcp --syn --dport 80 -m state --state NEW -j QUEUE</screen>
786
The first rule optimizes the filter by matching an important part of the ESTABLISHED traffic. The last rule with --state ESTABLISHED is the standard accepted established packets. It has to be put after NuFW flags matching rules.
787
</para>
788
</section>
789
      <section><title>Settings on >= 2.6.14 kernel</title>
790
        <para>
791
          No special complicated rule should be set, the kernel will automatically send new events on connections to NuFW.
792
          This is the reason why you don't want to use a pre-2.6.14 kernel ;)
793
        </para>
794
      </section>
795
      </section>
796
<section><title>Using the connection tracking</title>
797
<para>
798
<command>nutop</command> is a perl script provided with nufw sources. It is a
799
top like tool that displays the active and authenticated connections in real-time.
800
</para>
801
<para>The best way<footnote><para>as far as the author of this document knows at the time of the writing of
802
this document</para>
803
          </footnote> to use the logs generated by the connection tracking is to install
804
<command>nulog</command> which provides a convenient web interface.
805
<command>nulog</command> is available under GPL on this page:
806
<ulink url="http://software.inl.fr/trac/trac/wiki/EdenWall/NuLog">http://software.inl.fr/trac/wiki/EdenWall/NuLog</ulink>
807
</para>
808
        </section>
809
</section>
810
<section><title>Single Sign On setup</title>
811
<section><title>Apache</title>
812
<para>All you need to do is to setup a SQL user with SELECT permissions on the
813
"conntrack_ulog" table. Then setup mod_auth_nufw to use the configured SQL
814
user/database/table. The source code of the apache module is available at <ulink
815
url="http://software.inl.fr/trac/wiki/EdenWall/mod_auth_nufw">NuFW Apache SSO page</ulink></para>
816
        </section>
817
<section><title>Squid</title>
818
<para>All you need to do is to setup a SQL user with SELECT permissions on the
819
"conntrack_ulog" table. Then setup squid_nufw_helper to use the configured SQL
820
user/database/table. The source code of the squid helper is available at
821
<ulink url="http://software.inl.fr/trac/wiki/EdenWall/squid_nufw_helper">NuFW Squid SSO page</ulink></para>
822
        </section>
823
        <section><title>Troubleshooting single sign on problems</title>
824
         <section><title>General information</title>
825
          <para>If you experience problems with Single Sign On problems, one common way to find out where the problem lays is to check whether the SSO code performs SQL lookups correctly. You can check it out easily at the database level. On MySQL, check you have in <filename>my.cnf</filename> something like: <screen>log             = /var/log/mysql/mysql.log</screen> This ensures that MySQL logs request that it receives. Then all you need to do is test the module, while running <screen>tail -f /var/log/mysql/mysql.log</screen> If the Single Sign On module is doing its job, you should see lines such as : <screen>SELECT DISTINCT username FROM conntrack_ulog WHERE (tcp_sport=50423 AND ip_saddr=3232235761 AND tcp_dport=80 AND ip_daddr=3232235761 AND (state=1 OR state=2))</screen> in the log, revealing that the Single Sign On module actually requests the database. If you run a PostgreSQL database, you can do similar operations by setting <screen>log_min_duration_statement = 0</screen> in <filename>postgresql.conf</filename>. On Debian, the default PostgreSQL log file is probably located in <filename>/var/log/postgresql/postgresql-8.X-main.log</filename>.</para>
826
         </section>
827
         <section><title>Apache module troubleshooting</title>
828
          <para>Like any Apache module, the mod_auth[n]_nufw module dumps verbose/debug information in the Apache error log when you set :<screen>Loglevel debug</screen> in the Apache <filename>httpd.conf</filename> file.</para>
829
<!--          <note>This works on Apache 1.3, Apache 2.0 and Apache 2.2</note> -->
830
         </section>
831
        </section>
832
      </section>
833
<section><title>User based Quality of Service</title>
834
<section><title>Setting up Kernel on non libnetfilter_queue system</title>
835
<para>
836
Official Linux kernels are not able to mark packets
837
with ip_queue framework before 2.6.14 release.
838
It is thus necessary to patch the kernel (if pre 2.6.14), this has to be done by using
839
the <filename>ip_queue_vwmark</filename> patch available in the
840
patch-o-matic-ng from netfilter. This will generate a modified version of both
841
ip_queue module and libipq.a file.
842
</para>
843
<para>
844
Once the new libipq.a is installed, you can now compile nufw:
845
<screen>./configure --with-user-mark ${EXTRA_OPTIONS_YOU_LIKE}
846
make
847
make install</screen>
848
</para>
849
</section>
850
<section><title>Setting up nufw</title>
851
<para>
852
nufw can now be run with <option>-m</option> to use userid marking.
853
This option is compatible with <option>-M</option>.
854
</para>
855
    </section>
856
<section><title>Setting up Netfilter</title>
857
<para>
858
As nufw only works with initialization packets it can not pull the userid mark of each packet
859
of a connection. Thus, this is necessary to use
860
<application>CONNMARK<footnote><para>CONNMARK is only available in patch-o-matic
861
before 2.6.11, it is included in 2.6.12+ kernels</para>
862
            </footnote></application>
863
which is a target able to propagate marks across connections.
864
A basic setup is the following:
865
<screen>iptables -A PREROUTING -t mangle -j CONNMARK --restore-mark
866
iptables -A POSTROUTING -t mangle -j CONNMARK --save-mark</screen>
867
First line restores the existing mark when a packet arrives and second line
868
saves mark on the connection so it can be restored later.
869
</para>
870
      </section>
871
      <section><title>Using marking modules</title>
872
      <para>
873
The nuauth variable <option>nuauth_finalize_packet_module</option> lists module which attach a hook called just before
874
nuauth answer to nufw about a packet.
875
It is usually used to modify the mark of the packet following a given strategy.
876
By splitting the mark in different part, this is possible to define complex marking policy which can later be used
877
by Linux routing and QoS systems.
878
</para>
879
      <para>
880
      Extensive documentation can be found in the file <ulink url="http://software.inl.fr/trac/browser/mirror/edenwall/nufw/trunk/nufw/doc/README.mark">README.mark</ulink>
881
      </para>
882
      </section>
883
<section><title>Using NuFW mark</title>
884
<para>Netfilter mark can be use by the Quality of Service system and
885
the routing system of Linux.</para>
886
<para>
887
So it is possible to do differentiated routing between different users
888
by using command like:
889
<screen>ip rule add fwmark XXX lookup TABLE</screen>
890
</para>
891
<para>This is almost the same for QoS, by using <command>tc filter</command> one needs to put
892
user's flows in a specific class:
893
<screen>tc filter add dev IFACE  prio 5 protocol ip handle 102 fw flowid FLOWID</screen>
894
</para>
895
<para>For more information about routing and quality of service you can read
896
<ulink url="http://www.lartc.org">lartc</ulink>.
897
</para>
898
      </section>
899
    </section>
900
    <section><title>Controlling nuauth finely at runtime</title>
901
    <para>NuFW 2.2.0 introduced new nuauth control capabilities, thanks to <command>nuauth_command</command>. This command should
902
    be installed when you install nuauth, and it can be run by the administrator, on the same server as <command>nuauth</command>.
903
    <command>nuauth_command</command> connects to nuauth, and lets you do the following tasks :
904
    <itemizedlist>
905
    <listitem><para><option>help</option> display inline help with a summary of available subcommands</para></listitem>
906
    <listitem><para><option>version</option> display nuauth version</para></listitem>
907
    <listitem><para><option>users</option> list connected users</para></listitem>
908
    <listitem><para><option>firewalls</option> list connected nufw firewalls</para></listitem>
909
    <listitem><para><option>packets count</option> display number of decision waiting packets</para></listitem>
910
    <listitem><para><option>refresh cache</option> refresh all caches</para></listitem>
911
    <listitem><para><option>refresh crl</option> refresh the TLS crl file</para></listitem>
912
    <listitem><para><option>disconnect (ID|regexp)</option> disconnect a user with his session identifier or a regular expression apply on logging name.</para></listitem>
913
    <listitem><para><option>disconnect all</option> disconnect all users</para></listitem>
914
    <listitem><para><option>uptime</option> display nuauth starting time and uptime</para></listitem>
915
    <listitem><para><option>reload</option> reload the configuration and reload the modules</para></listitem>
916
    <listitem><para><option>reload periods</option> reload the time periods</para></listitem>
917
    <listitem><para><option>display debug_level</option></para></listitem>
918
    <listitem><para><option>display debug_areas</option></para></listitem>
919
    <listitem><para><option>debug_level <replaceable>LEVEL</replaceable></option></para></listitem>
920
    <listitem><para><option>debug_areas <replaceable>AREAS</replaceable></option></para></listitem>
921
    <listitem><para><option>help</option> display this help</para></listitem>
922
    <listitem><para><option>quit</option> disconnect</para></listitem>
923
    </itemizedlist>
924
    You can, for instance, use the <option>disconnect</option> task, in order to force a user reconnect, and have their groups reloaded.
925
    <note>
926
     <para>As a POSIX compliance, <command>nuauth</command> checks the user's authentication, as well as groups, at the time the user's NuFW agent connects. It is
927
     never refreshed, until the client disconnects, or the administrator forces a disconnect. Nuauth configuration file <computeroutput>nuauth.conf</computeroutput> can also force all users
928
     to reconnect regularly, by setting the <option>nuauth_session_duration</option> parameter.
929
     </para>
930
    </note>
931
932
    </para>
933
    </section>
934
935
    <section><title>Time-based ACLs</title>
936
    <section><title>Global configuration</title>
937
    <para>
938
NuFW can be used to implement strict time-based acls. When a period using time interval is defined (like say 08am-6pm)
939
a authenticated connection can only start in the interval and is destroyed at the end of the interval.
940
    </para>
941
    <para>Configuration is done by defining a set of periods and using them (by their name) in the acls backend.
942
    The <option>plaintext</option> acl backend uses the <option>period</option> key to defined the period
943
    to apply to the acl. The <option>LDAP</option> acls backend uses the <option>TimeRange</option> atttribute.
944
    </para>
945
    <para>
946
    Definition of periods is done by modules and the corresponding option is <option>nuauth_periods_module</option>.
947
    For now, the     only available module  is <filename>xml_defs</filename>.
948
    </para>
949
    </section>
950
    <section><title>XML period definition module</title>
951
    <para>
952
<filename>xml_defs</filename> is a period definition module. It uses a XML formatted file to store
953
the periods. The path to this file can be set by using the <option>xml_defs_periodfile</option>:
954
    </para>
955
<screen>
956
xml_defs_periodfile="/etc/nufw/periods.xml"
957
</screen>
958
<para>
959
The XML structure of the file is the following:
960
</para>
961
<screen>
962
<![CDATA[
963
<?xml version="1.0"?>
964
<periods>
965
<period name="5x8" desc="open hour">
966
    <perioditem>
967
        <days start="1" end="5"/>
968
        <hours start="8" end="18"/>
969
    </perioditem>
970
</period>
971
<period name="long" desc="date example">
972
    <perioditem>
973
        <dates start="1128282" end="323232323"/>
974
    </perioditem>
975
</period>
976
<period name="interval" desc="one hour interval">
977
    <perioditem>
978
        <!-- Duration in second (1 hour) -->
979
        <duration length="3600"/>
980
    </perioditem>
981
</period>
982
</periods>
983
]]>
984
</screen>
985
<para>
986
There are two major types of period definitions:
987
<itemizedlist>
988
<listitem><para><option>Time interval</option>: the period is defined by using specifying days, hours or dates interval. Days and hours can be combined to define more complex period.
989
</para></listitem>
990
<listitem><para><option>Duration</option>: the period is defined by a duration expressed in seconds.</para></listitem>
991
</itemizedlist>
992
</para>
993
<para>Multiple <option>perioditem</option> can be put in the same <option>period</option> to increase the flexibility of period definition.</para>
994
 </section>
995
 <note>
996
 <para>When using Nuface to manage filtering rules, time-based ACLs can be setup through the web interface, without editing any file by hand.</para>
997
 </note>
998
 </section>
999
1000
1001
    <section><title>Chaining modules in nuauth</title>
1002
    <section><title>Syntax description</title>
1003
    <para>
1004
The syntax is the following: Each option that sets up the use of a hook is
1005
a space separated list of modules.</para>
1006
<para>For each module type, the syntax is as follows :
1007
<option>name[:type[:config file]]</option>
1008
If syntax is:
1009
<itemizedlist>
1010
<listitem><para><option>name</option>: loads module "name" with config file included in nuauth.conf</para></listitem>
1011
<listitem><para><option>name:type</option>: loads module "type" with config file CONFIG_DIR/modules/name.conf</para></listitem>
1012
<listitem><para><option>name:type:conf</option>: loads module "type" with config file "conf"</para></listitem>
1013
</itemizedlist>
1014
    </para>
1015
    </section>
1016
    <section><title>Some examples</title>
1017
    <para>
1018
 Let's analyze the following line:
1019
<computeroutput>nuauth_user_logs_module="syslog dblocal:mysql maindb:mysql:/etc/nufw/mainmysql.conf"</computeroutput>
1020
Packet will be logged multiple times:
1021
<orderedlist>
1022
<listitem><para>In syslog</para></listitem>
1023
<listitem><para>In a MySQL database using configuration file /etc/nufw/modules/dblocal.conf</para></listitem>
1024
<listitem><para>In a second MySQL database using configuration file /etc/nufw/mainmysql.conf</para></listitem>
1025
</orderedlist>
1026
    </para>
1027
    </section>
1028
    </section>
1029
1030
<section id='hardening'><title id='hardening.title'>Hardening NuFW</title>
1031
<section><title>Nufw certificate verification</title>
1032
1033
<para>It is highly recommended to install nuauth and nufw on a dedicated server, hardened
1034
for security. Other projects like GrSec <footnote><para>http://www.grsecurity.net/</para></footnote> or
1035
SELinux <footnote><para>http://www.nsa.gov/selinux/</para></footnote> can be used to increase local (system)
1036
security.
1037
<note>
1038
<para>Since NuFW 2.2.19, a SeLinux configuration is distributed in the <computeroutput>selinux/</computeroutput> directory of the archive. Read the <computeroutput>README.selinux</computeroutput>
1039
file there if you want to implement SELinux policies to the NuFW daemons. However, this security policy set is not yet considered stable and
1040
is distributed for testing purpose. You are welcome to send the NuFW team feedback about it!</para>
1041
</note>
1042
</para>
1043
1044
<para>To ensure confidentiality of communications between nufw, nuauth, and the clients,
1045
all connections are encrypted using TLSv1.</para>
1046
1047
<para>
1048
As the firewall policy is applied by nuauth, the trust relationship between nufw and nuauth
1049
should be verified. The certificate provided by nuauth during the TLS negotiation
1050
will be checked if a certificate authority is configured in nufw.
1051
This is done by using the <option>-a</option> option at start
1052
of nufw followed by the name of the certificate authority file.
1053
With this option set, <varname>nufw</varname> will require a signed certificate
1054
from nuauth, and verify it.</para>
1055
1056
<para>The CN (complete name) field from nufw certificate must contain the FQDN (fully
1057
qualified domain name) of nufw server.
1058
</para>
1059
1060
<para>
1061
Since release 2.2.18, NuFW runs in TLS strict mode by default.
1062
 It means nufw will not start if nuauth certificate is:
1063
<orderedlist>
1064
<listitem><para>Not verifiable against an authority</para></listitem>
1065
<listitem><para>Invalid</para></listitem>
1066
<listitem><para>Revoked</para></listitem>
1067
<listitem><para>Without signer</para></listitem>
1068
<listitem><para>Signed, but the signer is not a CA</para></listitem>
1069
<listitem><para>With an insecure algorithm (if GnuTLS is compiled with its support)</para></listitem>
1070
<listitem><para>Not yet activated</para></listitem>
1071
<listitem><para>Expired</para></listitem>
1072
</orderedlist>
1073
See the <link linkend='FinerTLS' endterm="FinerTLS.title"/> section of this document for advanced TLS options of nufw and other components.
1074
</para>
1075
<warning>
1076
<para>
1077
Since release 2.2.18, this mode is now activated by default. You can disable it, at your own risks, using the <option>-s</option> option of nufw.
1078
</para>
1079
</warning>
1080
<para>
1081
To run nufw with strict TLS checking, you will have to specify the following option:
1082
<itemizedlist>
1083
<listitem><para><option>-a</option>: Specify the authority file to use.</para></listitem>
1084
<listitem><para><option>-k</option>: Specify the key file to use.</para></listitem>
1085
<listitem><para><option>-c</option>: Specify the certificate file to use.</para></listitem>
1086
<listitem><para><option>-r</option>: Specify the certificate revocation list file to use (if available). A nufw restart  or a SIGHUP signal will be needed if you want change to the file to be taken into account.</para></listitem>
1087
<listitem><para><option>-d</option>: Fully qualified domain name of the nuauth server.</para></listitem>
1088
</itemizedlist>
1089
Thus a typical nufw command line should look like:
1090
</para>
1091
<screen>nufw -d nuauth.nufw.org -a localCA-cacert.pem -k server.nufw.org-key.pem -c server.nufw.org-cert.pem -r localCA-crl.pem</screen>
1092
<note><para><ulink
1093
url="http://en.wikipedia.org/wiki/Online_Certificate_Status_Protocol">OCSP</ulink>
1094
is currently not supported by NuFW 2.2.X. OCSP support is being worked on in the
1095
trunk (currently unstable) branch of NuFW. Please contact NuFW developers if you need OCSP in 2.2.X,
1096
maybe we can add it to the 2.2 TODO list.</para></note>
1097
</section>
1098
<section><title>Authentication server (nuauth)</title>
1099
<para>The option <option>nuauth_tls_request_cert</option> defines if client
1100
certificates are optional or not. Possible values are:
1101
<itemizedlist>
1102
<listitem><para><option>0</option>: nuauth will not ask client to provide a certificate, they won't send one
1103
even if they have some to give.</para></listitem>
1104
<listitem><para><option>1</option>: client is asked to send a certificate, but the server will not refuse connection if none is provided.</para></listitem>
1105
<listitem><para><option>2</option>: client is asked to send a certificate, and the server will drop the connection if none is provided.</para></listitem>
1106
</itemizedlist>
1107
</para>
1108
<para>The default setting (<option>nuauth_tls_request_cert=2</option>) is that nuauth will require and verify client certificates for all
1109
connections (clients, and NuFW servers). Certificates are used to verify the identity
1110
of all components of a NuFW installation (nufw, nuauth, and clients), and ensure that
1111
no forgery or false representation has occurred.
1112
</para>
1113
<para>All components must share the same certificate authority (CA).
1114
See the <link linkend='FinerTLS' endterm="FinerTLS.title"/> section of this document for advanced TLS options of nuauth and other components.
1115
</para>
1116
<para>The CN (complete name) field from nuauth certificate must contain the FQDN (fully
1117
qualified domain name) of nuauth server. All clients and nufw servers will check that
1118
the DNS name of nuauth server matches the name in the certificate.
1119
</para>
1120
<note>
1121
<para>It is possible to generate a certificate with additional names, using the
1122
<computeroutput>subjectAltName</computeroutput> extension (See
1123
<ulink url="http://tools.ietf.org/html/rfc3280#section-4.2.1.7">Section 4.2.1.7 of RFC
1124
3280</ulink>).
1125
</para>
1126
</note>
1127
<para>
1128
You have to:
1129
<orderedlist>
1130
  <listitem><para>Configure the certificate authority (<option>nuauth_tls_cacert</option>)</para></listitem>
1131
  <listitem><para>Configure nuauth certificate (<option>nuauth_tls_cert</option>) and key (<option>nuauth_tls_key</option>) files.</para></listitem>
1132
  <listitem>
1133
    <para>Deploy client certificates. If you only want to verify server
1134
identity, you can share a certificate between several clients. If you want to
1135
use certificates for authentication, or if you will revoke certificates, you
1136
have to deploy a certificate for each client.
1137
    </para>
1138
  </listitem>
1139
</orderedlist>
1140
Warning: since release 2.2.18, this mode is now activated by default. You can
1141
disable it, at your own risks, by setting <option>nuauth_tls_request_cert=0</option> in nuauth
1142
configuration file.
1143
</para>
1144
1145
<para>nuauth will check that the CN (complete name) field from nufw certificate contains the FQDN (fully
1146
qualified domain name) of the nufw server. You can disable it, at your own risks, by setting
1147
<option>nuauth_tls_disable_nufw_fqdn_check=1</option> in nuauth configuration file.
1148
</para>
1149
1150
<para>You should also configure a Certificate Revocation List (CRL), with the
1151
<option>nuauth_tls_crl</option> parameter in nuauth configuration file. This file contains
1152
the list of all revoked certificates, in standard CRL format. You have to create a
1153
planified task (cron job) to update this file periodically, nuauth will check for
1154
modifications every <option>nuauth_tls_crl_refresh</option> seconds and will reload the file
1155
if necessary. You can use the HUP signal or the <command>refresh crl</command> command
1156
to force an update of the CRL.
1157
</para>
1158
1159
<note>
1160
<para>Note that currently, private keys cannot be password protected : neither nufw nor nuauth support entering a passphrase.
1161
The reference documentation mentions the <computeroutput>nuauth_tls_key_passwd</computeroutput> option, but it is not implemented for now.
1162
</para>
1163
</note>
1164
1165
</section>
1166
<section><title>User authentication restrictions</title>
1167
<para>You can restrict the number of simultaneous nuauth clients, per user or per IP address.
1168
<orderedlist>
1169
<listitem><para><option>nuauth_single_user_client_limit</option>: maximum number of nuauth clients per user</para></listitem>
1170
<listitem><para><option>nuauth_single_ip_client_limit</option>: maximum number of nuauth clients per IP</para></listitem>
1171
</orderedlist>
1172
</para>
1173
</section>
1174
<section><title>On client side</title>
1175
<para>nuauth client (nutcpc or nuapplet) will verify nuauth certificate when connecting, if a
1176
certificate authority is configured on the client (option <option>-A</option> of nutcpc). The certificate
1177
of the nuauth server will be verified, and the DNS name must match the CN field of the certificate.
1178
See the <link linkend='FinerTLS' endterm="FinerTLS.title"/> section of this document for advanced TLS options of nutcpc and other components.
1179
</para>
1180
1181
<para>You can disable, at your own risks, the verifications:
1182
<orderedlist>
1183
  <listitem><para>If no certificate authority is defined, the trust relation with nuauth will not be
1184
  checked. Other attributes of nuauth certificate (expiration,etc.) will be checked, though.
1185
    </para>
1186
  </listitem>
1187
  <listitem><para>Option <option>-N</option> disables the verification of the DNS name of nuauth server.
1188
    </para>
1189
  </listitem>
1190
  <listitem><para>Option <option>-Q</option> disables warnings if no certificate authority is configured.
1191
    </para>
1192
  </listitem>
1193
</orderedlist>
1194
</para>
1195
1196
<para>Clients should provide a client certificate, signed by the same authority.
1197
<orderedlist>
1198
  <listitem><para>If the certificate is used to login, the name of the user must be stored in the CN field
1199
  of the client certificate.</para>
1200
  </listitem>
1201
  <listitem><para>If the certificate is not used to login, the CN field of the client certificate is
1202
  not checked.</para>
1203
  </listitem>
1204
</orderedlist>
1205
</para>
1206
1207
1208
<para>
1209
The <computeroutput>nutcpc</computeroutput> client supports multiple options to achieve a strict verification of
1210
nuauth certificates:
1211
<itemizedlist>
1212
<listitem><para><option>-A</option>: Specify the authority file to use.</para></listitem>
1213
<listitem><para><option>-K</option>: Specify the key file to use.</para></listitem>
1214
<listitem><para><option>-C</option>: Specify the certificate file to use.</para></listitem>
1215
<listitem><para><option>-R</option>: Specify the certificate revocation list file to use. A nutcpc restart or a SIGHUP signal
1216
will be needed if you want change to the file to be taken into account.</para></listitem>
1217
<listitem><para><option>-H</option>: Fully qualified domain name of the nuauth server.</para></listitem>
1218
</itemizedlist>
1219
To sum up a typical nutcpc command line should look like:
1220
</para>
1221
<screen>nutcpc -H nuauth.nufw.org -A localCA-cacert.pem -K client.nufw.org-key.pem -C client.nufw.org-cert.pem -R localCA-crl.pem</screen>
1222
1223
<para>
1224
It is possible to use the configuration file <filename>nuclient.conf</filename> to specify value
1225
for these options and be able to run client without having to specify all
1226
options on the commandline. A typical <filename>nuclient.conf</filename> should look like.
1227
</para>
1228
1229
<screen>
1230
# Name of the nuauth server (fully qualified domain name, or IP address).
1231
nuauth_ip=nuauth.nufw.org
1232
# Certificate authority used to check the validity of nuauth certificate
1233
nuauth_tls_ca=/etc/nufw/localCA-cacert.pem
1234
# Certificate file used to negotiate the TLS connection to nuauth.
1235
nuauth_tls_cert=/etc/nufw/client.nufw.org-cert.pem
1236
# Key of the certificate file from the nuauth_tls_cert option.
1237
nuauth_tls_key=/etc/nufw/client.nufw.org-key.pem
1238
# Certificate revocation list file to use.
1239
nuauth_tls_crl=/etc/nufw/localCA-crl.pem
1240
</screen>
1241
1242
<para>
1243
To combine strict TLS usage and login/password authentication, the recommended setup for
1244
client certificate deploiement is to deploy a per-computer certificate with FQDN matching
1245
computer domain name with the associated CA and key in the configuration directory of NuFW
1246
(usually <filename>/etc/nufw/</filename>). By setting the correct values in
1247
<filename>/etc/nufw/nuclient.conf</filename> (as previously seen), the computer user will be
1248
able to run client without providing any options (omit for -U option which is needed if the local
1249
user name is different from the nuauth user name).
1250
</para>
1251
1252
1253
</section>
1254
1255
<section><title>Certificate authentication</title>
1256
<para>Certificates can be used to authenticate clients, if a user provides
1257
a client certificate during the TLS negotiation. Nuauth will extract the username
1258
based on the CN of the provided certificate. The username computation is made by taking the
1259
CN string till a slash or a comma is encountered. For example, for <computeroutput>admin/email=admin@inl.fr</computeroutput>,
1260
it will return <computeroutput>admin</computeroutput>.
1261
The obtained username must match a known user on the system.
1262
1263
Nuauth will check the certificate, and if
1264
validated, will mark the user as authenticated (no password asked). </para>
1265
<para>
1266
To activate this functionality, nuauth configuration file must include:
1267
<screen>nuauth_tls_auth_by_cert=1</screen>
1268
Note that, <option>nuauth_tls_request_cert</option> has to be set
1269
to 1 or 2 in the mean time. If set to 2, certificates authentication is
1270
mandatory.</para>
1271
</section>
1272
1273
1274
<section><title>Using secure LDAP (LDAPs) for ACLs checking</title>
1275
<para>
1276
If the LDAP server supports TLS connections, you should setup nuauth to
1277
have the LDAP acls checking module using LDAP over SSL.
1278
</para>
1279
<para>To do so, edit <filename>nuauth.conf</filename> and modify LDAP
1280
port to 636 (LDAPs):
1281
<screen>
1282
ldap_server_port=636
1283
</screen>
1284
Then, edit <filename>/etc/ldap/ldap.conf</filename> to indicate the policy used
1285
for SSL connections.
1286
If you only want to encrypt data, you can simply add to <filename>ldap.conf</filename>:
1287
<screen>
1288
TLS_REQCERT never
1289
</screen>
1290
The recommended setup is to fill in <filename>ldap.conf</filename> with the path to certificate authority.
1291
<filename>ldap.conf</filename> should look like:
1292
<screen>
1293
TLS_CACERT /etc/ldap/cacert-ldap.pem
1294
TLS_REQCERT demand
1295
</screen>
1296
Please note that the certificate must precisely match the hostname set in
1297
the <option>ldap_server_addr</option> option in <filename>nuauth.conf</filename>.
1298
</para>
1299
1300
<para>See the <ulink url="http://www.openldap.org/doc/admin24/tls.html">TLS section</ulink> in
1301
<ulink url="http://www.openldap.org/doc/admin24/">LDAP Configuration guide</ulink>, and
1302
<ulink url="http://www.openldap.org/faq/data/cache/185.html">OpenLDAP TLS FAQ</ulink>
1303
for more information.
1304
</para>
1305
1306
</section>
1307
1308
<section><title>OS and application filtering</title>
1309
<para>
1310
On client side, system needs to be trustworthy to perform
1311
valuable application and OS filtering. You must never forget that
1312
it is the application on client side which tells the application name as
1313
well as the operating system name and version: these informations CAN and WILL
1314
be spoofed if a malicious user installs a modified NuFW agent.
1315
</para>
1316
<para>Thus, the value of application and OS filtering depends on the trust you have
1317
on the system which issues the authentication. On a secure system (for ex. SELinux)
1318
where users can not install software, this sort of filtering is "quite
1319
secure".</para>
1320
      </section>
1321
1322
<section><title>Intrusion Detection System (IDS)</title>
1323
<para>NuFW is free software, and as such does not duplicate features from other softwares, but prefer
1324
to integrate with them, to benefit from their experience, and specific features.
1325
</para>
1326
1327
<para>For example, NuFW is a native Prelude<footnote><para>http://www.prelude-ids.com</para></footnote>
1328
sensor, using the <option>nuprelude</option> module.
1329
This allows to send alerts (user login success or failure, connections, etc.) to Prelude, and
1330
use correlation, for ex., to combine a Network IDS like Snort<footnote><para>http://www.snort.org/</para></footnote>.
1331
</para>
1332
1333
<para>See <ulink url="https://trac.prelude-ids.org/wiki/ManualUser">Prelude user manual</ulink>, and
1334
<ulink url="https://trac.prelude-ids.org/wiki/InstallingAgentThirdpartyNufw">Configuring NuFW for Prelude</ulink>
1335
for more information.
1336
</para>
1337
1338
</section>
1339
<note>
1340
 <para>It is to be noted that, for now, all TLS certificates of your installation must be signed by the same CA, for
1341
 valid checks to be performed. It is planned to implement support of chained CAs in a future release (possibly 2.2.20). Currently, using chained CAs might work, and might not. The behavior of NuFW with chained CA is considered to be unspecified for now.</para>
1342
</note>
1343
</section>
1344
<section id='nuauth_auth'><title id='nuauth_auth.title'>Nuauth authentication configurations</title>
1345
 <section><title>PAM/LDAP authentication with Nuauth</title>
1346
  <para>PAM is a very convenient way for extending authentication to "exotic"
1347
  directories. In particular, PAM lets one interface nuauth on NT domains,
1348
  Active Directory, Radius, etc.
1349
  </para>
1350
1351
<note>
1352
<para>When using PAM authentication for local users (<option>shadow</option> file),
1353
nuauth must run as root to be able to read system files. This is the only case where nuauth should be run as root !
1354
It is, however, advised, that you use a real directory (LDAP, Active Directory...) rather than authenticating users
1355
against the shadow file.
1356
</para>
1357
</note>
1358
1359
  <para>To have nuauth authenticate users based on PAM/ldap, use the <option>
1360
  system</option> user checking module in nuauth.conf:
1361
  <screen>nuauth_user_check_module="system"</screen>
1362
  </para>
1363
  <para>
1364
  In addition, PAM needs to be properly setup, which is external to NuFW, and
1365
  basically out of the scope of this document. Here are a couple of files to set
1366
  on Debian to get PAM/LDAP working with nuauth:
1367
  /etc/pam.d/nuauth:
1368
  <screen>#This is to set PAM-LDAP, modify to suit your needs!
1369
  auth    required      /lib/security/pam_env.so
1370
  auth    sufficient    /lib/security/pam_ldap.so
1371
  auth    required      /lib/security/pam_deny.so
1372
1373
  account required      /lib/security/pam_ldap.so
1374
1375
  session required      /lib/security/pam_limits.so
1376
  session optional      /lib/security/pam_ldap.so</screen>
1377
  The <filename>/etc/nsswitch.conf</filename> file also needs to be tuned:
1378
  <screen>#This is to set PAM-LDAP, modify to suit your needs!
1379
  passwd:         compat ldap
1380
  group:          compat ldap
1381
  </screen>
1382
  (leave the other lines unchanged).
1383
  And you probably also need to tune the /etc/pam_ldap.conf file. This file
1384
  works for us, provided there is no line beginning with "uri":
1385
  <screen>
1386
  host 127.0.0.1
1387
  ldap_version 3
1388
  scope one
1389
  pam_password crypt
1390
  nss_base_passwd         ou=Users,dc=nufw,dc=org?one
1391
  nss_base_group          ou=Group,dc=nufw,dc=org?one
1392
  </screen>
1393
  You also need to install and configure libnss-ldap.
1394
  Configuration that works for us (still on Debian) in /etc/libnss-ldap.conf:
1395
  <screen>
1396
  host 127.0.0.1
1397
  base replace_with_your_base
1398
  ldap_version 3
1399
  rootbinddn cn=admin,dc=replace_with_your_base
1400
  #Optional, set if you need these:
1401
  nss_base_passwd ou=users,dc=nufw,dc=org?one
1402
  nss_base_group ou=groups,dc=nufw,dc=org?one
1403
  </screen>
1404
  Of course, tune this to suit your needs, and be aware that these system
1405
  instructions may not be accurate for other distributions!
1406
  </para>
1407
1408
 </section>
1409
 <section><title>PAM/Winbind authentication with Nuauth</title>
1410
  <para>On Debian/Ubuntu, you will need the following packages:
1411
   <screen>
1412
    krb5-user
1413
    krb4-config
1414
    samba
1415
    winbind
1416
   </screen>
1417
  </para>
1418
  <para>The /etc/krb5.conf file should contain something like:
1419
   <screen>
1420
[libdefaults]
1421
        default_realm = DOMAIN.NAME
1422
# The following krb5.conf variables are only for MIT Kerberos.
1423
        krb4_config = /etc/krb.conf
1424
        krb4_realms = /etc/krb.realms
1425
        kdc_timesync = 1
1426
        ccache_type = 4
1427
        forwardable = true
1428
        proxiable = true
1429
1430
[realms]
1431
        DOMAIN.NAME = {
1432
                kdc = 10.0.122.5
1433
                admin_server = 10.0.122.5
1434
                default_domain = DOMAIN.NAME
1435
        }
1436
1437
[domain_realm]
1438
        .domain.name = DOMAIN.NAME
1439
        domain.name = DOMAIN.NAME
1440
        shortname = DOMAIN.NAME
1441
        .shortname = DOMAIN.NAME
1442
   </screen>
1443
  </para>
1444
  <para>It is very important that your system is time-synchronized with the AD/NT server. You should setup NTP to achieve this!
1445
  </para>
1446
  <para>
1447
  The /etc/samba/smb.conf file should also be customized:
1448
   <screen>
1449
[global]
1450
# Change this to the workgroup/NT-domain name your Samba server will part of
1451
   realm = DOMAIN.NAME
1452
   password server = AD-SERVER
1453
   netbios name = NUAUTH-SERVER
1454
   workgroup = SHORTNAME
1455
1456
# server string is the equivalent of the NT Description field
1457
   server string = %h server sexa-prn1 (Samba, Ubuntu)
1458
1459
####### Authentication #######
1460
1461
   security = ads
1462
   encrypt passwords = true
1463
   guest account = nobody
1464
1465
############ Misc ############
1466
1467
   socket options = TCP_NODELAY
1468
   domain master = no
1469
1470
# Some defaults for winbind (make sure you're not using the ranges
1471
# for something else.)
1472
   idmap uid = 10000-20000
1473
   idmap gid = 10000-20000
1474
   template shell = /bin/bash
1475
1476
   template homedir = /home/%D/%U
1477
   client use spnego = yes
1478
   client ntlmv2 auth = yes
1479
   restrict anonymous = 2
1480
   </screen>
1481
  </para>
1482
  <para>To join the Windows Domain:
1483
<screen>
1484
kinit administrator@DOMAIN.NAME
1485
1486
net ads join -U administrator
1487
</screen>
1488
  The last command should display the short domain name, and should specify that the machine was successfully added to the domain.
1489
  </para>
1490
  <para>Winbind (or winbindd) should be running on your system. You can check things are going fine by reading samba logs (probably in /var/log/samba/*).</para>
1491
1492
  <para>You will then have to declare that you want to use winbind authentication for nuauth by cooking a <filename>/etc/pam.d/nuauth</filename> file:
1493
  <screen>#This is to set PAM-winbind, modify to suit your needs!
1494
  auth    required      /lib/security/pam_env.so
1495
  auth    sufficient    /lib/security/pam_winbind.so
1496
  auth    required      /lib/security/pam_deny.so
1497
1498
  account required      /lib/security/pam_winbind.so
1499
1500
  session required      /lib/security/pam_limits.so
1501
  session optional      /lib/security/pam_winbind.so</screen>
1502
  </para>
1503
  <para>
1504
   To be able to use winbind group fetching, the <filename>/etc/nsswitch.conf</filename> file should look like:
1505
   <screen>
1506
passwd:         compat winbind
1507
group:          compat winbind
1508
shadow:         compat
1509
1510
hosts:          files dns mdns
1511
networks:       files
1512
1513
protocols:      db files
1514
services:       db files
1515
ethers:         db files
1516
rpc:            db files
1517
1518
netgroup:       nis
1519
   </screen>
1520
  </para>
1521
1522
 </section>
1523
</section>
1524
  </chapter>
1525
<chapter><title>Authentication Agents</title>
1526
<section><title>Supported OSes</title>
1527
<section><title>Windows</title>
1528
<para>NuWinC (NuFW Windows Client) provides NuFW authentication for Microsoft Windows 95/98/NT/2000/XP/2003/Vista. This software is available from <ulink url="http://inl.fr/">INL</ulink>. NuWinC can provide, when installed on machines of a Windows domain, a 100% transparent behavior, meaning users will not even notice it starting or running. For more information about NuWinC, see <ulink url="http://www.inl.fr/NuWINc,68.html">http://www.inl.fr/NuWINc,68.html</ulink>.</para>
1529
</section>
1530
<section><title>Linux</title>
1531
<para>Several clients run on Linux :
1532
<orderedlist>
1533
<listitem><para>nutcpc : the lightest, command line agent.</para></listitem>
1534
<listitem><para>Nuapplet2 : The graphical client.</para></listitem>
1535
<listitem><para>PAM authentication, through the pam_nufw module. This provides transparent authentication on nuauth.</para></listitem>
1536
</orderedlist>
1537
</para>
1538
</section>
1539
<section><title>MacOS</title>
1540
<para>MacOS X is supported by the Nuapplet2 graphical client. The nutcpc command line client also runs on MacOS X.</para>
1541
</section>
1542
<section><title>UNIX and BSD systems</title>
1543
<para>
1544
nutcpc is known to work on FreeBSD. For other systems, test feedbacks are greatly welcome! Porting NuFW agents to *NIX systems should be fairly easy, too.
1545
</para>
1546
</section>
1547
</section>
1548
<section><title>pam_nufw</title>
1549
<para>
1550
The <command>pam_nufw</command> PAM module enables transparent user authentication to NuFW. Of course, this will only work if the login and password you use to login to
1551
the <command>pam_nufw</command> system are the same as requested by <command>nuauth</command>, ie in your user directory!
1552
</para>
1553
<section><title>Options</title>
1554
<para>
1555
pam_nufw accepts the following command line options:
1556
<itemizedlist>
1557
<listitem><para><option>server=<replaceable>nuauth_ip</replaceable></option>: Nuauth server IP/hostname</para></listitem>
1558
<listitem><para><option>port=<replaceable>nuauth_port</replaceable></option>: Nuauth port/service name</para></listitem>
1559
<listitem><para><option>lock=<replaceable>.pam_nufw</replaceable></option>: Lock filename</para></listitem>
1560
<listitem><para><option>noauth=<replaceable>user1,user2,(...)</replaceable></option>: Don't authenticate these users.</para></listitem>
1561
</itemizedlist>
1562
</para>
1563
<para>
1564
Default values:
1565
<itemizedlist>
1566
<listitem><para><option>port</option> is 4129</para></listitem>
1567
<listitem><para><option>lockfile</option> is <filename>.pam_nufw</filename>, located in <filename>$HOME/.nufw/</filename></para></listitem>
1568
</itemizedlist>
1569
1570
</para>
1571
</section>
1572
<section><title>Configuration file example</title>
1573
<para>
1574
PAM configuration files are located in <filename>/etc/pam.d/</filename>. Each program which uses PAM
1575
may have its own file (eg. /etc/pam.d/ssh and /etc/pam.d/kdm) ; it is up to the administrator to choose which programs should
1576
trigger the pam_nufw authentication. Of course, requisite are :
1577
<itemizedlist>
1578
<listitem><para>The program concerned by the configuration is about opening a session.</para></listitem>
1579
<listitem><para>The program concerned by the configuration runs on the userID you want to authenticate connections for.</para></listitem>
1580
<listitem><para>The authentication is performed through a login and password.</para></listitem>
1581
</itemizedlist>
1582
A typical configuration
1583
file looks like this:
1584
<screen>
1585
 #%PAM-1.0
1586
 auth    requisite       pam_nologin.so
1587
 auth    required        pam_env.so
1588
 @include common-auth
1589
 auth optional pam_nufw.so server=nuauth.inl.fr port=4129
1590
 @include common-account
1591
 session required        pam_limits.so
1592
 @include common-session
1593
 session optional pam_nufw.so server=nuauth.inl.fr port=4129
1594
 @include common-password
1595
</screen>
1596
We use auth because we have to know user's password in order to authenticate
1597
on nuauth. The pam module closes the connection to nuauth when the application
1598
closes the pam session. You can comment out the session line to suppress disconnection at
1599
logout.
1600
<note>
1601
 <para>Make sure you use the same lock file for all pam_nufw config files on a given system, or connections will be authenticated multiple times.
1602
 </para>
1603
</note>
1604
</para>
1605
<para>
1606
<command>pam_nufw</command> respects the <filename>nuclient.conf</filename> configuration file
1607
for all options. See section <link linkend='hardening' endterm="hardening.title"/> for more information
1608
about <filename>nuclient.conf</filename> usage and TLS setup.
1609
</para>
1610
</section>
1611
</section>
1612
</chapter>
1613
<chapter><title>Miscellaneous</title>
1614
<section><title>Supported protocols</title>
1615
<para>The NuFW daemons can virtually support any protocol, provided a stateful inspection exists
1616
in Netfilter to deal with the given protocol. However, the main concern about protocol support is client-side.
1617
<itemizedlist>
1618
<listitem><para><option>TCP</option>: TCP is supported by all existing clients (Linux, MacOS X, Windows).</para></listitem>
1619
<listitem><para><option>UDP</option>: Requires some administrator operations, for now only the Windows client supports UDP.</para></listitem>
1620
<listitem><para><option>ICMP</option>: Uses raw socket. We are unsure whether this can be authenticated at all. For now, no client supports ICMP.</para></listitem>
1621
<listitem><para><option>IPv6</option>: IPv6 is supported since branch 2.2, with the same restrictions as IPv4.</para></listitem>
1622
<listitem><para><option>other</option>: No support. Contact us if you feel some other protocol could be supported.</para></listitem>
1623
</itemizedlist>
1624
</para>
1625
</section>
1626
<section><title>Big endian architectures</title>
1627
<para>Big endian architectures are supported since version 1.0.11. Prior
1628
releases do not work on big endian.</para>
1629
</section>
1630
<section><title>System with glibc 2.3.2</title>
1631
<para>
1632
Glibc 2.3.2 is buggy and you need to set
1633
<option>system_glibc_cant_guess_maxgroups</option> to the maximum number of groups
1634
for a single user.
1635
</para>
1636
</section>
1637
<section><title>Linux distributions specific</title>
1638
<para>Packages can be provided by some distributions. However,
1639
these packages can be modified by the maintainer, or might not be up to date, so
1640
check the local modifications carefully.
1641
</para>
1642
<para>
1643
While these packages can be good, it is encouraged to use the official releases from
1644
nufw.org, which are officially supported by the developers.
1645
</para>
1646
      </section>
1647
<section><title>Debian specific</title>
1648
<para>NuFW packages are part of the Debian main distribution.</para>
1649
<note><para>However, we recommend that you use the latest available NuFW version. Debian packages are available at <ulink url="http://packages.inl.fr/">packages.inl.fr</ulink></para>
1650
</note>
1651
      </section>
1652
<section><title>Mandrake specific</title>
1653
<para>NuFW is packaged in Mandriva Corporate Server 4.</para>
1654
      </section>
1655
<section><title>Suse specific</title>
1656
<para>Suse version 9 seems to use a very old Glib, which is not compatible with
1657
NuFW. It seems this is true for all Suse versions until v9.</para>
1658
      </section>
1659
<section><title>Redhat specific</title>
1660
<section><title>RedHat Enterprise Linux 4</title>
1661
<para>As RHEL4 is shipped with a 2.6.9 kernel that is subject to the ip_queue
1662
problem mentioned later in this document. With this
1663
kernel the bug occurs systematically (at least on SMP machines).</para>
1664
</section>
1665
      </section>
1666
<section><title>Known issues</title>
1667
<section><title>Problem with ip_queue on kernel prior to 2.6.12</title>
1668
<para>
1669
There's an ip_queue bug on kernels prior to 2.6.12. It can hang the system when an ACCEPT decision is done
1670
on the INPUT chain. Thus DO NOT use a QUEUE target on INPUT with these kernels or it could freeze your computer.
1671
And anyway, you should use a recent kernel and NFQUEUE, as explained here-up in this howto.
1672
</para>
1673
</section>
1674
<section><title>Running NuFW in a bridged network</title>
1675
<para>NuFW should run seamlessly in bridge networking. However it seems a bug in some kernel does not allow the use of
1676
nfnetlink without problems. The following facts were reported (with NuFW 2.2.14, but NuFW versioning is not the matter) :
1677
<itemizedlist>
1678
<listitem><para><option>Kernel 2.6.22</option> BUG : No network traffic when launching the nufw daemon.</para></listitem>
1679
<listitem><para><option>Kernel 2.6.24</option> Everything works.</para></listitem>
1680
</itemizedlist>
1681
</para>
1682
</section>
1683
      </section>
1684
  </chapter>
1685
  <chapter><title>Appendix</title>
1686
 <section id="FinerTLS"><title id="FinerTLS.title">Managing finer TLS settings with NuFW</title>
1687
<para>
1688
<xref linkend="nufw-tls"/> describes the TLS options that the nufw daemon accepts. All these options are accepted since the 2.2.18 release (some options existed earlier).
1689
<table border="1" id="nufw-tls">
1690
<title>nufw daemon (command line) TLS options resume</title>
1691
<tgroup cols="2">
1692
<colspec colnum="1" colname="col1" colwidth="4em"/>
1693
<thead>
1694
  <row>
1695
    <entry>Option</entry>
1696
    <entry>Description</entry>
1697
  </row>
1698
</thead>
1699
<tbody>
1700
  <row>
1701
    <entry>-k</entry>
1702
    <entry>specifies as argument the filename of the (private) key to use.</entry>
1703
  </row>
1704
  <row>
1705
    <entry>-c</entry>
1706
    <entry>specifies as argument the filename of the (public) certificate to use.</entry>
1707
  </row>
1708
  <row>
1709
    <entry>-a</entry>
1710
    <entry>specifies as argument the filename of the certificate authority file.</entry>
1711
  </row>
1712
  <row>
1713
    <entry>-N</entry>
1714
    <entry>If you use this switch, nufw will skip the nuauth CN check.</entry>
1715
  </row>
1716
  <row>
1717
    <entry>-r</entry>
1718
    <entry>specifies as argument the filename of the certificate revocation list. The daemon will also re-read the revocation list if it is disconnected from nuauth and needs to reconnect. Since 2.2.19, nufw reloads this file when receiving a HUP signal.</entry>
1719
  </row>
1720
  <row>
1721
    <entry>-n</entry>
1722
    <entry>specifies as argument the string of the expected DN that should be received by nuauth. The DN advertised by nuauth will have to match the string exactly, else nufw will drop the connection. If you do not specify this option, the DN of the certificate will be checked against the FQDN of the nuauth server (nufw will obtain it from a reverse DNS lookup on nuauth IP address).</entry>
1723
  </row>
1724
  <row>
1725
    <entry>-S</entry>
1726
    <entry>Request that nufw strictly validates the TLS connection when opening the connection to the nuauth server. This means that the nuauth certificate has to be signed by the CA, that it is not revoked, and that the DN of the certificate is also checked (see the <command>-n</command>) option. Since 2.2.18, this is the default behaviour of the nufw daemon.</entry>
1727
  </row>
1728
  <row>
1729
    <entry>-s</entry>
1730
    <entry>Opposite of <command>-S</command>. This means all TLS checks are disabled. Use at your own risk!!</entry>
1731
  </row>
1732
</tbody>
1733
</tgroup>
1734
</table>
1735
</para>
1736
<para>
1737
<xref linkend="nuauth-tls"/> describes the TLS options that the nuauth daemon accepts (in nuauth.conf). All these options are accepted since the 2.2.18 release (some options existed earlier).
1738
<table id="nuauth-tls" border="1">
1739
<title>nuauth daemon configuration TLS options resume</title>
1740
<tgroup cols="2">
1741
<colspec colnum="1" colname="col1" colwidth="17em"/>
1742
<thead>
1743
  <row>
1744
    <entry>Option</entry>
1745
    <entry>Description</entry>
1746
  </row>
1747
</thead>
1748
<tbody>
1749
  <row>
1750
    <entry>nuauth_tls_key</entry>
1751
    <entry>specifies as argument the filename of the (private) key to use.</entry>
1752
  </row>
1753
  <row>
1754
    <entry>nuauth_tls_cert</entry>
1755
    <entry>specifies as argument the filename of the (public) certificate to use.</entry>
1756
  </row>
1757
  <row>
1758
    <entry>nuauth_tls_cacert</entry>
1759
    <entry>specifies as argument the filename of the certificate authority file.</entry>
1760
  </row>
1761
  <row>
1762
    <entry>nuauth_tls_crl</entry>
1763
    <entry>specifies as argument the filename of the certificate revocation list.</entry>
1764
  </row>
1765
  <row>
1766
    <entry>nuauth_tls_crl_refresh</entry>
1767
    <entry>specifies the time period (in seconds) at which nuauth refreshes the <command>nuauth_tls_crl</command> file.</entry>
1768
  </row>
1769
  <row>
1770
    <entry>nuauth_tls_request_cert</entry>
1771
    <entry>Whether nuauth performs TLS checks. Since 2.2.18, the default value is <command>2</command>, which means that all certificates need to be signed by the CA, must not have expired, and must not be revoked. If you specify <command>0</command>, nuauth will perform no TLS check at all (use at your own risk!!). If you specify <command>1</command>, nuauth will ask the clients and nufw to provide a certificate, but will not fail if no certificate is provided. You should always use the default setting of <command>2</command> if you want a safe installation!</entry>
1772
  </row>
1773
  <row>
1774
    <entry>nuauth_tls_disable_request_warning</entry>
1775
    <entry>If you set <command>nuauth_tls_request_cert</command> to an insecure value, nuauth will complain in the log everytime a client connects, but will not reject connections. If you want to prevent such logging from nuauth, you can set this option to <command>1</command>. The default value is <command>0</command>.</entry>
1776
  </row>
1777
  <row>
1778
    <entry>nuauth_tls_disable_nufw_fqdn_check</entry>
1779
    <entry>If you set <command>nuauth_tls_request_cert</command> to <command>2</command> (the default value), the nufw daemon certificate DN will be checked against the nufw fully qualified domain name (which nuauth obtains thanks to a reverse DNS lookup). If they do not match, nuauth will reject the connection. You can set this parameter to <command>1</command> if you want nuauth to accept the connection without checking this match.</entry>
1780
  </row>
1781
  <row>
1782
    <entry>nuauth_tls_auth_by_cert</entry>
1783
    <entry>This lets clients authenticate with a certificate, rather than with a login/password.</entry>
1784
  </row>
1785
 </tbody>
1786
 </tgroup>
1787
</table>
1788
</para>
1789
<para>
1790
<xref linkend="nutcpc-tls"/> describes the TLS options that the nutcpc client accepts on command line. All these options are accepted since the 2.2.18 release (some options existed earlier).
1791
You can also get nutcpc to read configuration from <command>nuclient.conf</command> config file (see below).
1792
<table id="nutcpc-tls" border="1">
1793
<title>nutcpc command line TLS options resume</title>
1794
<tgroup cols="2">
1795
<colspec colnum="1" colname="col1" colwidth="4em"/>
1796
<thead>
1797
  <row>
1798
    <entry>Option</entry>
1799
    <entry>Description</entry>
1800
  </row>
1801
</thead>
1802
<tbody>
1803
  <row>
1804
    <entry>-C</entry>
1805
    <entry>specifies as argument the filename of the (public) certificate to use.</entry>
1806
  </row>
1807
  <row>
1808
    <entry>-A</entry>
1809
    <entry>specifies as argument the filename of the certificate authority file.</entry>
1810
  </row>
1811
  <row>
1812
    <entry>-K</entry>
1813
    <entry>specifies as argument the filename of the (private) key.</entry>
1814
  </row>
1815
  <row>
1816
    <entry>-W</entry>
1817
    <entry>if you use a keyfile (with <command>-K</command>), and it is password-protected, you can specify the password to use with this switch. Use with <command>-q</command> for security reasons.</entry>
1818
  </row>
1819
  <row>
1820
    <entry>-R</entry>
1821
    <entry>specifies as argument the filename of the certificate revocation list. This file is only checked when nutcpc is launched : you currently need to stop and restart nutcpc if the revocation list is changed. Since 2.2.19, nutcpc reloads this file when receiving a HUP signal.</entry>
1822
  </row>
1823
  <row>
1824
    <entry>-a</entry>
1825
    <entry>specifies as argument the string to use to check the CN nuauth certificate contains. If you do not use this option, nuauth certificate DN will be checked against nuauth fully qualified domain name, which will be found by performing a reverse DNS lookup on nuauth IP address.</entry>
1826
  </row>
1827
  <row>
1828
    <entry>-N</entry>
1829
    <entry>If you use this switch, nutcpc will skip the nuauth CN check.</entry>
1830
  </row>
1831
  <row>
1832
    <entry>-Q</entry>
1833
    <entry>By default, nutcpc leaves with an error if the CA is not configured (see <command>-A</command>), and (since 2.2.19) forces user to type "yes" to bypass the warning. If you use this option, the problem will be ignored. Use at your own risk!!</entry>
1834
  </row>
1835
 </tbody>
1836
 </tgroup>
1837
</table>
1838
</para>
1839
<para>
1840
<xref linkend="nuclient-tls"/>  describes the TLS options that the libnuclient client accepts on command line. All these options are accepted since the 2.2.18 release (some options existed earlier).
1841
Currently, these options work with nutcpc, as well as nuapplet.
1842
</para>
1843
<para>
1844
<table border="1" id="nuclient-tls">
1845
<title>nuclient.conf TLS options resume</title>
1846
<tgroup cols="2">
1847
<colspec colnum="1" colname="col1" colwidth="15em"/>
1848
<thead>
1849
  <row>
1850
    <entry>Option</entry>
1851
    <entry>Description</entry>
1852
  </row>
1853
</thead>
1854
<tbody>
1855
  <row>
1856
    <entry>nuauth_tls_cert</entry>
1857
    <entry>specifies as argument the filename of the (public) certificate to use.</entry>
1858
  </row>
1859
  <row>
1860
    <entry>nuauth_tls_ca</entry>
1861
    <entry>specifies as argument the filename of the certificate authority file.</entry>
1862
  </row>
1863
  <row>
1864
    <entry>nuauth_tls_key</entry>
1865
    <entry>specifies as argument the filename of the (private) key.</entry>
1866
  </row>
1867
  <row>
1868
    <entry>nuauth_tls_crl</entry>
1869
    <entry>specifies as argument the filename of the certificate revocation list. This file is checked when the client is launched, and anytime the client is disconnected from nuauth and needs to reconnect.</entry>
1870
  </row>
1871
  <row>
1872
    <entry>nuauth_suppress_fqdn_verif</entry>
1873
    <entry>If set to <command>1</command>, the client will skip the nuauth CN check.</entry>
1874
  </row>
1875
 </tbody>
1876
 </tgroup>
1877
</table>
1878
</para>
1879
1880
 </section>
1881
  </chapter>
1882
1883
  <glossary>
1884
    <glossentry><glossterm>nufw</glossterm>
1885
      <indexterm><primary>nufw</primary></indexterm>
1886
      <glossdef>
1887
        <para>nufw is the server running on the firewall which receives the packets coming from
1888
kernel and send them to the authentication server and wait a response.</para>
1889
      </glossdef>
1890
    </glossentry>
1891
    <glossentry><glossterm>nuauth</glossterm>
1892
      <indexterm><primary>nuauth</primary></indexterm>
1893
      <glossdef>
1894
        <para>nuauth is the authentication server which receives the packets coming from
1895
nufw and the packets coming from user and send back a decision to nufw.</para>
1896
      </glossdef>
1897
    </glossentry>
1898
  </glossary>
1899
</book>