File: auth.en.xml

package info (click to toggle)
debian-reference 2.24
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 20,088 kB
  • ctags: 35
  • sloc: xml: 70,510; sh: 616; makefile: 352; perl: 221; sed: 3
file content (975 lines) | stat: -rw-r--r-- 45,975 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
<?xml version='1.0'?>
<!-- -*- DocBook -*- -->
<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
    "/usr/share/sgml/docbook/dtd/xml/4.2/docbookx.dtd" [
 <!ENTITY % sgml.features "IGNORE">
 <!ENTITY % xml.features  "INCLUDE">
 <!ENTITY % dbcent PUBLIC
      "-//OASIS//ENTITIES DocBook Character Entities V4.2//EN"
      "/usr/share/sgml/docbook/dtd/xml/4.2/dbcentx.mod"> %dbcent;
 <!ENTITY % commondata     SYSTEM "../common.ent"      > %commondata;
 <!ENTITY % popcon         SYSTEM "../popcon.ent"      > %popcon;
 <!ENTITY % pkgsize        SYSTEM "../pkgsize.ent"     > %pkgsize;
 <!ENTITY % urlsdata       SYSTEM "../urls.ent"        > %urlsdata;
]>
<chapter id="authentication">
    <title>Authentication</title>
    <para/>
    <section id="normalunixauthentication">
      <title>Normal Unix authentication</title>
      <para>Normal Unix authentication is provided by the <code>pam_unix.so</code> method under the <ulink url="&pampluggableauthnticationmodules;">PAM (Pluggable Authentication Modules)</ulink>. Its 3 important configuration files, with "<code>:</code>" separated entries, are: </para>
      <table id="thedimportantconilesforpam_unixo">
        
        <title> The 3 important configuration files for pam_unix.o. </title><tgroup x-pkgname=" " x-popcon=" " x-pkgsize=" " cols="5">
          <colspec colname="xxx1"/>
          <colspec colname="xxx2"/>
          <colspec colname="xxx3"/>
          <colspec colname="xxx4"/>
          <colspec colname="xxx5"/>
          <thead><row>
              <entry>
                <para>
                  <emphasis role="strong">file</emphasis>
                </para>
              </entry>
              <entry>
                <para>
                  <emphasis role="strong">permission</emphasis>
                </para>
              </entry>
              <entry>
                <para>
                  <emphasis role="strong">user</emphasis>
                </para>
              </entry>
              <entry>
                <para>
                  <emphasis role="strong">group</emphasis>
                </para>
              </entry>
              <entry>
                <para>
                  <emphasis role="strong">description</emphasis>
                </para>
              </entry>
            </row></thead><tbody><row>
              <entry>
                <para>
                  <code>/etc/passwd</code>
                </para>
              </entry>
              <entry>
                <para>
                  <code>-rw-r--r--</code>
                </para>
              </entry>
              <entry>
                <para>
                  <code>root</code>
                </para>
              </entry>
              <entry>
                <para>
                  <code>root</code>
                </para>
              </entry>
              <entry>
                <para> The (sanitized) user account information. </para>
              </entry>
            </row><row>
              <entry>
                <para>
                  <code>/etc/shadow</code>
                </para>
              </entry>
              <entry>
                <para>
                  <code>-rw-r-----</code>
                </para>
              </entry>
              <entry>
                <para>
                  <code>root</code>
                </para>
              </entry>
              <entry>
                <para>
                  <code>shadow</code>
                </para>
              </entry>
              <entry>
                <para> The secure user account information. </para>
              </entry>
            </row><row>
              <entry>
                <para>
                  <code>/etc/group</code>
                </para>
              </entry>
              <entry>
                <para>
                  <code>-rw-r--r--</code>
                </para>
              </entry>
              <entry>
                <para>
                  <code>root</code>
                </para>
              </entry>
              <entry>
                <para>
                  <code>root</code>
                </para>
              </entry>
              <entry>
                <para> The group information. </para>
              </entry>
            </row></tbody>
        </tgroup>
      </table>
      <para>The <code>/etc/passwd</code> file contains: </para>
      <screen>...
