File: Auth.raw.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 (1185 lines) | stat: -rw-r--r-- 50,384 bytes parent folder | download
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
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
<?xml version="1.0"?>
<article>
  <articleinfo>
    <title>DebianReference/Auth</title>
  </articleinfo>
  <para/>
  <section>
    <title>Do not use Edit(GUI) button.</title>
    <para> </para>
    <para>Copyright 2007, 2008  Osamu Aoki GPL, (Please agree to GPL, GPL2, and any version of GPL which is compatible with DSFG if you update any part of wiki page) </para>
    <para>Generated HTML is at "<ulink url="http://people.debian.org/~osamu/pub/getwiki/html/ch05.en.html">Debian Reference: Chapter 5. Authentication</ulink>". </para>
    <para>I welcome your contributions to update this wiki page. You must follow these rules: </para>
    <itemizedlist>
      <listitem>
        <para>Do not use Edit(GUI) button of <ulink url="/MoinMoin">MoinMoin</ulink>. </para>
      </listitem>
      <listitem>You can update anytime for: <itemizedlist><listitem>grammar errors </listitem><listitem>spelling errors </listitem><listitem>moved URL location </listitem><listitem>package name transition adjustment (emacs23 etc.) </listitem><listitem>clearly broken script. </listitem></itemizedlist></listitem>
      <listitem>Before updating this wiki content: <itemizedlist><listitem><para>Read "<ulink url="http://wiki.debian.org/DebianReference/Test">Guide for contributing to Debian Reference</ulink>". </para></listitem></itemizedlist></listitem>
    </itemizedlist>
    <para/>
  </section>
  <section>
    <title>Authentication</title>
    <para/>
    <section>
      <title>Normal Unix authentication</title>
      <para>Normal Unix authentication is provided by the <code>pam_unix.so</code> method under the <ulink url="http://en.wikipedia.org/wiki/Pluggable_Authentication_Modules">PAM (Pluggable Authentication Modules)</ulink>. Its 3 important configuration files, with "<code>:</code>" separated entries, are: </para>
      <table>
        <caption/>
        <tgroup cols="5">
          <colspec colname="xxx1"/>
          <colspec colname="xxx2"/>
          <colspec colname="xxx3"/>
          <colspec colname="xxx4"/>
          <colspec colname="xxx5"/>
          <tbody>
            <row>
              <entry>
                <para> The 3 important configuration files for pam_unix.o. </para>
              </entry>
              <entry>
                <para> </para>
              </entry>
              <entry>
                <para> </para>
              </entry>
              <entry>
                <para> </para>
              </entry>
              <entry>
                <para> </para>
              </entry>
            </row>
            <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>
            <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><![CDATA[...
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>login name </listitem>
        <listitem>password specification entry </listitem>
        <listitem>numerical user ID </listitem>
        <listitem>numerical group ID </listitem>
        <listitem>user name or comment field </listitem>
        <listitem>user home directory </listitem>
        <listitem>optional user command interpreter </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>
        <caption/>
        <tgroup cols="2">
          <colspec colname="xxx1"/>
          <colspec colname="xxx2"/>
          <tbody>
            <row>
              <entry>
                <para> The second entry content of <code>/etc/passwd</code>. </para>
              </entry>
              <entry>
                <para> </para>
              </entry>
            </row>
            <row>
              <entry>
                <para>
                  <emphasis role="strong">content</emphasis>
                </para>
              </entry>
              <entry>
                <para>
                  <emphasis role="strong">meaning</emphasis>
                </para>
              </entry>
            </row>
            <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><![CDATA[...
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>login name </listitem>
        <listitem>
          <para>encrypted password.  The initial "<code>$1$</code>" indicates use of the MD5 encryption. The "*" indicate no login. </para>
        </listitem>
        <listitem>days since Jan 1, 1970 that password was last changed </listitem>
        <listitem>days before password may be changed </listitem>
        <listitem>days after which password must be changed </listitem>
        <listitem>days before password is to expire that user is warned </listitem>
      </itemizedlist>
      <para>The <code>/etc/group</code> file contains: </para>
      <screen><![CDATA[...
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>group name </listitem>
        <listitem>encrypted password (not really used) </listitem>
        <listitem>numerical group ID. </listitem>
        <listitem>"," separated list of user names. </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>
      <para><inlinemediaobject><imageobject><imagedata width="15" fileref="/htdocs/rightsidebar/img/idea.png" depth="15"/></imageobject><textobject><phrase>(!)</phrase></textobject></inlinemediaobject> 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>
      <para><inlinemediaobject><imageobject><imagedata width="15" fileref="/htdocs/rightsidebar/img/idea.png" depth="15"/></imageobject><textobject><phrase>(!)</phrase></textobject></inlinemediaobject> 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>
      <para/>
    </section>
    <section>
      <title>Manage account and password information</title>
      <para>Here are few notable commands to manage account information: </para>
      <table>
        <caption/>
        <tgroup cols="2">
          <colspec colname="xxx1"/>
          <colspec colname="xxx2"/>
          <tbody>
            <row>
              <entry>
                <para> List of commands to manage account information. </para>
              </entry>
              <entry>
                <para> </para>
              </entry>
            </row>
            <row>
              <entry>
                <para>
                  <emphasis role="strong">command</emphasis>
                </para>
              </entry>
              <entry>
                <para>
                  <emphasis role="strong">function</emphasis>
                </para>
              </entry>
            </row>
            <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>
      <para><inlinemediaobject><imageobject><imagedata width="15" fileref="/htdocs/rightsidebar/img/idea.png" depth="15"/></imageobject><textobject><phrase>(!)</phrase></textobject></inlinemediaobject> On the system set up with PAM and NSS as the Debian <ulink url="http://alioth.debian.org">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>
      <para/>
    </section>
    <section>
      <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="http://en.wikipedia.org/wiki/Password_strength">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>lower case alphabetics </listitem>
        <listitem>digits 0 through 9 </listitem>
        <listitem>punctuation marks </listitem>
      </itemizedlist>
      <para><inlinemediaobject><imageobject><imagedata width="15" fileref="/htdocs/rightsidebar/img/alert.png" depth="15"/></imageobject><textobject><phrase>/!\</phrase></textobject></inlinemediaobject> Do not chose guessable words for the password. </para>
      <para/>
    </section>
    <section>
      <title>Creating encrypted password</title>
      <para>There are independent tools to generate encrypted password with salt: </para>
      <table>
        <caption/>
        <tgroup cols="5">
          <colspec colname="xxx1"/>
          <colspec colname="xxx2"/>
          <colspec colname="xxx3"/>
          <colspec colname="xxx4"/>
          <colspec colname="xxx5"/>
          <tbody>
            <row>
              <entry>
                <para> List of tools to generate password. </para>
              </entry>
              <entry>
                <para> 1 </para>
              </entry>
              <entry>
                <para> 2 </para>
              </entry>
              <entry>
                <para> 3 </para>
              </entry>
              <entry>
                <para> </para>
              </entry>
            </row>
            <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>
            <row>
              <entry>
                <para>
                  <code>whois</code>
                </para>
              </entry>
              <entry>
                <para> </para>
              </entry>
              <entry>
                <para> - </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> </para>
              </entry>
              <entry>
                <para> - </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>
      <title>PAM and NSS</title>
      <para>Modern Unix-like systems such as the Debian system provide <ulink url="http://en.wikipedia.org/wiki/Pluggable_Authentication_Modules">PAM (Pluggable Authentication Modules)</ulink> and <ulink url="http://en.wikipedia.org/wiki/Name_Service_Switch">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>PAM offers a flexible authentication mechanism used by the application software thus involves password data exchange. </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>
        <caption/>
        <tgroup cols="4">
          <colspec colname="xxx1"/>
          <colspec colname="xxx2"/>
          <colspec colname="xxx3"/>
          <colspec colname="xxx4"/>
          <tbody>
            <row>
              <entry>
                <para> List of notable PAM and NSS systems. </para>
              </entry>
              <entry>
                <para> 1 </para>
              </entry>
              <entry>
                <para> 2 </para>
              </entry>
              <entry>
                <para> 3 </para>
              </entry>
            </row>
            <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>
            <row>
              <entry>
                <para>
                  <code>libpam-modules</code>
                </para>
              </entry>
              <entry>
                <para> - </para>
              </entry>
              <entry>
                <para> - </para>
              </entry>
              <entry>
                <para> Pluggable Authentication Modules for PAM </para>
              </entry>
            </row>
            <row>
              <entry>
                <para>
                  <code>libpam-ldap</code>
                </para>
              </entry>
              <entry>
                <para> - </para>
              </entry>
              <entry>
                <para> - </para>
              </entry>
              <entry>
                <para> Pluggable Authentication Module allowing LDAP interfaces </para>
              </entry>
            </row>
            <row>
              <entry>
                <para>
                  <code>libpam-cracklib</code>
                </para>
              </entry>
              <entry>
                <para> - </para>
              </entry>
              <entry>
                <para> - </para>
              </entry>
              <entry>
                <para> Pluggable Authentication Module to enable cracklib support </para>
              </entry>
            </row>
            <row>
              <entry>
                <para>
                  <code>libc6</code>
                </para>
              </entry>
              <entry>
                <para> - </para>
              </entry>
              <entry>
                <para> - </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> - </para>
              </entry>
              <entry>
                <para> - </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> - </para>
              </entry>
              <entry>
                <para> - </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> - </para>
              </entry>
              <entry>
                <para> - </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>
      <para><inlinemediaobject><imageobject><imagedata width="15" fileref="/htdocs/rightsidebar/img/idea.png" depth="15"/></imageobject><textobject><phrase>(!)</phrase></textobject></inlinemediaobject> 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>
      <para><inlinemediaobject><imageobject><imagedata width="15" fileref="/htdocs/rightsidebar/img/idea.png" depth="15"/></imageobject><textobject><phrase>(!)</phrase></textobject></inlinemediaobject> PAM is the most basic way to initialize environment variables for each program with the system wide default value. </para>
      <para/>
      <section>
        <title>Configuration files accessed by the PAM and NSS</title>
        <para>Here are few notable configuration files accessed by the PAM: </para>
        <table>
          <caption/>
          <tgroup cols="2">
            <colspec colname="xxx1"/>
            <colspec colname="xxx2"/>
            <tbody>
              <row>
                <entry>
                  <para> List of configuration files accessed by the PAM. </para>
                </entry>
                <entry>
                  <para> </para>
                </entry>
              </row>
              <row>
                <entry>
                  <para>
                    <emphasis role="strong">configuration file</emphasis>
                  </para>
                </entry>
                <entry>
                  <para>
                    <emphasis role="strong">function</emphasis>
                  </para>
                </entry>
              </row>
              <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>
        <title>The modern centralized system management</title>
        <para>The modern centralized system management can be deployed using the centralized <ulink url="http://en.wikipedia.org/wiki/Lightweight_Directory_Access_Protocol">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="http://www.openldap.org/">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>NIS or NIS+ with the traditional Unix systems. </listitem>
          <listitem>winbind with Windows NT and SAMBA. </listitem>
        </itemizedlist>
        <para/>
      </section>
      <section>
        <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>
        <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><![CDATA[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>
      <title>Other access controls</title>
      <para><inlinemediaobject><imageobject><imagedata width="15" fileref="/htdocs/rightsidebar/img/idea.png" depth="15"/></imageobject><textobject><phrase>(!)</phrase></textobject></inlinemediaobject> See @{@altsysrq@}@ for restricting the kernel SAK feature. </para>
      <para/>
      <section>
        <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 @{@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><![CDATA[$ sudo chown <my_name> <some_file>
]]></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>
        <title>SELinux</title>
        <para><ulink url="http://en.wikipedia.org/wiki/Security-Enhanced_Linux">Security-Enhanced Linux (SELinux)</ulink>is a framework to tighten privilege model tighter than the ordinary Unix-like security model with the <ulink url="http://en.wikipedia.org/wiki/Mandatory_access_control">mandatory access control (MAC)</ulink> policies.  The root power may be restricted under some conditions. </para>
        <para/>
      </section>
      <section>
        <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>
      <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>
        <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="http://en.wikipedia.org/wiki/Transport_Layer_Security">Transport Layer Security</ulink>" (TLS) or its predecessor, "Secure Sockets Layer" (SSL) to secure entire communication including password by the encryption. </para>
        <table>
          <caption/>
          <tgroup cols="4">
            <colspec colname="xxx1"/>
            <colspec colname="xxx2"/>
            <colspec colname="xxx3"/>
            <colspec colname="xxx4"/>
            <tbody>
              <row>
                <entry>
                  <para> List of insecure and secure services and ports. </para>
                </entry>
                <entry>
                  <para> </para>
                </entry>
                <entry>
                  <para> </para>
                </entry>
                <entry>
                  <para> </para>
                </entry>
              </row>
              <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>
              <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>
        <title>Secure Shell</title>
        <para>The <ulink url="http://en.wikipedia.org/wiki/Secure_Shell">Secure Shell</ulink> (<code>ssh</code>) program (<ulink url="http://www.openssh.org/">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 @{@theremoteaccesssverandutilityssh@}@. </para>
        <para/>
      </section>
      <section>
        <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 @{@netfilter@}@) together with the following secure tools may improve the security situation. </para>
        <table>
          <caption/>
          <tgroup cols="3">
            <colspec colname="xxx1"/>
            <colspec colname="xxx2"/>
            <colspec colname="xxx3"/>
            <tbody>
              <row>
                <entry>
                  <para> List of tools to provide extra security measures. </para>
                </entry>
                <entry>
                  <para> 1 </para>
                </entry>
                <entry>
                  <para> 2 </para>
                </entry>
              </row>
              <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>
              <row>
                <entry>
                  <para>
                    <code>knockd</code>
                  </para>
                </entry>
                <entry>
                  <para> - </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> - </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> - </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> - </para>
                </entry>
                <entry>
                  <para> locks out remote attackers trying password guessing </para>
                </entry>
              </row>
            </tbody>
          </tgroup>
        </table>
        <para/>
        <para/>
        <para/>
      </section>
      <section>
        <title>Securing the root password</title>
        <para>To prevent people to access your machine with root privilege, you need to: </para>
        <itemizedlist>
          <listitem>prevent physical access to the hard disk. </listitem>
          <listitem>lock BIOS and prevent booting from the removable media. </listitem>
          <listitem>set password for GRUB interactive session. </listitem>
          <listitem>lock GRUB menu from editing. </listitem>
        </itemizedlist>
        <para>With physical access to hard disk, resetting the password is relatively easy; </para>
        <itemizedlist>
          <listitem>move the hard disk to a PC with CD bootable BIOS. </listitem>
          <listitem>boot system with a rescue media (Debian boot disk, Knopix CD, GRUB CD, ...). </listitem>
          <listitem>mount root partition with read-write access. </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 @{@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>reboot system. </listitem>
        </itemizedlist>
        <para>The root shell of the system is now accessible without password. </para>
        <para><inlinemediaobject><imageobject><imagedata width="15" fileref="/htdocs/rightsidebar/img/idea.png" depth="15"/></imageobject><textobject><phrase>(!)</phrase></textobject></inlinemediaobject> 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 @{@systemsecurityandintegritycheck@}@). </para>
        <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="http://en.wikipedia.org/wiki/Dm-crypt">dm-crypt</ulink> and initramfs (see @{@dataencryptiontips@}@).  You always need password to boot the system, though. </para>
      </section>
    </section>
  </section>
</article>