user1:x:1000:1000:User1 Name,,,:/home/user1:/bin/bash
user2:x:1001:1001:User2 Name,,,:/home/user2:/bin/bash
...
</screen>
      <para>As  explained in <code>man 5 passwd</code>, each "<code>:</code>" separated entry of this file means: </para>
      <itemizedlist>
        <listitem><para>login name </para></listitem>
        <listitem><para>password specification entry </para></listitem>
        <listitem><para>numerical user ID </para></listitem>
        <listitem><para>numerical group ID </para></listitem>
        <listitem><para>user name or comment field </para></listitem>
        <listitem><para>user home directory </para></listitem>
        <listitem><para>optional user command interpreter </para></listitem>
      </itemizedlist>
      <para>The second entry of <code>/etc/passwd</code> was used for the encrypted password entry.  After the introduction of <code>/etc/shadow</code>, this entry is used for the password specification entry. </para>
      <table id="thesecondentrycontentofetcpasswd">
        
        <title> The second entry content of /etc/passwd. </title><tgroup x-pkgname=" " x-popcon="" x-pkgsize="" cols="2">
          <colspec colname="xxx1"/>
          <colspec colname="xxx2"/>
          <thead><row>
              <entry>
                <para>
                  <emphasis role="strong">content</emphasis>
                </para>
              </entry>
              <entry>
                <para>
                  <emphasis role="strong">meaning</emphasis>
                </para>
              </entry>
            </row></thead><tbody><row>
              <entry>
                <para> (empty) </para>
              </entry>
              <entry>
                <para> passwordless account </para>
              </entry>
            </row><row>
              <entry>
                <para> x </para>
              </entry>
              <entry>
                <para> the encrypted password is in the <code>/etc/shadow</code> file </para>
              </entry>
            </row><row>
              <entry>
                <para> * </para>
              </entry>
              <entry>
                <para> no login for this account </para>
              </entry>
            </row><row>
              <entry>
                <para> ! </para>
              </entry>
              <entry>
                <para> no login for this account </para>
              </entry>
            </row></tbody>
        </tgroup>
      </table>
      <para>The <code>/etc/shadow</code> file contains: </para>
      <screen>...
user1:$1$Xop0FYH9$IfxyQwBe9b8tiyIkt2P4F/:13262:0:99999:7:::
user2:$1$vXGZLVbS$ElyErNf/agUDsm1DehJMS/:13261:0:99999:7:::
...
</screen>
      <para>As explained in <code>man 5 shadow</code>, each "<code>:</code>" separated entry of this file means: </para>
      <itemizedlist>
        <listitem><para>login name </para></listitem>
        <listitem>
          <para>encrypted password.  The initial "<code>$1$</code>" indicates use of the MD5 encryption. The "*" indicate no login. </para>
        </listitem>
        <listitem><para>days since Jan 1, 1970 that password was last changed </para></listitem>
        <listitem><para>days before password may be changed </para></listitem>
        <listitem><para>days after which password must be changed </para></listitem>
        <listitem><para>days before password is to expire that user is warned </para></listitem>
      </itemizedlist>
      <para>The <code>/etc/group</code> file contains: </para>
      <screen>...
group1:x:20:user1,user2
...
</screen>
      <para>As explained in <code>man 5 shadow</code>, each "<code>:</code>" separated entry of this file means: </para>
      <itemizedlist>
        <listitem><para>group name </para></listitem>
        <listitem><para>encrypted password (not really used) </para></listitem>
        <listitem><para>numerical group ID. </para></listitem>
        <listitem><para>"," separated list of user names. </para></listitem>
      </itemizedlist>
      <para>The <code>/etc/gshadow</code> file provides the similar function as the <code>/etc/shadow</code> file for the <code>/etc/group</code> file but is not really used. </para>
      <note><para> The actual group membership of a user may be dynamically added if "auth optional pam_group.so" line is added to <code>/etc/pam.d/common-auth</code> and set it in <code>/etc/security/group.conf</code>.  See <code>pam_group</code>(8). </para></note>
      <note><para> The <code>base-passwd</code> package contains an authoritative list of the user and the group: <code>/usr/share/doc/base-passwd/users-and-groups.html</code>. </para></note>
      <para/>
    </section>
    <section id="manageaccountandswordinformation">
      <title>Manage account and password information</title>
      <para>Here are few notable commands to manage account information: </para>
      <table id="listofcommandstocountinformation">
        
        <title> List of commands to manage account information. </title><tgroup x-pkgname=" " x-popcon="" x-pkgsize="" cols="2">
          <colspec colname="xxx1"/>
          <colspec colname="xxx2"/>
          <thead><row>
              <entry>
                <para>
                  <emphasis role="strong">command</emphasis>
                </para>
              </entry>
              <entry>
                <para>
                  <emphasis role="strong">function</emphasis>
                </para>
              </entry>
            </row></thead><tbody><row>
              <entry>
                <para>
                  <code>getent passwd &lt;user_name&gt;</code>
                </para>
              </entry>
              <entry>
                <para> browse account information of <code>&lt;user_name&gt;</code> </para>
              </entry>
            </row><row>
              <entry>
                <para>
                  <code>getent shadow &lt;user_name&gt;</code>
                </para>
              </entry>
              <entry>
                <para> browse shadowed account information of <code>&lt;user_name&gt;</code> </para>
              </entry>
            </row><row>
              <entry>
                <para>
                  <code>getent group &lt;group_name&gt;</code>
                </para>
              </entry>
              <entry>
                <para> browse group information of <code>&lt;group_name&gt;</code> </para>
              </entry>
            </row><row>
              <entry>
                <para>
                  <code>passwd</code>
                </para>
              </entry>
              <entry>
                <para> manage password for the account </para>
              </entry>
            </row><row>
              <entry>
                <para>
                  <code>passwd -e</code>
                </para>
              </entry>
              <entry>
                <para> set one-time password for the account activation </para>
              </entry>
            </row><row>
              <entry>
                <para>
                  <code>chage</code>
                </para>
              </entry>
              <entry>
                <para> manage password aging information </para>
              </entry>
            </row></tbody>
        </tgroup>
      </table>
      <para>You may need to have the root privilege for some functions to work. See <code>man 3 crypt</code> for the password and data encryption. </para>
      <note><para> On the system set up with PAM and NSS as the Debian <ulink url="&alioth;">alioth</ulink> machine, the content of the local <code>/etc/passwd</code>, <code>/etc/group</code> and <code>/etc/shadow</code> files may not be actively used by the system thus requiring above commands to be used instead of the editor. </para></note>
      <para/>
    </section>
    <section id="goodpassword">
      <title>Good password</title>
      <para>When creating an account during your system installation or with the <code>passwd</code>(1) command, you should choose a <ulink url="&goodpassword;">good password</ulink> which consists of 6 to 8 characters including one or more characters from each of the following sets (per the <code>passwd</code>(1) manpage): </para>
      <itemizedlist>
        <listitem><para>lower case alphabetics </para></listitem>
        <listitem><para>digits 0 through 9 </para></listitem>
        <listitem><para>punctuation marks </para></listitem>
      </itemizedlist>
      <warning><para> Do not chose guessable words for the password. </para></warning>
      <para/>
    </section>
    <section id="creatingencryptedpassword">
      <title>Creating encrypted password</title>
      <para>There are independent tools to generate encrypted password with salt: </para>
      <table id="listoftoolstogeneratepassword">
        
        <title> List of tools to generate password. </title><tgroup x-pkgname=" 1 " x-popcon=" 2 " x-pkgsize=" 3 " cols="5">
          <colspec colname="xxx1"/>
          <colspec colname="xxx2"/>
          <colspec colname="xxx3"/>
          <colspec colname="xxx4"/>
          <colspec colname="xxx5"/>
          <thead><row>
              <entry>
                <para>
                  <emphasis role="strong">package</emphasis>
                </para>
              </entry>
              <entry>
                <para>
                  <emphasis role="strong">popcon</emphasis>
                </para>
              </entry>
              <entry>
                <para>
                  <emphasis role="strong">size</emphasis>
                </para>
              </entry>
              <entry>
                <para>
                  <emphasis role="strong">command</emphasis>
                </para>
              </entry>
              <entry>
                <para>
                  <emphasis role="strong">function</emphasis>
                </para>
              </entry>
            </row></thead><tbody><row>
              <entry>
                <para>
                  <code>whois</code>
                </para>
              </entry>
              <entry><para>&pop-whois;</para></entry>
              <entry><para>&size-whois;</para></entry>
              <entry>
                <para>
                  <code>mkpasswd</code>
                </para>
              </entry>
              <entry>
                <para>over-featured front end to the <code>crypt</code>(3) library </para>
              </entry>
            </row><row>
              <entry>
                <para>
                  <code>openssl</code>
                </para>
              </entry>
              <entry><para>&pop-openssl;</para></entry>
              <entry><para>&size-openssl;</para></entry>
              <entry>
                <para>
                  <code>openssl passwd</code>
                </para>
              </entry>
              <entry>
                <para> compute password hashes (OpenSSL). <code>passwd</code>(1ssl) </para>
              </entry>
            </row></tbody>
        </tgroup>
      </table>
      <para/>
    </section>
    <section id="pamandnss">
      <title>PAM and NSS</title>
      <para>Modern Unix-like systems such as the Debian system provide <ulink url="&pampluggableauthnticationmodules;">PAM (Pluggable Authentication Modules)</ulink> and <ulink url="&nssnameserviceswitch;">NSS (Name Service Switch)</ulink> mechanism to the local system administrator to configure his system.  The role of these can be summarizes as: </para>
      <itemizedlist>
        <listitem><para>PAM offers a flexible authentication mechanism used by the application software thus involves password data exchange. </para></listitem>
        <listitem>
          <para>NSS offers a flexible name service mechanism which is frequently used by the C library to obtain the user and group name for programs such as <code>ls</code> and <code>id</code>. </para>
        </listitem>
      </itemizedlist>
      <para>These PAM and NSS systems need to be configured consistently. </para>
      <para>The notable packages of PAM and NSS systems are: </para>
      <table id="listofnotablepamandnsssystems">
        
        <title> List of notable PAM and NSS systems. </title><tgroup x-pkgname=" 1 " x-popcon=" 2 " x-pkgsize=" 3 " cols="4">
          <colspec colname="xxx1"/>
          <colspec colname="xxx2"/>
          <colspec colname="xxx3"/>
          <colspec colname="xxx4"/>
          <thead><row>
              <entry>
                <para>
                  <emphasis role="strong">package</emphasis>
                </para>
              </entry>
              <entry>
                <para>
                  <emphasis role="strong">popcon</emphasis>
                </para>
              </entry>
              <entry>
                <para>
                  <emphasis role="strong">size</emphasis>
                </para>
              </entry>
              <entry>
                <para>
                  <emphasis role="strong">description</emphasis>
                </para>
              </entry>
            </row></thead><tbody><row>
              <entry>
                <para>
                  <code>libpam-modules</code>
                </para>
              </entry>
              <entry><para>&pop-libpammodules;</para></entry>
              <entry><para>&size-libpammodules;</para></entry>
              <entry>
                <para> Pluggable Authentication Modules for PAM </para>
              </entry>
            </row><row>
              <entry>
                <para>
                  <code>libpam-ldap</code>
                </para>
              </entry>
              <entry><para>&pop-libpamldap;</para></entry>
              <entry><para>&size-libpamldap;</para></entry>
              <entry>
                <para> Pluggable Authentication Module allowing LDAP interfaces </para>
              </entry>
            </row><row>
              <entry>
                <para>
                  <code>libpam-cracklib</code>
                </para>
              </entry>
              <entry><para>&pop-libpamcracklib;</para></entry>
              <entry><para>&size-libpamcracklib;</para></entry>
              <entry>
                <para> Pluggable Authentication Module to enable cracklib support </para>
              </entry>
            </row><row>
              <entry>
                <para>
                  <code>libc6</code>
                </para>
              </entry>
              <entry><para>&pop-libcg;</para></entry>
              <entry><para>&size-libcg;</para></entry>
              <entry>
                <para> GNU C Library: Shared libraries which also provides "Name Service Switch" service </para>
              </entry>
            </row><row>
              <entry>
                <para>
                  <code>libnss-mdns</code>
                </para>
              </entry>
              <entry><para>&pop-libnssmdns;</para></entry>
              <entry><para>&size-libnssmdns;</para></entry>
              <entry>
                <para> NSS module for Multicast DNS name resolution </para>
              </entry>
            </row><row>
              <entry>
                <para>
                  <code>libnss-ldap</code>
                </para>
              </entry>
              <entry><para>&pop-libnssldap;</para></entry>
              <entry><para>&size-libnssldap;</para></entry>
              <entry>
                <para> NSS module for using LDAP as a naming service </para>
              </entry>
            </row><row>
              <entry>
                <para>
                  <code>libnss-ldapd</code>
                </para>
              </entry>
              <entry><para>&pop-libnssldapd;</para></entry>
              <entry><para>&size-libnssldapd;</para></entry>
              <entry>
                <para> NSS module for using LDAP as a naming service (new folk of <code>libnss-ldap</code>) </para>
              </entry>
            </row></tbody>
        </tgroup>
      </table>
      <note><para> You can see more extensive and current list by "<code>aptitude search 'libpam-|libnss-'</code>" command.  The acronym NSS may also mean "Network Security Service" which is different from "Name Service Switch".   </para></note>
      <note><para> PAM is the most basic way to initialize environment variables for each program with the system wide default value. </para></note>
      <para/>
      <section id="configurationfiledbythepamandnss">
        <title>Configuration files accessed by the PAM and NSS</title>
        <para>Here are few notable configuration files accessed by the PAM: </para>
        <table id="listofconfigurataccessedbythepam">
          
          <title> List of configuration files accessed by the PAM. </title><tgroup x-pkgname=" " x-popcon="" x-pkgsize="" cols="2">
            <colspec colname="xxx1"/>
            <colspec colname="xxx2"/>
            <thead><row>
                <entry>
                  <para>
                    <emphasis role="strong">configuration file</emphasis>
                  </para>
                </entry>
                <entry>
                  <para>
                    <emphasis role="strong">function</emphasis>
                  </para>
                </entry>
              </row></thead><tbody><row>
                <entry>
                  <para>
                    <code>/etc/pam.d/&lt;program_name&gt;</code>
                  </para>
                </entry>
                <entry>
                  <para> set up PAM configuration for the <code>&lt;program_name&gt;</code>. See manpage of <code>pam</code>(7). </para>
                </entry>
              </row><row>
                <entry>
                  <para>
                    <code>/etc/nsswitch.conf</code>
                  </para>
                </entry>
                <entry>
                  <para> set up NSS configuration with the entry for each service. See manpage of <code>nsswitch.conf</code>(5). </para>
                </entry>
              </row><row>
                <entry>
                  <para>
                    <code>/etc/nologin</code>
                  </para>
                </entry>
                <entry>
                  <para> accessed by <code>pam_nologin.so</code> module to limit the user login. </para>
                </entry>
              </row><row>
                <entry>
                  <para>
                    <code>/etc/securetty</code>
                  </para>
                </entry>
                <entry>
                  <para> accessed by <code>pam_securetty.so</code> module to limit the tty for the root access. </para>
                </entry>
              </row><row>
                <entry>
                  <para>
                    <code>/etc/security/access.conf</code>
                  </para>
                </entry>
                <entry>
                  <para> accessed by <code>pam_access.so</code> module to set access limit. </para>
                </entry>
              </row><row>
                <entry>
                  <para>
                    <code>/etc/security/group.conf</code>
                  </para>
                </entry>
                <entry>
                  <para> accessed by <code>pam_group.so</code> module to set group based restraint. </para>
                </entry>
              </row><row>
                <entry>
                  <para>
                    <code>/etc/security/pam_env.conf</code>
                  </para>
                </entry>
                <entry>
                  <para> accessed by <code>pam_env.so</code> module to set environment variables. </para>
                </entry>
              </row><row>
                <entry>
                  <para>
                    <code>/etc/environment</code>
                  </para>
                </entry>
                <entry>
                  <para> accessed by <code>pam_env.so</code> module with <code>readenv=1</code> argument to set environment variables additionally. </para>
                </entry>
              </row><row>
                <entry>
                  <para>
                    <code>/etc/default/locale</code>
                  </para>
                </entry>
                <entry>
                  <para> accessed by <code>pam_env.so</code> module with argument <code>readenv=1 envfile=/etc/default/locale</code> to set locale (Debian). </para>
                </entry>
              </row><row>
                <entry>
                  <para>
                    <code>/etc/security/limits.conf</code>
                  </para>
                </entry>
                <entry>
                  <para> accessed by <code>pam_linits.so</code> module to set resource restraint (ulimit, core, ...). </para>
                </entry>
              </row><row>
                <entry>
                  <para>
                    <code>/etc/security/time.conf</code>
                  </para>
                </entry>
                <entry>
                  <para> accessed by <code>pam_time.so</code> module to set time restraint. </para>
                </entry>
              </row></tbody>
          </tgroup>
        </table>
        <para>The limitation of the password selection is implemented by the PAM modules, <code>pam_unix.so</code> and <code>pam_cracklib.so</code> and configuring them with arguments.  </para>
        <para/>
      </section>
      <section id="themoderncentralsystemmanagement">
        <title>The modern centralized system management</title>
        <para>The modern centralized system management can be deployed using the centralized <ulink url="&lightweightdireccessprotocolldap;">Lightweight Directory Access Protocol (LDAP)</ulink> server to administer many Unix-like and non-Unix-like systems on the network.  The open source implementation of the Lightweight Directory Access Protocol is <ulink url="&openldapsoftware;">OpenLDAP Software</ulink>. </para>
        <para>The LDAP server provides the account information through the use of PAM and NSS with <code>libpam-ldap</code> and <code>libnss-ldap</code> packages for the Debian system. Several actions are required to enable this (I have not used this setup and based purely on secondary information.  Please read this in this context.): </para>
        <itemizedlist>
          <listitem>
            <para>You set up a centralized LDAP server by running program such as stand-alone LDAP daemon, <code>slapd</code>. </para>
          </listitem>
          <listitem>
            <para>You change the PAM configuration files in the <code>/etc/pam.d/</code> directory to use <code>pam_ldap.so</code> instead of the default <code>pam_unix.so</code>. </para>
          </listitem>
          <listitem>
            <para>You change the NSS configuration in the <code>/etc/nsswitch.conf</code> file to use <code>ldap</code> instead of the default (<code>compat</code> or <code>file</code>). </para>
          </listitem>
          <listitem>
            <para>Debian uses <code>/etc/pam_ldap.conf</code> as <code>libpam-ldap</code>'s configuration file and <code>/etc/pam_ldap.secret</code> as the file to store the password of the rootbinddn. </para>
          </listitem>
          <listitem>
            <para>You must make <code>libpam-ldap</code> to use SSL (or TLS) connection for the security of password.   </para>
          </listitem>
          <listitem>
            <para>You may make <code>libnss-ldap</code> to use SSL (or TLS) connection using <code>/etc/libnss-ldap.conf</code> to ensure integrity of data at the cost of the LDAP network overhead. </para>
          </listitem>
          <listitem>
            <para>You should run <code>nscd</code> locally to cache any LDAP search results in order to reduce the LDAP network traffic. </para>
          </listitem>
        </itemizedlist>
        <para>See documentations in <code>/usr/share/doc/libpam-doc/html/</code> offered by <code>libpam-doc</code> package and "<code>info libc 'Name Service Switch'</code>" offered by <code>glibc-doc</code> package. </para>
        <para>Similarly, you can set up alternative centralized systems with: </para>
        <itemizedlist>
          <listitem><para>NIS or NIS+ with the traditional Unix systems. </para></listitem>
          <listitem><para>winbind with Windows NT and SAMBA. </para></listitem>
        </itemizedlist>
        <para/>
      </section>
      <section id="whygnusudoesnotsortthewheelgroup">
        <title>"Why GNU su does not support the wheel group"</title>
        <para>This is the famous phrase at the bottom of the old "<code>info su</code>" page by Richard M. Stallman.  Not to worry: the current <code>su</code> in Debian uses PAM, so that one can restrict the ability to use <code>su</code> to <code>root</code> group by enabling the line with <code>pam_wheel.so</code> in <code>/etc/pam.d/su</code>. </para>
        <para/>
      </section>
      <section id="stricterpasswordrule">
        <title>Stricter password rule</title>
        <para>Installing the <code>libpam-cracklib</code> package will enable you to force stricter password rule, for example, by having active lines in  <code>/etc/pam.d/common-password</code> as: </para>
        <screen>password required pam_cracklib.so retry=3 minlen=9 difok=3
password required pam_unix.so use_authtok nullok md5
</screen>
        <para/>
      </section>
    </section>
    <section id="otheraccesscontrols">
      <title>Other access controls</title>
      <note><para> See <xref linkend="altsysrq"/> for restricting the kernel SAK feature. </para></note>
      <para/>
      <section id="sudo">
        <title>sudo</title>
        <para><code>sudo</code> is a program designed to allow a sysadmin to give limited root privileges to users and log root activity. <code>sudo</code> requires only an ordinary user's password.  Install <code>sudo</code> package and activate it by setting options in <code>/etc/sudoers</code>.  See configuration example at <code>/usr/share/doc/sudo/examples/sudoers</code>. </para>
        <para>My usage of <code>sudo</code> for the single user system (see <xref linkend="sudoconfiguration"/>) is aimed to protect myself from my own stupidity. Personally, I consider using <code>sudo</code> a better alternative to using the system from the root account all the time.   For example, following will change the owner of &lt;some_file&gt; to &lt;my_name&gt;: </para>
        <screen>$ sudo chown &lt;my_name&gt; &lt;some_file&gt;
</screen>
        <para>Of course if you know the root password (as self-installed Debian users do), any command can be run under root from any user's account using "<code>su -c</code>". </para>
        <para/>
      </section>
      <section id="selinux">
        <title>SELinux</title>
        <para><ulink url="&securityenhancedlinuxselinux;">Security-Enhanced Linux (SELinux)</ulink>is a framework to tighten privilege model tighter than the ordinary Unix-like security model with the <ulink url="&mandatoryaccesscontrolmac;">mandatory access control (MAC)</ulink> policies.  The root power may be restricted under some conditions. </para>
        <para/>
      </section>
      <section id="restrictingaccesmeserverservices">
        <title>Restricting access to some server services</title>
        <para>The Internet <emphasis>super-server</emphasis>, <code>inetd</code>, is started at boot time by <code>/etc/rc2.d/S20inetd</code> (for <code>RUNLEVEL=2</code>), which is a symlink to <code>/etc/init.d/inetd</code>.  Essentially, <code>inetd</code> allows one running daemon to invoke several others, reducing load on the system. </para>
        <para>Whenever a request for service arrives, its protocol and service are identified by looking them up in the databases in <code>/etc/protocols</code> and <code>/etc/services</code>.  <code>inetd</code> then looks up a normal Internet service in the <code>/etc/inetd.conf</code> database, or a Sun-RPC based service in <code>/etc/rpc.conf</code>. </para>
        <para>For system security, make sure to disable unused services in <code>/etc/inetd.conf</code>.  Sun-RPC services need to be active for NFS and other RPC-based programs. </para>
        <para>Sometimes, <code>inetd</code> does not start the intended server directly but starts the <code>tcpd</code> TCP/IP daemon wrapper program with the intended server name as its argument in <code>/etc/inetd.conf</code>.  In this case, <code>tcpd</code> runs the appropriate server program after logging the request and doing some additional checks using <code>/etc/hosts.deny</code> and <code>/etc/hosts.allow</code>. </para>
        <para>If you have problems with remote access in a recent Debian system, comment out "ALL: PARANOID" in <code>/etc/hosts.deny</code> if it exists. </para>
        <para>For details, see <code>inetd</code>(8), <code>inetd.conf</code>(5), <code>protocols</code>(5), <code>services</code>(5), <code>tcpd</code>(8), <code>hosts_access</code>(5), and <code>hosts_options</code>(5). </para>
        <para>For more information on Sun-RPC, see <code>rpcinfo</code>(8), <code>portmap</code>(8), and <code>/usr/share/doc/portmap/portmapper.txt.gz</code>. </para>
        <para>There are also non-PAM based access control available for <code>atd</code> and <code>cron</code>. </para>
        <para/>
      </section>
    </section>
    <section id="securityofauthentication">
      <title>Security of authentication</title>
      <para>The information here may not be sufficient for your security needs but it should be a good start. </para>
      <para/>
      <section id="securepasswordovertheinternet">
        <title>Secure password over the Internet</title>
        <para>Many popular transportation layer services communicate messages including password authentication in the plain text. It is very bad idea to transmit password in the plain text over the wild Internet where it can be intercepted.  You can run these services over "<ulink url="&transportlayersecurity;">Transport Layer Security</ulink>" (TLS) or its predecessor, "Secure Sockets Layer" (SSL) to secure entire communication including password by the encryption. </para>
        <table id="listofinsecureanservicesandports">
          
          <title> List of insecure and secure services and ports. </title><tgroup x-pkgname=" " x-popcon=" " x-pkgsize=" " cols="4">
            <colspec colname="xxx1"/>
            <colspec colname="xxx2"/>
            <colspec colname="xxx3"/>
            <colspec colname="xxx4"/>
            <thead><row>
                <entry>
                  <para>
                    <emphasis role="strong">insecure service name</emphasis>
                  </para>
                </entry>
                <entry>
                  <para>
                    <emphasis role="strong">port</emphasis>
                  </para>
                </entry>
                <entry>
                  <para>
                    <emphasis role="strong">secure service name</emphasis>
                  </para>
                </entry>
                <entry>
                  <para>
                    <emphasis role="strong">port</emphasis>
                  </para>
                </entry>
              </row></thead><tbody><row>
                <entry>
                  <para> www (http) </para>
                </entry>
                <entry>
                  <para> 80 </para>
                </entry>
                <entry>
                  <para> https </para>
                </entry>
                <entry>
                  <para> 443 </para>
                </entry>
              </row><row>
                <entry>
                  <para> smtp (mail) </para>
                </entry>
                <entry>
                  <para> 25 </para>
                </entry>
                <entry>
                  <para> ssmtp (smtps) </para>
                </entry>
                <entry>
                  <para> 465 </para>
                </entry>
              </row><row>
                <entry>
                  <para> ftp-data </para>
                </entry>
                <entry>
                  <para> 20 </para>
                </entry>
                <entry>
                  <para> ftps-data </para>
                </entry>
                <entry>
                  <para> 989 </para>
                </entry>
              </row><row>
                <entry>
                  <para> ftp </para>
                </entry>
                <entry>
                  <para> 21 </para>
                </entry>
                <entry>
                  <para> ftps </para>
                </entry>
                <entry>
                  <para> 990 </para>
                </entry>
              </row><row>
                <entry>
                  <para> telnet </para>
                </entry>
                <entry>
                  <para> 23 </para>
                </entry>
                <entry>
                  <para> telnets </para>
                </entry>
                <entry>
                  <para> 992 </para>
                </entry>
              </row><row>
                <entry>
                  <para> imap2 </para>
                </entry>
                <entry>
                  <para> 143 </para>
                </entry>
                <entry>
                  <para> imaps </para>
                </entry>
                <entry>
                  <para> 993 </para>
                </entry>
              </row><row>
                <entry>
                  <para> pop3 </para>
                </entry>
                <entry>
                  <para> 110 </para>
                </entry>
                <entry>
                  <para> pop3s </para>
                </entry>
                <entry>
                  <para> 995 </para>
                </entry>
              </row><row>
                <entry>
                  <para> ldap </para>
                </entry>
                <entry>
                  <para> 389 </para>
                </entry>
                <entry>
                  <para> ldaps </para>
                </entry>
                <entry>
                  <para> 636 </para>
                </entry>
              </row></tbody>
          </tgroup>
        </table>
        <para>The encryption costs CPU time.  As a CPU friendly alternative, you can keep communication in plain text while securing just password with the secure authentication protocol such as "Authenticated Post Office Protocol" (APOP) for POP and "Challenge-Response Authentication Mechanism MD5" (CRAM-MD5) for SMTP and IMAP.  (For sending mail messages over the Internet to your mail server from your mail client, it is recently popular to use new message submission port 587 instead of traditional SMTP port 25 to avoid port 25 blocking by the network provider while authenticating yourself with CRAM-MD5.) </para>
        <para/>
      </section>
      <section id="secureshell">
        <title>Secure Shell</title>
        <para>The <ulink url="&secureshell;">Secure Shell</ulink> (<code>ssh</code>) program (<ulink url="&openssh;">OpenSSH</ulink> SSH client) and <code>sshd</code> program (OpenSSH SSH daemon) provide secure encrypted communications between two untrusted hosts over an insecure network with the secure authentication.  This SSH can be used to tunnel the insecure protocol communication such as POP and X securely over the Internet with the port forwarding feature. </para>
        <para>The client tries to authenticate itself using host-based authentication, public key authentication, challenge-response authentication, or password authentication.  The use of public key authentication enables the remote password-less login. See <code>man 1 ssh</code>, <code>man 8 sshd</code>, and <xref linkend="theremoteaccesssverandutilityssh"/>. </para>
        <para/>
      </section>
      <section id="extrasecuritymeaesfortheinternet">
        <title>Extra security measures for the Internet</title>
        <para>Even when you run secure services such as "Secure Shell" (SSH) and "Point-to-point tunneling protocol" (PPTP) servers, there are still chances for the break-ins using brute force password guessing attack etc. from the Internet.  Use of the firewall policy (see <xref linkend="netfilter"/>) together with the following secure tools may improve the security situation. </para>
        <table id="listoftoolstoprosecuritymeasures">
          
          <title> List of tools to provide extra security measures. </title><tgroup x-pkgname=" 1 " x-popcon=" 2 " x-pkgsize="" cols="3">
            <colspec colname="xxx1"/>
            <colspec colname="xxx2"/>
            <colspec colname="xxx3"/>
            <thead><row>
                <entry>
                  <para>
                    <emphasis role="strong">package</emphasis>
                  </para>
                </entry>
                <entry>
                  <para>
                    <emphasis role="strong">popcon</emphasis>
                  </para>
                </entry>
                <entry>
                  <para>
                    <emphasis role="strong">description</emphasis>
                  </para>
                </entry>
              </row></thead><tbody><row>
                <entry>
                  <para>
                    <code>knockd</code>
                  </para>
                </entry>
                <entry><para>&pop-knockd;</para></entry>
                <entry>
                  <para> small port-knock daemon <code>knocked</code>(1) and client <code>konck</code>(1) </para>
                </entry>
              </row><row>
                <entry>
                  <para>
                    <code>denyhosts</code>
                  </para>
                </entry>
                <entry><para>&pop-denyhosts;</para></entry>
                <entry>
                  <para> an utility to help sysadmins thwart ssh hackers </para>
                </entry>
              </row><row>
                <entry>
                  <para>
                    <code>fail2ban</code>
                  </para>
                </entry>
                <entry><para>&pop-failcban;</para></entry>
                <entry>
                  <para> bans IPs that cause multiple authentication errors </para>
                </entry>
              </row><row>
                <entry>
                  <para>
                    <code>libpam-shield</code>
                  </para>
                </entry>
                <entry><para>&pop-libpamshield;</para></entry>
                <entry>
                  <para> locks out remote attackers trying password guessing </para>
                </entry>
              </row></tbody>
          </tgroup>
        </table>
        <para/>
        <para/>
        <para/>
      </section>
      <section id="securingtherootpassword">
        <title>Securing the root password</title>
        <para>To prevent people to access your machine with root privilege, you need to: </para>
        <itemizedlist>
          <listitem><para>prevent physical access to the hard disk. </para></listitem>
          <listitem><para>lock BIOS and prevent booting from the removable media. </para></listitem>
          <listitem><para>set password for GRUB interactive session. </para></listitem>
          <listitem><para>lock GRUB menu from editing. </para></listitem>
        </itemizedlist>
        <para>With physical access to hard disk, resetting the password is relatively easy; </para>
        <itemizedlist>
          <listitem><para>move the hard disk to a PC with CD bootable BIOS. </para></listitem>
          <listitem><para>boot system with a rescue media (Debian boot disk, Knopix CD, GRUB CD, ...). </para></listitem>
          <listitem><para>mount root partition with read-write access. </para></listitem>
          <listitem>
            <para>edit <code>/etc/passwd</code> in the root partition and make the second entry for <code>root</code> account empty. </para>
          </listitem>
        </itemizedlist>
        <para>If you have the edit access to the GRUB menu entry (see <xref linkend="stagecthebootloader"/>) for <code>grub-rescue-pc</code>) at the boot time, it is even easier: </para>
        <itemizedlist>
          <listitem>
            <para>boot system with the kernel parameter changed to something like "<code>root=/dev/hda6 rw init=/bin/sh</code>". </para>
          </listitem>
          <listitem>
            <para>edit <code>/etc/passwd</code> and make the second entry for <code>root</code> account empty. </para>
          </listitem>
          <listitem><para>reboot system. </para></listitem>
        </itemizedlist>
        <para>The root shell of the system is now accessible without password. </para>
        <note><para> Once you have root shell access, you can compromise password for all user accounts using brute force password cracking tools such as <code>john</code> and <code>crack</code> packages (see <xref linkend="systemsecurityandintegritycheck"/>). </para></note>
        <para>The only reasonable software solution to avoid all these concerns is to use software encrypted root partition (or <code>/etc</code> partition) using <ulink url="&dmcrypt;">dm-crypt</ulink> and initramfs (see <xref linkend="dataencryptiontips"/>).  You always need password to boot the system, though. </para>
      </section>
    </section>
  </chapter>