View | Details | Raw Unified | Return to bug 157337
Collapse All | Expand All

(-)chapter.sgml (-1155 / +1268 lines)
Lines 8-14 Link Here
8
  <chapterinfo>
8
  <chapterinfo>
9
    <authorgroup>
9
    <authorgroup>
10
      <author>
10
      <author>
11
        <firstname>Murray</firstname>
11
	<firstname>Murray</firstname>
12
	<surname>Stokely</surname>
12
	<surname>Stokely</surname>
13
	<contrib>Reorganized by </contrib>
13
	<contrib>Reorganized by </contrib>
14
      </author>
14
      </author>
Lines 92-99 Link Here
92
      </listitem>
92
      </listitem>
93
93
94
      <listitem>
94
      <listitem>
95
      <para>Know how to install additional third-party
95
	<para>Know how to install additional third-party
96
        software (<xref linkend="ports">).</para>
96
	  software (<xref linkend="ports">).</para>
97
      </listitem>
97
      </listitem>
98
98
99
    </itemizedlist>
99
    </itemizedlist>
Lines 102-112 Link Here
102
  <sect1 id="network-inetd">
102
  <sect1 id="network-inetd">
103
    <sect1info>
103
    <sect1info>
104
      <authorgroup>
104
      <authorgroup>
105
        <author>
105
	<author>
106
          <firstname>Chern</firstname>
106
	  <firstname>Chern</firstname>
107
          <surname>Lee</surname>
107
	  <surname>Lee</surname>
108
          <contrib>Contributed by </contrib>
108
	  <contrib>Contributed by </contrib>
109
        </author>
109
	</author>
110
      </authorgroup>
110
      </authorgroup>
111
      <authorgroup>
111
      <authorgroup>
112
	<author>
112
	<author>
Lines 185-191 Link Here
185
	modify its behaviour.  The full list of options reads:</para>
185
	modify its behaviour.  The full list of options reads:</para>
186
186
187
      <para><command>inetd</command> <option>[-d] [-l] [-w] [-W] [-c maximum] [-C rate] [-a address | hostname]
187
      <para><command>inetd</command> <option>[-d] [-l] [-w] [-W] [-c maximum] [-C rate] [-a address | hostname]
188
           [-p filename] [-R rate] [-s maximum] [configuration file]</option></para>
188
	[-p filename] [-R rate] [-s maximum] [configuration file]</option></para>
189
189
190
      <para>Options can be passed to <application>inetd</application> using the
190
      <para>Options can be passed to <application>inetd</application> using the
191
	<literal>inetd_flags</literal> option in
191
	<literal>inetd_flags</literal> option in
Lines 396-402 Link Here
396
	      limits the number of children that can be started on
396
	      limits the number of children that can be started on
397
	      behalf on any single IP address at any moment. These
397
	      behalf on any single IP address at any moment. These
398
	      options are useful to prevent intentional or unintentional
398
	      options are useful to prevent intentional or unintentional
399
 	      excessive resource consumption and Denial of Service (DoS)
399
	      excessive resource consumption and Denial of Service (DoS)
400
	      attacks to a machine.</para>
400
	      attacks to a machine.</para>
401
401
402
	    <para>In this field, either of <option>wait</option> or
402
	    <para>In this field, either of <option>wait</option> or
Lines 528-545 Link Here
528
  <sect1 id="network-nfs">
528
  <sect1 id="network-nfs">
529
    <sect1info>
529
    <sect1info>
530
      <authorgroup>
530
      <authorgroup>
531
        <author>
531
	<author>
532
          <firstname>Tom</firstname>
532
	  <firstname>Tom</firstname>
533
          <surname>Rhodes</surname>
533
	  <surname>Rhodes</surname>
534
          <contrib>Reorganized and enhanced by </contrib>
534
	  <contrib>Reorganized and enhanced by </contrib>
535
        </author>
535
	</author>
536
      </authorgroup>
536
      </authorgroup>
537
      <authorgroup>
537
      <authorgroup>
538
        <author>
538
	<author>
539
          <firstname>Bill</firstname>
539
	  <firstname>Bill</firstname>
540
      	  <surname>Swingle</surname>
540
	  <surname>Swingle</surname>
541
	  <contrib>Written by </contrib>
541
	  <contrib>Written by </contrib>
542
        </author>
542
	</author>
543
      </authorgroup>
543
      </authorgroup>
544
    </sect1info>
544
    </sect1info>
545
    <title>Network File System (NFS)</title>
545
    <title>Network File System (NFS)</title>
Lines 583-611 Link Here
583
      <title>How <acronym>NFS</acronym> Works</title>
583
      <title>How <acronym>NFS</acronym> Works</title>
584
584
585
      <para><acronym>NFS</acronym> consists of at least two main
585
      <para><acronym>NFS</acronym> consists of at least two main
586
        parts: a server and one or more clients.  The client remotely
586
	parts: a server and one or more clients.  The client remotely
587
        accesses the data that is stored on the server machine.  In
587
	accesses the data that is stored on the server machine.  In
588
        order for this to function properly a few processes have to be
588
	order for this to function properly a few processes have to be
589
        configured and running.</para>
589
	configured and running.</para>
590
590
591
      <para>The server has to be running the following daemons:</para>
591
      <para>The server has to be running the following daemons:</para>
592
      <indexterm>
592
      <indexterm>
593
        <primary>NFS</primary>
593
	<primary>NFS</primary>
594
        <secondary>server</secondary>
594
	<secondary>server</secondary>
595
      </indexterm>
595
      </indexterm>
596
      <indexterm>
596
      <indexterm>
597
        <primary>file server</primary>
597
	<primary>file server</primary>
598
        <secondary>UNIX clients</secondary>
598
	<secondary>UNIX clients</secondary>
599
      </indexterm>
599
      </indexterm>
600
600
601
      <indexterm>
601
      <indexterm>
602
	<primary><application>rpcbind</application></primary>
602
	<primary><application>rpcbind</application></primary>
603
      </indexterm>
603
      </indexterm>
604
      <indexterm>
604
      <indexterm>
605
        <primary><application>mountd</application></primary>
605
	<primary><application>mountd</application></primary>
606
      </indexterm>
606
      </indexterm>
607
      <indexterm>
607
      <indexterm>
608
        <primary><application>nfsd</application></primary>
608
	<primary><application>nfsd</application></primary>
609
      </indexterm>
609
      </indexterm>
610
610
611
      <informaltable frame="none" pgwide="1">
611
      <informaltable frame="none" pgwide="1">
Lines 623-630 Link Here
623
	    <row>
623
	    <row>
624
	      <entry><application>nfsd</application></entry>
624
	      <entry><application>nfsd</application></entry>
625
	      <entry>The <acronym>NFS</acronym> daemon which services
625
	      <entry>The <acronym>NFS</acronym> daemon which services
626
	      requests from the <acronym>NFS</acronym>
626
		requests from the <acronym>NFS</acronym>
627
	      clients.</entry>
627
		clients.</entry>
628
	    </row>
628
	    </row>
629
	    <row>
629
	    <row>
630
	      <entry><application>mountd</application></entry>
630
	      <entry><application>mountd</application></entry>
Lines 635-713 Link Here
635
	      <entry><application>rpcbind</application></entry>
635
	      <entry><application>rpcbind</application></entry>
636
	      <entry> This daemon allows
636
	      <entry> This daemon allows
637
	      <acronym>NFS</acronym> clients to discover which port
637
	      <acronym>NFS</acronym> clients to discover which port
638
	      the <acronym>NFS</acronym> server is using.</entry>
638
		the <acronym>NFS</acronym> server is using.</entry>
639
	    </row>
639
	    </row>
640
	  </tbody>
640
	  </tbody>
641
	</tgroup>
641
	</tgroup>
642
      </informaltable>
642
      </informaltable>
643
643
644
      <para>The client can also run a daemon, known as
644
      <para>The client can also run a daemon, known as
645
        <application>nfsiod</application>.  The
645
	<application>nfsiod</application>.  The
646
        <application>nfsiod</application> daemon services the requests
646
	<application>nfsiod</application> daemon services the requests
647
        from the <acronym>NFS</acronym> server.  This is optional, and
647
	from the <acronym>NFS</acronym> server.  This is optional, and
648
        improves performance, but is not required for normal and
648
	improves performance, but is not required for normal and
649
        correct operation.  See the &man.nfsiod.8; manual page for
649
	correct operation.  See the &man.nfsiod.8; manual page for
650
        more information.
650
	more information.
651
      </para>
651
      </para>
652
    </sect2>
652
    </sect2>
653
653
654
    <sect2 id="network-configuring-nfs">
654
    <sect2 id="network-configuring-nfs">
655
      <title>Configuring <acronym>NFS</acronym></title>
655
      <title>Configuring <acronym>NFS</acronym></title>
656
      <indexterm>
656
      <indexterm>
657
        <primary>NFS</primary>
657
	<primary>NFS</primary>
658
        <secondary>configuration</secondary>
658
	<secondary>configuration</secondary>
659
      </indexterm>
659
      </indexterm>
660
660
661
      <para><acronym>NFS</acronym> configuration is a relatively
661
      <para><acronym>NFS</acronym> configuration is a relatively
662
        straightforward process.  The processes that need to be
662
	straightforward process.  The processes that need to be
663
        running can all start at boot time with a few modifications to
663
	running can all start at boot time with a few modifications to
664
        your <filename>/etc/rc.conf</filename> file.</para>
664
	your <filename>/etc/rc.conf</filename> file.</para>
665
665
666
      <para>On the <acronym>NFS</acronym> server, make sure that the
666
      <para>On the <acronym>NFS</acronym> server, make sure that the
667
        following options are configured in the
667
	following options are configured in the
668
        <filename>/etc/rc.conf</filename> file:</para>
668
	<filename>/etc/rc.conf</filename> file:</para>
669
669
670
      <programlisting>rpcbind_enable="YES"
670
      <programlisting>rpcbind_enable="YES"
671
nfs_server_enable="YES"
671
nfs_server_enable="YES"
672
mountd_flags="-r"</programlisting>
672
mountd_flags="-r"</programlisting>
673
673
674
      <para><application>mountd</application> runs automatically
674
      <para><application>mountd</application> runs automatically
675
        whenever the <acronym>NFS</acronym> server is enabled.</para>
675
	whenever the <acronym>NFS</acronym> server is enabled.</para>
676
676
677
      <para>On the client, make sure this option is present in
677
      <para>On the client, make sure this option is present in
678
        <filename>/etc/rc.conf</filename>:</para>
678
	<filename>/etc/rc.conf</filename>:</para>
679
679
680
      <programlisting>nfs_client_enable="YES"</programlisting>
680
      <programlisting>nfs_client_enable="YES"</programlisting>
681
681
682
      <para>The <filename>/etc/exports</filename> file specifies which
682
      <para>The <filename>/etc/exports</filename> file specifies which
683
        file systems <acronym>NFS</acronym> should export (sometimes
683
	file systems <acronym>NFS</acronym> should export (sometimes
684
        referred to as <quote>share</quote>).  Each line in
684
	referred to as <quote>share</quote>).  Each line in
685
        <filename>/etc/exports</filename> specifies a file system to be
685
	<filename>/etc/exports</filename> specifies a file system to be
686
        exported and which machines have access to that file system.
686
	exported and which machines have access to that file system.
687
        Along with what machines have access to that file system,
687
	Along with what machines have access to that file system,
688
        access options may also be specified.  There are many such
688
	access options may also be specified.  There are many such
689
        options that can be used in this file but only a few will be
689
	options that can be used in this file but only a few will be
690
        mentioned here.  You can easily discover other options by
690
	mentioned here.  You can easily discover other options by
691
        reading over the &man.exports.5; manual page.</para>
691
	reading over the &man.exports.5; manual page.</para>
692
692
693
      <para>Here are a few example <filename>/etc/exports</filename>
693
      <para>Here are a few example <filename>/etc/exports</filename>
694
	entries:</para>
694
	entries:</para>
695
695
696
      <indexterm>
696
      <indexterm>
697
        <primary>NFS</primary>
697
	<primary>NFS</primary>
698
        <secondary>export examples</secondary>
698
	<secondary>export examples</secondary>
699
      </indexterm>
699
      </indexterm>
700
700
701
      <para>The following examples give an idea of how to export
701
      <para>The following examples give an idea of how to export
702
        file systems, although the settings may be different depending
702
	file systems, although the settings may be different depending
703
        on your environment and network configuration.  For instance,
703
	on your environment and network configuration.  For instance,
704
        to export the <filename>/cdrom</filename> directory to three
704
	to export the <filename>/cdrom</filename> directory to three
705
        example machines that have the same domain name as the server
705
	example machines that have the same domain name as the server
706
        (hence the lack of a domain name for each) or have entries in
706
	(hence the lack of a domain name for each) or have entries in
707
        your <filename>/etc/hosts</filename> file.  The
707
	your <filename>/etc/hosts</filename> file.  The
708
        <option>-ro</option> flag makes the exported file system
708
	<option>-ro</option> flag makes the exported file system
709
        read-only.  With this flag, the remote system will not be able
709
	read-only.  With this flag, the remote system will not be able
710
        to write any changes to the exported file system.</para>
710
	to write any changes to the exported file system.</para>
711
711
712
      <programlisting>/cdrom -ro host1 host2 host3</programlisting>
712
      <programlisting>/cdrom -ro host1 host2 host3</programlisting>
713
713
Lines 755-761 Link Here
755
755
756
      <para>One file system, <filename>/usr</filename>, has two lines
756
      <para>One file system, <filename>/usr</filename>, has two lines
757
	specifying exports to the same host, <hostid>client</hostid>.
757
	specifying exports to the same host, <hostid>client</hostid>.
758
        The correct format for this situation is:</para>
758
	The correct format for this situation is:</para>
759
759
760
      <programlisting>/usr/src /usr/ports  client</programlisting>
760
      <programlisting>/usr/src /usr/ports  client</programlisting>
761
761
Lines 785-791 Link Here
785
      <screen>&prompt.root; <userinput>kill -HUP `cat /var/run/mountd.pid`</userinput></screen>
785
      <screen>&prompt.root; <userinput>kill -HUP `cat /var/run/mountd.pid`</userinput></screen>
786
786
787
      <para>or by invoking the <command>mountd</command> &man.rc.8; script
787
      <para>or by invoking the <command>mountd</command> &man.rc.8; script
788
        with the appropriate parameter:</para>
788
	with the appropriate parameter:</para>
789
789
790
      <screen>&prompt.root; <userinput>/etc/rc.d/mountd onereload</userinput></screen>
790
      <screen>&prompt.root; <userinput>/etc/rc.d/mountd onereload</userinput></screen>
791
791
Lines 793-801 Link Here
793
	information about using rc scripts.</para>
793
	information about using rc scripts.</para>
794
794
795
      <para>Alternatively, a reboot will make FreeBSD set everything
795
      <para>Alternatively, a reboot will make FreeBSD set everything
796
        up properly.  A reboot is not necessary though.
796
	up properly.  A reboot is not necessary though.
797
        Executing the following commands as <username>root</username>
797
	Executing the following commands as <username>root</username>
798
        should start everything up.</para>
798
	should start everything up.</para>
799
799
800
      <para>On the <acronym>NFS</acronym> server:</para>
800
      <para>On the <acronym>NFS</acronym> server:</para>
801
801
Lines 813-822 Link Here
813
	name will be <hostid>client</hostid>.  If you only want to
813
	name will be <hostid>client</hostid>.  If you only want to
814
	temporarily mount a remote file system or would rather test the
814
	temporarily mount a remote file system or would rather test the
815
	configuration, just execute a command like this as <username>root</username> on the
815
	configuration, just execute a command like this as <username>root</username> on the
816
        client:</para>
816
	client:</para>
817
      <indexterm>
817
      <indexterm>
818
        <primary>NFS</primary>
818
	<primary>NFS</primary>
819
        <secondary>mounting</secondary>
819
	<secondary>mounting</secondary>
820
      </indexterm>
820
      </indexterm>
821
      <screen>&prompt.root; <userinput>mount server:/home /mnt</userinput></screen>
821
      <screen>&prompt.root; <userinput>mount server:/home /mnt</userinput></screen>
822
822
Lines 824-830 Link Here
824
	on the server at <filename>/mnt</filename> on the client.  If
824
	on the server at <filename>/mnt</filename> on the client.  If
825
	everything is set up correctly you should be able to enter
825
	everything is set up correctly you should be able to enter
826
	<filename>/mnt</filename> on the client and see all the files
826
	<filename>/mnt</filename> on the client and see all the files
827
        that are on the server.</para>
827
	that are on the server.</para>
828
828
829
      <para>If you want to automatically mount a remote file system
829
      <para>If you want to automatically mount a remote file system
830
	each time the computer boots, add the file system to the
830
	each time the computer boots, add the file system to the
Lines 833-839 Link Here
833
      <programlisting>server:/home	/mnt	nfs	rw	0	0</programlisting>
833
      <programlisting>server:/home	/mnt	nfs	rw	0	0</programlisting>
834
834
835
      <para>The &man.fstab.5; manual page lists all the available
835
      <para>The &man.fstab.5; manual page lists all the available
836
        options.</para>
836
	options.</para>
837
    </sect2>
837
    </sect2>
838
838
839
    <sect2>
839
    <sect2>
Lines 867-880 Link Here
867
      <title>Practical Uses</title>
867
      <title>Practical Uses</title>
868
868
869
      <para><acronym>NFS</acronym> has many practical uses.  Some of
869
      <para><acronym>NFS</acronym> has many practical uses.  Some of
870
        the more common ones are listed below:</para>
870
	the more common ones are listed below:</para>
871
871
872
      <indexterm>
872
      <indexterm>
873
        <primary>NFS</primary>
873
	<primary>NFS</primary>
874
        <secondary>uses</secondary>
874
	<secondary>uses</secondary>
875
      </indexterm>
875
      </indexterm>
876
      <itemizedlist>
876
      <itemizedlist>
877
        <listitem>
877
	<listitem>
878
	  <para>Set several machines to share a CDROM or other media
878
	  <para>Set several machines to share a CDROM or other media
879
	    among them.  This is cheaper and often a more convenient
879
	    among them.  This is cheaper and often a more convenient
880
	    method to install software on multiple machines.</para>
880
	    method to install software on multiple machines.</para>
Lines 891-900 Link Here
891
891
892
	<listitem>
892
	<listitem>
893
	  <para>Several machines could have a common
893
	  <para>Several machines could have a common
894
            <filename>/usr/ports/distfiles</filename> directory.  That
894
	    <filename>/usr/ports/distfiles</filename> directory.  That
895
            way, when you need to install a port on several machines,
895
	    way, when you need to install a port on several machines,
896
            you can quickly access the source without downloading it
896
	    you can quickly access the source without downloading it
897
            on each machine.</para>
897
	    on each machine.</para>
898
	</listitem>
898
	</listitem>
899
      </itemizedlist>
899
      </itemizedlist>
900
    </sect2>
900
    </sect2>
Lines 918-925 Link Here
918
      </sect2info>
918
      </sect2info>
919
      <title>Automatic Mounts with <application>amd</application></title>
919
      <title>Automatic Mounts with <application>amd</application></title>
920
920
921
      <indexterm><primary>amd</primary></indexterm>
921
      <indexterm>
922
      <indexterm><primary>automatic mounter daemon</primary></indexterm>
922
	<primary>amd</primary>
923
      </indexterm>
924
      <indexterm>
925
	<primary>automatic mounter daemon</primary>
926
      </indexterm>
923
927
924
      <para>&man.amd.8; (the automatic mounter daemon)
928
      <para>&man.amd.8; (the automatic mounter daemon)
925
	automatically mounts a
929
	automatically mounts a
Lines 929-935 Link Here
929
	<application>amd</application>.  Using
933
	<application>amd</application>.  Using
930
	<application>amd</application> provides a simple alternative
934
	<application>amd</application> provides a simple alternative
931
	to permanent mounts, as permanent mounts are usually listed in
935
	to permanent mounts, as permanent mounts are usually listed in
932
        <filename>/etc/fstab</filename>.</para>
936
	<filename>/etc/fstab</filename>.</para>
933
937
934
      <para><application>amd</application> operates by attaching
938
      <para><application>amd</application> operates by attaching
935
	itself as an NFS server to the <filename>/host</filename> and
939
	itself as an NFS server to the <filename>/host</filename> and
Lines 974-982 Link Here
974
      <programlisting>amd_enable="YES"</programlisting>
978
      <programlisting>amd_enable="YES"</programlisting>
975
979
976
      <para>Additionally, custom flags can be passed to
980
      <para>Additionally, custom flags can be passed to
977
      <application>amd</application> from the
981
	<application>amd</application> from the
978
      <varname>amd_flags</varname> option.  By default,
982
	<varname>amd_flags</varname> option.  By default,
979
      <varname>amd_flags</varname> is set to:</para>
983
	<varname>amd_flags</varname> is set to:</para>
980
984
981
      <programlisting>amd_flags="-a /.amd_mnt -l syslog /host /etc/amd.map /net /etc/amd.map"</programlisting>
985
      <programlisting>amd_flags="-a /.amd_mnt -l syslog /host /etc/amd.map /net /etc/amd.map"</programlisting>
982
986
Lines 991-1003 Link Here
991
995
992
    <sect2 id="network-nfs-integration">
996
    <sect2 id="network-nfs-integration">
993
      <sect2info>
997
      <sect2info>
994
        <authorgroup>
998
	<authorgroup>
995
          <author>
999
	  <author>
996
            <firstname>John</firstname>
1000
	    <firstname>John</firstname>
997
            <surname>Lind</surname>
1001
	    <surname>Lind</surname>
998
            <contrib>Contributed by </contrib>
1002
	    <contrib>Contributed by </contrib>
999
          </author>
1003
	  </author>
1000
        </authorgroup>
1004
	</authorgroup>
1001
      </sect2info>
1005
      </sect2info>
1002
      <title>Problems Integrating with Other Systems</title>
1006
      <title>Problems Integrating with Other Systems</title>
1003
1007
Lines 1111-1121 Link Here
1111
  <sect1 id="network-nis">
1115
  <sect1 id="network-nis">
1112
    <sect1info>
1116
    <sect1info>
1113
      <authorgroup>
1117
      <authorgroup>
1114
        <author>
1118
	<author>
1115
          <firstname>Bill</firstname>
1119
	  <firstname>Bill</firstname>
1116
      	  <surname>Swingle</surname>
1120
	  <surname>Swingle</surname>
1117
	  <contrib>Written by </contrib>
1121
	  <contrib>Written by </contrib>
1118
         </author>
1122
	</author>
1119
      </authorgroup>
1123
      </authorgroup>
1120
      <authorgroup>
1124
      <authorgroup>
1121
	<author>
1125
	<author>
Lines 1133-1156 Link Here
1133
1137
1134
    <sect2>
1138
    <sect2>
1135
      <title>What Is It?</title>
1139
      <title>What Is It?</title>
1136
      <indexterm><primary>NIS</primary></indexterm>
1140
      <indexterm>
1137
      <indexterm><primary>Solaris</primary></indexterm>
1141
	<primary>NIS</primary>
1138
      <indexterm><primary>HP-UX</primary></indexterm>
1142
      </indexterm>
1139
      <indexterm><primary>AIX</primary></indexterm>
1143
      <indexterm>
1140
      <indexterm><primary>Linux</primary></indexterm>
1144
	<primary>Solaris</primary>
1141
      <indexterm><primary>NetBSD</primary></indexterm>
1145
      </indexterm>
1142
      <indexterm><primary>OpenBSD</primary></indexterm>
1146
      <indexterm>
1147
	<primary>HP-UX</primary>
1148
      </indexterm>
1149
      <indexterm>
1150
	<primary>AIX</primary>
1151
      </indexterm>
1152
      <indexterm>
1153
	<primary>Linux</primary>
1154
      </indexterm>
1155
      <indexterm>
1156
	<primary>NetBSD</primary>
1157
      </indexterm>
1158
      <indexterm>
1159
	<primary>OpenBSD</primary>
1160
      </indexterm>
1143
1161
1144
      <para><acronym role="Network Information System">NIS</acronym>,
1162
      <para><acronym role="Network Information System">NIS</acronym>,
1145
        which stands for Network Information Services, was developed
1163
	which stands for Network Information Services, was developed
1146
        by Sun Microsystems to centralize administration of &unix;
1164
	by Sun Microsystems to centralize administration of &unix;
1147
        (originally &sunos;) systems.  It has now essentially become
1165
	(originally &sunos;) systems.  It has now essentially become
1148
        an industry standard; all major &unix; like systems
1166
	an industry standard; all major &unix; like systems
1149
        (&solaris;, HP-UX, &aix;, Linux, NetBSD, OpenBSD, FreeBSD,
1167
	(&solaris;, HP-UX, &aix;, Linux, NetBSD, OpenBSD, FreeBSD,
1150
        etc) support <acronym role="Network Information
1168
	etc) support <acronym role="Network Information
1151
        System">NIS</acronym>.</para>
1169
	System">NIS</acronym>.</para>
1152
1170
1153
      <indexterm><primary>yellow pages</primary><see>NIS</see></indexterm>
1171
      <indexterm>
1172
	<primary>yellow pages</primary>
1173
	<see>NIS</see>
1174
      </indexterm>
1154
1175
1155
      <para><acronym role="Network Information System">NIS</acronym>
1176
      <para><acronym role="Network Information System">NIS</acronym>
1156
	was formerly known as Yellow Pages, but because of trademark
1177
	was formerly known as Yellow Pages, but because of trademark
Lines 1158-1165 Link Here
1158
	often seen and used.</para>
1179
	often seen and used.</para>
1159
1180
1160
      <indexterm>
1181
      <indexterm>
1161
        <primary>NIS</primary>
1182
	<primary>NIS</primary>
1162
        <secondary>domains</secondary>
1183
	<secondary>domains</secondary>
1163
      </indexterm>
1184
      </indexterm>
1164
1185
1165
      <para>It is a RPC-based client/server system that allows a group
1186
      <para>It is a RPC-based client/server system that allows a group
Lines 1169-1188 Link Here
1169
	and add, remove or modify configuration data from a single
1190
	and add, remove or modify configuration data from a single
1170
	location.</para>
1191
	location.</para>
1171
1192
1172
      <indexterm><primary>Windows NT</primary></indexterm>
1193
      <indexterm>
1194
	<primary>Windows NT</primary>
1195
      </indexterm>
1173
1196
1174
      <para>It is similar to the &windowsnt; domain system; although
1197
      <para>It is similar to the &windowsnt; domain system; although
1175
        the internal implementation of the two are not at all similar,
1198
	the internal implementation of the two are not at all similar,
1176
        the basic functionality can be compared.</para>
1199
	the basic functionality can be compared.</para>
1177
    </sect2>
1200
    </sect2>
1178
1201
1179
    <sect2>
1202
    <sect2>
1180
      <title>Terms/Processes You Should Know</title>
1203
      <title>Terms/Processes You Should Know</title>
1181
1204
1182
      <para>There are several terms and several important user
1205
      <para>There are several terms and several important user
1183
        processes that you will come across when attempting to
1206
	processes that you will come across when attempting to
1184
        implement NIS on FreeBSD, whether you are trying to create an
1207
	implement NIS on FreeBSD, whether you are trying to create an
1185
        NIS server or act as an NIS client:</para>
1208
	NIS server or act as an NIS client:</para>
1186
1209
1187
      <indexterm>
1210
      <indexterm>
1188
	<primary><application>rpcbind</application></primary>
1211
	<primary><application>rpcbind</application></primary>
Lines 1236-1241 Link Here
1236
	    </row>
1259
	    </row>
1237
	    <row>
1260
	    <row>
1238
	      <entry><application>ypserv</application></entry>
1261
	      <entry><application>ypserv</application></entry>
1262
1239
	      <entry>Should only be running on NIS servers; this is
1263
	      <entry>Should only be running on NIS servers; this is
1240
		the NIS server process itself.  If &man.ypserv.8;
1264
		the NIS server process itself.  If &man.ypserv.8;
1241
		dies, then the server will no longer be able to
1265
		dies, then the server will no longer be able to
Lines 1252-1257 Link Here
1252
	    </row>
1276
	    </row>
1253
	    <row>
1277
	    <row>
1254
	      <entry><application>rpc.yppasswdd</application></entry>
1278
	      <entry><application>rpc.yppasswdd</application></entry>
1279
1255
	      <entry>Another process that should only be running on
1280
	      <entry>Another process that should only be running on
1256
		NIS master servers; this is a daemon that will allow NIS
1281
		NIS master servers; this is a daemon that will allow NIS
1257
		clients to change their NIS passwords.  If this daemon
1282
		clients to change their NIS passwords.  If this daemon
Lines 1286-1337 Link Here
1286
	bound to instead.</para>
1311
	bound to instead.</para>
1287
1312
1288
      <sect3>
1313
      <sect3>
1289
        <title>Machine Types</title>
1314
	<title>Machine Types</title>
1290
1315
1291
        <itemizedlist>
1316
	<itemizedlist>
1292
	  <indexterm>
1317
	  <indexterm>
1293
	    <primary>NIS</primary>
1318
	    <primary>NIS</primary>
1294
	    <secondary>master server</secondary>
1319
	    <secondary>master server</secondary>
1295
	  </indexterm>
1320
	  </indexterm>
1296
          <listitem>
1321
	  <listitem>
1297
            <para>A <emphasis>NIS master server</emphasis>.  This
1322
	    <para>A <emphasis>NIS master server</emphasis>.  This
1298
              server, analogous to a &windowsnt; primary domain
1323
	      server, analogous to a &windowsnt; primary domain
1299
              controller, maintains the files used by all of the NIS
1324
	      controller, maintains the files used by all of the NIS
1300
              clients.  The <filename>passwd</filename>,
1325
	      clients.  The <filename>passwd</filename>,
1301
              <filename>group</filename>, and other various files used
1326
	      <filename>group</filename>, and other various files used
1302
              by the NIS clients live on the master server.</para>
1327
	      by the NIS clients live on the master server.</para>
1303
1328
1304
            <note><para>It is possible for one machine to be an NIS
1329
	<note><para>It is possible for one machine to be an NIS
1305
              master server for more than one NIS domain.  However,
1330
	      master server for more than one NIS domain.  However,
1306
              this will not be covered in this introduction, which
1331
	      this will not be covered in this introduction, which
1307
              assumes a relatively small-scale NIS
1332
	      assumes a relatively small-scale NIS
1308
              environment.</para></note>
1333
	      environment.</para></note>
1309
          </listitem>
1334
	  </listitem>
1310
	  <indexterm>
1335
	  <indexterm>
1311
	    <primary>NIS</primary>
1336
	    <primary>NIS</primary>
1312
	    <secondary>slave server</secondary>
1337
	    <secondary>slave server</secondary>
1313
	  </indexterm>
1338
	  </indexterm>
1314
          <listitem>
1339
	  <listitem>
1315
            <para><emphasis>NIS slave servers</emphasis>.  Similar to
1340
	    <para><emphasis>NIS slave servers</emphasis>.  Similar to
1316
              the &windowsnt; backup domain controllers, NIS slave
1341
	      the &windowsnt; backup domain controllers, NIS slave
1317
              servers maintain copies of the NIS master's data files.
1342
	      servers maintain copies of the NIS master's data files.
1318
              NIS slave servers provide the redundancy, which is
1343
	      NIS slave servers provide the redundancy, which is
1319
              needed in important environments.  They also help to
1344
	      needed in important environments.  They also help to
1320
              balance the load of the master server: NIS Clients
1345
	      balance the load of the master server: NIS Clients
1321
              always attach to the NIS server whose response they get
1346
	      always attach to the NIS server whose response they get
1322
              first, and this includes slave-server-replies.</para>
1347
	      first, and this includes slave-server-replies.</para>
1323
          </listitem>
1348
	  </listitem>
1324
	  <indexterm>
1349
	  <indexterm>
1325
	    <primary>NIS</primary>
1350
	    <primary>NIS</primary>
1326
	    <secondary>client</secondary>
1351
	    <secondary>client</secondary>
1327
	  </indexterm>
1352
	  </indexterm>
1328
          <listitem>
1353
	  <listitem>
1329
            <para><emphasis>NIS clients</emphasis>.  NIS clients, like
1354
	    <para><emphasis>NIS clients</emphasis>.  NIS clients, like
1330
              most &windowsnt; workstations, authenticate against the
1355
	      most &windowsnt; workstations, authenticate against the
1331
              NIS server (or the &windowsnt; domain controller in the
1356
	      NIS server (or the &windowsnt; domain controller in the
1332
              &windowsnt; workstations case) to log on.</para>
1357
	      &windowsnt; workstations case) to log on.</para>
1333
          </listitem>
1358
	  </listitem>
1334
        </itemizedlist>
1359
	</itemizedlist>
1335
      </sect3>
1360
      </sect3>
1336
    </sect2>
1361
    </sect2>
1337
1362
Lines 1339-1417 Link Here
1339
      <title>Using NIS/YP</title>
1364
      <title>Using NIS/YP</title>
1340
1365
1341
      <para>This section will deal with setting up a sample NIS
1366
      <para>This section will deal with setting up a sample NIS
1342
        environment.</para>
1367
	environment.</para>
1343
1368
1344
      <sect3>
1369
      <sect3>
1345
        <title>Planning</title>
1370
	<title>Planning</title>
1346
1371
1347
        <para>Let us assume that you are the administrator of a small
1372
	<para>Let us assume that you are the administrator of a small
1348
          university lab.  This lab, which consists of 15 FreeBSD
1373
	  university lab.  This lab, which consists of 15 FreeBSD
1349
          machines, currently has no centralized point of
1374
	  machines, currently has no centralized point of
1350
          administration; each machine has its own
1375
	  administration; each machine has its own
1351
          <filename>/etc/passwd</filename> and
1376
	  <filename>/etc/passwd</filename> and
1352
          <filename>/etc/master.passwd</filename>.  These files are
1377
	  <filename>/etc/master.passwd</filename>.  These files are
1353
          kept in sync with each other only through manual
1378
	  kept in sync with each other only through manual
1354
          intervention; currently, when you add a user to the lab, you
1379
	  intervention; currently, when you add a user to the lab, you
1355
          must run <command>adduser</command> on all 15 machines.
1380
	  must run <command>adduser</command> on all 15 machines.
1356
          Clearly, this has to change, so you have decided to convert
1381
	  Clearly, this has to change, so you have decided to convert
1357
          the lab to use NIS, using two of the machines as
1382
	  the lab to use NIS, using two of the machines as
1358
          servers.</para>
1383
	  servers.</para>
1359
1384
1360
        <para>Therefore, the configuration of the lab now looks something
1385
	<para>Therefore, the configuration of the lab now looks something
1361
          like:</para>
1386
	  like:</para>
1362
1387
1363
        <informaltable frame="none" pgwide="1">
1388
	<informaltable frame="none" pgwide="1">
1364
          <tgroup cols="3">
1389
	  <tgroup cols="3">
1365
            <thead>
1390
	    <thead>
1366
              <row>
1391
	      <row>
1367
                <entry>Machine name</entry>
1392
		<entry>Machine name</entry>
1368
                <entry>IP address</entry>
1393
		<entry>IP address</entry>
1369
                <entry>Machine role</entry>
1394
		<entry>Machine role</entry>
1370
              </row>
1395
	      </row>
1371
            </thead>
1396
	    </thead>
1372
            <tbody>
1397
	    <tbody>
1373
              <row>
1398
	      <row>
1374
                <entry><hostid>ellington</hostid></entry>
1399
		<entry><hostid>ellington</hostid></entry>
1375
                <entry><hostid role="ipaddr">10.0.0.2</hostid></entry>
1400
		<entry><hostid role="ipaddr">10.0.0.2</hostid></entry>
1376
                <entry>NIS master</entry>
1401
		<entry>NIS master</entry>
1377
              </row>
1402
	      </row>
1378
              <row>
1403
	      <row>
1379
                <entry><hostid>coltrane</hostid></entry>
1404
		<entry><hostid>coltrane</hostid></entry>
1380
                <entry><hostid role="ipaddr">10.0.0.3</hostid></entry>
1405
		<entry><hostid role="ipaddr">10.0.0.3</hostid></entry>
1381
                <entry>NIS slave</entry>
1406
		<entry>NIS slave</entry>
1382
              </row>
1407
	      </row>
1383
              <row>
1408
	      <row>
1384
                <entry><hostid>basie</hostid></entry>
1409
		<entry><hostid>basie</hostid></entry>
1385
                <entry><hostid role="ipaddr">10.0.0.4</hostid></entry>
1410
		<entry><hostid role="ipaddr">10.0.0.4</hostid></entry>
1386
                <entry>Faculty workstation</entry>
1411
		<entry>Faculty workstation</entry>
1387
              </row>
1412
	      </row>
1388
              <row>
1413
	      <row>
1389
                <entry><hostid>bird</hostid></entry>
1414
		<entry><hostid>bird</hostid></entry>
1390
                <entry><hostid role="ipaddr">10.0.0.5</hostid></entry>
1415
		<entry><hostid role="ipaddr">10.0.0.5</hostid></entry>
1391
                <entry>Client machine</entry>
1416
		<entry>Client machine</entry>
1392
              </row>
1417
	      </row>
1393
              <row>
1418
	      <row>
1394
                <entry><hostid>cli[1-11]</hostid></entry>
1419
		<entry><hostid>cli[1-11]</hostid></entry>
1395
                <entry><hostid role="ipaddr">10.0.0.[6-17]</hostid></entry>
1420
		<entry><hostid role="ipaddr">10.0.0.[6-17]</hostid></entry>
1396
                <entry>Other client machines</entry>
1421
		<entry>Other client machines</entry>
1397
              </row>
1422
	      </row>
1398
            </tbody>
1423
	    </tbody>
1399
          </tgroup>
1424
	  </tgroup>
1400
        </informaltable>
1425
	</informaltable>
1401
1426
1402
        <para>If you are setting up a NIS scheme for the first time, it
1427
	<para>If you are setting up a NIS scheme for the first time, it
1403
	  is a good idea to think through how you want to go about it.  No
1428
	  is a good idea to think through how you want to go about it.  No
1404
	  matter what the size of your network, there are a few decisions
1429
	  matter what the size of your network, there are a few decisions
1405
	  that need to be made.</para>
1430
	  that need to be made.</para>
1406
1431
1407
        <sect4>
1432
	<sect4>
1408
          <title>Choosing a NIS Domain Name</title>
1433
	  <title>Choosing a NIS Domain Name</title>
1409
1434
1410
	  <indexterm>
1435
	  <indexterm>
1411
	    <primary>NIS</primary>
1436
	    <primary>NIS</primary>
1412
	    <secondary>domainname</secondary>
1437
	    <secondary>domainname</secondary>
1413
	  </indexterm>
1438
	  </indexterm>
1414
          <para>This might not be the <quote>domainname</quote> that
1439
	  <para>This might not be the <quote>domainname</quote> that
1415
	    you are used to.  It is more accurately called the
1440
	    you are used to.  It is more accurately called the
1416
	    <quote>NIS domainname</quote>.  When a client broadcasts
1441
	    <quote>NIS domainname</quote>.  When a client broadcasts
1417
	    its requests for info, it includes the name of the NIS
1442
	    its requests for info, it includes the name of the NIS
Lines 1431-1446 Link Here
1431
	    assume you have chosen the name
1456
	    assume you have chosen the name
1432
	    <literal>test-domain</literal>.</para>
1457
	    <literal>test-domain</literal>.</para>
1433
1458
1434
	  <indexterm><primary>SunOS</primary></indexterm>
1459
	  <indexterm>
1435
          <para>However, some operating systems (notably &sunos;) use
1460
	    <primary>SunOS</primary>
1436
          their NIS domain name as their Internet domain name.  If one
1461
	  </indexterm>
1437
          or more machines on your network have this restriction, you
1462
	  <para>However, some operating systems (notably &sunos;) use
1438
          <emphasis>must</emphasis> use the Internet domain name as
1463
	    their NIS domain name as their Internet domain name.  If one
1439
          your NIS domain name.</para>
1464
	    or more machines on your network have this restriction, you
1440
        </sect4>
1465
	    <emphasis>must</emphasis> use the Internet domain name as
1466
	    your NIS domain name.</para>
1467
	</sect4>
1441
1468
1442
        <sect4>
1469
	<sect4>
1443
          <title>Physical Server Requirements</title>
1470
	  <title>Physical Server Requirements</title>
1444
1471
1445
	  <para>There are several things to keep in mind when choosing
1472
	  <para>There are several things to keep in mind when choosing
1446
	    a machine to use as a NIS server.  One of the unfortunate
1473
	    a machine to use as a NIS server.  One of the unfortunate
Lines 1459-1469 Link Here
1459
	    the NIS server becomes unavailable, it will affect
1486
	    the NIS server becomes unavailable, it will affect
1460
	    <emphasis>all</emphasis> of your NIS clients
1487
	    <emphasis>all</emphasis> of your NIS clients
1461
	    adversely.</para>
1488
	    adversely.</para>
1462
        </sect4>
1489
	</sect4>
1463
      </sect3>
1490
      </sect3>
1464
1491
1465
      <sect3>
1492
      <sect3>
1466
        <title>NIS Servers</title>
1493
	<title>NIS Servers</title>
1467
1494
1468
	<para> The canonical copies of all NIS information are stored
1495
	<para> The canonical copies of all NIS information are stored
1469
	  on a single machine called the NIS master server.  The
1496
	  on a single machine called the NIS master server.  The
Lines 1485-1491 Link Here
1485
	  database file and transmitting data from the database back
1512
	  database file and transmitting data from the database back
1486
	  to the client.</para>
1513
	  to the client.</para>
1487
1514
1488
        <sect4>
1515
	<sect4>
1489
	  <title>Setting Up a NIS Master Server</title>
1516
	  <title>Setting Up a NIS Master Server</title>
1490
	  <indexterm>
1517
	  <indexterm>
1491
	    <primary>NIS</primary>
1518
	    <primary>NIS</primary>
Lines 1498-1590 Link Here
1498
	    <filename>/etc/rc.conf</filename>, and FreeBSD will do the
1525
	    <filename>/etc/rc.conf</filename>, and FreeBSD will do the
1499
	    rest for you.</para>
1526
	    rest for you.</para>
1500
1527
1501
          <procedure>
1528
	  <procedure>
1502
            <step>
1529
	    <step>
1503
              <para><programlisting>nisdomainname="test-domain"</programlisting>
1530
	      <para><programlisting>nisdomainname="test-domain"</programlisting>
1504
                This line will set the NIS domainname to
1531
		This line will set the NIS domainname to
1505
                <literal>test-domain</literal>
1532
		<literal>test-domain</literal>
1506
                upon network setup (e.g. after reboot).</para>
1533
		upon network setup (e.g. after reboot).</para>
1507
            </step>
1534
	    </step>
1508
            <step>
1535
	    <step>
1509
              <para><programlisting>nis_server_enable="YES"</programlisting>
1536
	      <programlisting>nis_server_enable="YES"</programlisting>
1510
                This will tell FreeBSD to start up the NIS server processes
1537
	      <para>This will tell FreeBSD to start up the NIS server processes
1511
                when the networking is next brought up.</para>
1538
		when the networking is next brought up.</para>
1512
            </step>
1539
	    </step>
1513
            <step>
1540
	    <step>
1514
              <para><programlisting>nis_yppasswdd_enable="YES"</programlisting>
1541
	      <programlisting>nis_yppasswdd_enable="YES"</programlisting>
1515
                This will enable the <command>rpc.yppasswdd</command>
1542
	      <para>This will enable the <command>rpc.yppasswdd</command>
1516
                daemon which, as mentioned above, will allow users to
1543
		daemon which, as mentioned above, will allow users to
1517
                change their NIS password from a client machine.</para>
1544
		change their NIS password from a client machine.</para>
1518
            </step>
1545
	      </step>
1519
          </procedure>
1546
	  </procedure>
1520
1547
1521
          <note>
1548
	  <note>
1522
            <para>Depending on your NIS setup, you may need to add
1549
	    <para>Depending on your NIS setup, you may need to add
1523
              further entries.  See the <link
1550
	      further entries.  See the <link
1524
              linkend="network-nis-server-is-client">section about NIS
1551
	      linkend="network-nis-server-is-client">section about NIS
1525
              servers that are also NIS clients</link>, below, for
1552
	      servers that are also NIS clients</link>, below, for
1526
              details.</para>
1553
	      details.</para>
1527
          </note>
1554
	  </note>
1528
1555
1529
          <para>After setting up the above entries, run the command
1556
	  <para>After setting up the above entries, run the command
1530
            <command>/etc/netstart</command> as superuser.  It will
1557
	    <command>/etc/netstart</command> as superuser.  It will
1531
            set up everything for you, using the values you defined in
1558
	    set up everything for you, using the values you defined in
1532
            <filename>/etc/rc.conf</filename>.  As a last step, before
1559
	    <filename>/etc/rc.conf</filename>.  As a last step, before
1533
	    initializing the NIS maps, start the
1560
	    initializing the NIS maps, start the
1534
	    <application>ypserv</application> daemon manually:</para>
1561
	    <application>ypserv</application> daemon manually:</para>
1535
1562
1536
	  <screen>&prompt.root; <userinput>/etc/rc.d/ypserv start</userinput></screen>
1563
	  <screen>&prompt.root; <userinput>/etc/rc.d/ypserv start</userinput></screen>
1537
        </sect4>
1564
	</sect4>
1538
1565
1539
        <sect4>
1566
	<sect4>
1540
          <title>Initializing the NIS Maps</title>
1567
	  <title>Initializing the NIS Maps</title>
1541
          <indexterm>
1568
	  <indexterm>
1542
            <primary>NIS</primary>
1569
	    <primary>NIS</primary>
1543
            <secondary>maps</secondary>
1570
	    <secondary>maps</secondary>
1544
          </indexterm>
1571
	  </indexterm>
1545
          <para>The <emphasis>NIS maps</emphasis> are database files,
1572
	  <para>The <emphasis>NIS maps</emphasis> are database files,
1546
            that are kept in the <filename>/var/yp</filename>
1573
	    that are kept in the <filename>/var/yp</filename>
1547
            directory.  They are generated from configuration files in
1574
	    directory.  They are generated from configuration files in
1548
            the <filename>/etc</filename> directory of the NIS master,
1575
	    the <filename>/etc</filename> directory of the NIS master,
1549
            with one exception: the
1576
	    with one exception: the
1550
            <filename>/etc/master.passwd</filename> file.  This is for
1577
	    <filename>/etc/master.passwd</filename> file.  This is for
1551
            a good reason, you do not want to propagate passwords to
1578
	    a good reason, you do not want to propagate passwords to
1552
            your <username>root</username> and other administrative
1579
	    your <username>root</username> and other administrative
1553
            accounts to all the servers in the NIS domain.  Therefore,
1580
	    accounts to all the servers in the NIS domain.  Therefore,
1554
            before we initialize the NIS maps, you should:</para>
1581
	    before we initialize the NIS maps, you should:</para>
1555
1582
1556
          <screen>&prompt.root; <userinput>cp /etc/master.passwd /var/yp/master.passwd</userinput>
1583
	   <screen>&prompt.root; <userinput>cp /etc/master.passwd /var/yp/master.passwd</userinput>
1557
&prompt.root; <userinput>cd /var/yp</userinput>
1584
&prompt.root; <userinput>cd /var/yp</userinput>
1558
&prompt.root; <userinput>vi master.passwd</userinput></screen>
1585
&prompt.root; <userinput>vi master.passwd</userinput></screen>
1559
1586
1560
          <para>You should remove all entries regarding system
1587
	  <para>You should remove all entries regarding system
1561
            accounts (<username>bin</username>,
1588
	    accounts (<username>bin</username>,
1562
            <username>tty</username>, <username>kmem</username>,
1589
	    <username>tty</username>, <username>kmem</username>,
1563
            <username>games</username>, etc), as well as any accounts
1590
	    <username>games</username>, etc), as well as any accounts
1564
            that you do not want to be propagated to the NIS clients
1591
	    that you do not want to be propagated to the NIS clients
1565
            (for example <username>root</username> and any other UID 0
1592
	    (for example <username>root</username> and any other UID 0
1566
            (superuser) accounts).</para>
1593
	    (superuser) accounts).</para>
1567
1594
1568
          <note><para>Make sure the
1595
	  <note><para>Make sure the
1569
            <filename>/var/yp/master.passwd</filename> is neither group
1596
	    <filename>/var/yp/master.passwd</filename> is neither group
1570
            nor world readable (mode 600)!  Use the
1597
	    nor world readable (mode 600)!  Use the
1571
            <command>chmod</command> command, if appropriate.</para></note>
1598
	    <command>chmod</command> command, if appropriate.</para></note>
1572
1599
1573
	  <indexterm><primary>Tru64 UNIX</primary></indexterm>
1600
	  <indexterm>
1601
	    <primary>Tru64 UNIX</primary>
1602
	  </indexterm>
1574
1603
1575
          <para>When you have finished, it is time to initialize the
1604
	   <para>When you have finished, it is time to initialize the
1576
            NIS maps!  FreeBSD includes a script named
1605
	     NIS maps!  FreeBSD includes a script named
1577
            <command>ypinit</command> to do this for you (see its
1606
	     <command>ypinit</command> to do this for you (see its
1578
            manual page for more information).  Note that this script
1607
	     manual page for more information).  Note that this script
1579
            is available on most &unix; Operating Systems, but not on
1608
	      is available on most &unix; Operating Systems, but not on
1580
            all.  On Digital UNIX/Compaq Tru64 UNIX it is called
1609
	     all.  On Digital UNIX/Compaq Tru64 UNIX it is called
1581
            <command>ypsetup</command>.  Because we are generating
1610
	     <command>ypsetup</command>.  Because we are generating
1582
            maps for an NIS master, we are going to pass the
1611
	      maps for an NIS master, we are going to pass the
1583
            <option>-m</option> option to <command>ypinit</command>.
1612
	     <option>-m</option> option to <command>ypinit</command>.
1584
            To generate the NIS maps, assuming you already performed
1613
	     To generate the NIS maps, assuming you already performed
1585
            the steps above, run:</para>
1614
	     the steps above, run:</para>
1586
1615
1587
          <screen>ellington&prompt.root; <userinput>ypinit -m test-domain</userinput>
1616
	  <screen>ellington&prompt.root; <userinput>ypinit -m test-domain</userinput>
1588
Server Type: MASTER Domain: test-domain
1617
Server Type: MASTER Domain: test-domain
1589
Creating an YP server will require that you answer a few questions.
1618
Creating an YP server will require that you answer a few questions.
1590
Questions will all be asked at the beginning of the procedure.
1619
Questions will all be asked at the beginning of the procedure.
Lines 1608-1632 Link Here
1608
NIS Map update completed.
1637
NIS Map update completed.
1609
ellington has been setup as an YP master server without any errors.</screen>
1638
ellington has been setup as an YP master server without any errors.</screen>
1610
1639
1611
          <para><command>ypinit</command> should have created
1640
	  <para><command>ypinit</command> should have created
1612
            <filename>/var/yp/Makefile</filename> from
1641
	    <filename>/var/yp/Makefile</filename> from
1613
            <filename>/var/yp/Makefile.dist</filename>.
1642
	    <filename>/var/yp/Makefile.dist</filename>.
1614
            When created, this file assumes that you are operating
1643
	    When created, this file assumes that you are operating
1615
            in a single server NIS environment with only FreeBSD
1644
	    in a single server NIS environment with only FreeBSD
1616
            machines.  Since <literal>test-domain</literal> has
1645
	    machines.  Since <literal>test-domain</literal> has
1617
            a slave server as well, you must edit
1646
	    a slave server as well, you must edit
1618
            <filename>/var/yp/Makefile</filename>:</para>
1647
	    <filename>/var/yp/Makefile</filename>:</para>
1619
1648
1620
          <screen>ellington&prompt.root; <userinput>vi /var/yp/Makefile</userinput></screen>
1649
	  <screen>ellington&prompt.root; <userinput>vi /var/yp/Makefile</userinput></screen>
1621
1650
1622
	  <para>You should comment out the line that says</para>
1651
	  <para>You should comment out the line that says</para>
1623
1652
1624
	  <programlisting>NOPUSH = "True"</programlisting>
1653
	  <programlisting>NOPUSH = "True"</programlisting>
1625
1654
1626
	  <para>(if it is not commented out already).</para>
1655
	  <para>(if it is not commented out already).</para>
1627
        </sect4>
1656
	</sect4>
1628
1657
1629
        <sect4>
1658
	<sect4>
1630
	  <title>Setting up a NIS Slave Server</title>
1659
	  <title>Setting up a NIS Slave Server</title>
1631
	  <indexterm>
1660
	  <indexterm>
1632
	    <primary>NIS</primary>
1661
	    <primary>NIS</primary>
Lines 1634-1647 Link Here
1634
	  </indexterm>
1663
	  </indexterm>
1635
	  <para>Setting up an NIS slave server is even more simple than
1664
	  <para>Setting up an NIS slave server is even more simple than
1636
	    setting up the master.  Log on to the slave server and edit the
1665
	    setting up the master.  Log on to the slave server and edit the
1637
            file <filename>/etc/rc.conf</filename> as you did before.
1666
	    file <filename>/etc/rc.conf</filename> as you did before.
1638
            The only difference is that we now must use the
1667
	    The only difference is that we now must use the
1639
            <option>-s</option> option when running <command>ypinit</command>.
1668
	    <option>-s</option> option when running <command>ypinit</command>.
1640
            The <option>-s</option> option requires the name of the NIS
1669
	    The <option>-s</option> option requires the name of the NIS
1641
            master be passed to it as well, so our command line looks
1670
	    master be passed to it as well, so our command line looks
1642
            like:</para>
1671
	    like:</para>
1643
1672
1644
  <screen>coltrane&prompt.root; <userinput>ypinit -s ellington test-domain</userinput>
1673
	  <screen>coltrane&prompt.root; <userinput>ypinit -s ellington test-domain</userinput>
1645
1674
1646
Server Type: SLAVE Domain: test-domain Master: ellington
1675
Server Type: SLAVE Domain: test-domain Master: ellington
1647
1676
Lines 1718-1730 Link Here
1718
	    is especially important on busy networks where map updates
1747
	    is especially important on busy networks where map updates
1719
	    might not always complete.</para>
1748
	    might not always complete.</para>
1720
1749
1721
          <para>Now, run the command <command>/etc/netstart</command> on the
1750
	  <para>Now, run the command <command>/etc/netstart</command> on the
1722
            slave server as well, which again starts the NIS server.</para>
1751
	    slave server as well, which again starts the NIS server.</para>
1723
	</sect4>
1752
	</sect4>
1724
      </sect3>
1753
      </sect3>
1725
1754
1726
      <sect3>
1755
      <sect3>
1727
        <title>NIS Clients</title>
1756
	<title>NIS Clients</title>
1728
1757
1729
	<para> An NIS client establishes what is called a binding to a
1758
	<para> An NIS client establishes what is called a binding to a
1730
	  particular NIS server using the
1759
	  particular NIS server using the
Lines 1761-1769 Link Here
1761
	  <procedure>
1790
	  <procedure>
1762
	    <step>
1791
	    <step>
1763
	      <para>Edit the file <filename>/etc/rc.conf</filename> and
1792
	      <para>Edit the file <filename>/etc/rc.conf</filename> and
1764
                add the following lines in order to set the NIS domainname
1793
		add the following lines in order to set the NIS domainname
1765
                and start <command>ypbind</command> upon network
1794
		and start <command>ypbind</command> upon network
1766
                startup:</para>
1795
		startup:</para>
1767
1796
1768
	      <programlisting>nisdomainname="test-domain"
1797
	      <programlisting>nisdomainname="test-domain"
1769
nis_client_enable="YES"</programlisting>
1798
nis_client_enable="YES"</programlisting>
Lines 1774-1780 Link Here
1774
		server, remove all user accounts from your
1803
		server, remove all user accounts from your
1775
		<filename>/etc/master.passwd</filename> file and use
1804
		<filename>/etc/master.passwd</filename> file and use
1776
		<command>vipw</command> to add the following line to
1805
		<command>vipw</command> to add the following line to
1777
                the end of the file:</para>
1806
		the end of the file:</para>
1778
1807
1779
	      <programlisting>+:::::::::</programlisting>
1808
	      <programlisting>+:::::::::</programlisting>
1780
1809
Lines 1784-1803 Link Here
1784
		  many ways to configure your NIS client by changing this
1813
		  many ways to configure your NIS client by changing this
1785
		  line.  See the <link linkend="network-netgroups">netgroups
1814
		  line.  See the <link linkend="network-netgroups">netgroups
1786
		  section</link> below for more information.
1815
		  section</link> below for more information.
1787
                  For more detailed reading see O'Reilly's book on
1816
		   For more detailed reading see O'Reilly's book on
1788
		  <literal>Managing NFS and NIS</literal>.</para>
1817
		  <literal>Managing NFS and NIS</literal>.</para>
1789
	      </note>
1818
	      </note>
1790
1819
1791
              <note>
1820
	      <note>
1792
                <para>You should keep at least one local account (i.e.
1821
		<para>You should keep at least one local account (i.e.
1793
                  not imported via NIS) in your
1822
		   not imported via NIS) in your
1794
                  <filename>/etc/master.passwd</filename> and this
1823
		  <filename>/etc/master.passwd</filename> and this
1795
                  account should also be a member of the group
1824
		  account should also be a member of the group
1796
                  <groupname>wheel</groupname>.  If there is something
1825
		  <groupname>wheel</groupname>.  If there is something
1797
                  wrong with NIS, this account can be used to log in
1826
		  wrong with NIS, this account can be used to log in
1798
                  remotely, become <username>root</username>, and fix things.</para>
1827
		  remotely, become <username>root</username>, and fix things.</para>
1799
              </note>
1828
	      </note>
1800
            </step>
1829
	    </step>
1801
1830
1802
	    <step>
1831
	    <step>
1803
	      <para>To import all possible group entries from the NIS
1832
	      <para>To import all possible group entries from the NIS
Lines 1869-1903 Link Here
1869
	<filename>/var/yp/securenets</filename>.</para>
1898
	<filename>/var/yp/securenets</filename>.</para>
1870
1899
1871
      <note>
1900
      <note>
1872
        <para>While both of these access control mechanisms provide some
1901
	<para>While both of these access control mechanisms provide some
1873
          security, they, like the privileged port test, are
1902
	  security, they, like the privileged port test, are
1874
          vulnerable to <quote>IP spoofing</quote> attacks.  All
1903
	  vulnerable to <quote>IP spoofing</quote> attacks.  All
1875
          NIS-related traffic should be blocked at your firewall.</para>
1904
	  NIS-related traffic should be blocked at your firewall.</para>
1876
1905
1877
        <para>Servers using <filename>/var/yp/securenets</filename>
1906
	<para>Servers using <filename>/var/yp/securenets</filename>
1878
          may fail to serve legitimate NIS clients with archaic TCP/IP
1907
	  may fail to serve legitimate NIS clients with archaic TCP/IP
1879
          implementations.  Some of these implementations set all
1908
	  implementations.  Some of these implementations set all
1880
          host bits to zero when doing broadcasts and/or fail to
1909
	  host bits to zero when doing broadcasts and/or fail to
1881
          observe the subnet mask when calculating the broadcast
1910
	  observe the subnet mask when calculating the broadcast
1882
          address.  While some of these problems can be fixed by
1911
	  address.  While some of these problems can be fixed by
1883
          changing the client configuration, other problems may force
1912
	  changing the client configuration, other problems may force
1884
          the retirement of the client systems in question or the
1913
	  the retirement of the client systems in question or the
1885
          abandonment of <filename>/var/yp/securenets</filename>.</para>
1914
	  abandonment of <filename>/var/yp/securenets</filename>.</para>
1886
1915
1887
        <para>Using <filename>/var/yp/securenets</filename> on a
1916
	<para>Using <filename>/var/yp/securenets</filename> on a
1888
          server with such an archaic implementation of TCP/IP is a
1917
	  server with such an archaic implementation of TCP/IP is a
1889
          really bad idea and will lead to loss of NIS functionality
1918
	  really bad idea and will lead to loss of NIS functionality
1890
          for large parts of your network.</para>
1919
	  for large parts of your network.</para>
1891
1920
1892
	<indexterm><primary>TCP Wrappers</primary></indexterm>
1921
	<indexterm>
1893
        <para>The use of the <application>TCP Wrapper</application>
1922
	  <primary>TCP Wrappers</primary>
1894
          package increases the latency of your NIS server.  The
1923
	</indexterm>
1895
          additional delay may be long enough to cause timeouts in
1924
	<para>The use of the <application>TCP Wrapper</application>
1896
          client programs, especially in busy networks or with slow
1925
	  package increases the latency of your NIS server.  The
1897
          NIS servers.  If one or more of your client systems
1926
	  additional delay may be long enough to cause timeouts in
1898
          suffers from these symptoms, you should convert the client
1927
	  client programs, especially in busy networks or with slow
1899
          systems in question into NIS slave servers and force them
1928
	  NIS servers.  If one or more of your client systems
1900
          to bind to themselves.</para>
1929
	  suffers from these symptoms, you should convert the client
1930
	  systems in question into NIS slave servers and force them
1931
	  to bind to themselves.</para>
1901
      </note>
1932
      </note>
1902
    </sect2>
1933
    </sect2>
1903
1934
Lines 1905-1932 Link Here
1905
      <title>Barring Some Users from Logging On</title>
1936
      <title>Barring Some Users from Logging On</title>
1906
1937
1907
      <para>In our lab, there is a machine <hostid>basie</hostid> that
1938
      <para>In our lab, there is a machine <hostid>basie</hostid> that
1908
        is supposed to be a faculty only workstation.  We do not want
1939
	is supposed to be a faculty only workstation.  We do not want
1909
        to take this machine out of the NIS domain, yet the
1940
	to take this machine out of the NIS domain, yet the
1910
        <filename>passwd</filename> file on the master NIS server
1941
	<filename>passwd</filename> file on the master NIS server
1911
        contains accounts for both faculty and students.  What can we
1942
	contains accounts for both faculty and students.  What can we
1912
        do?</para>
1943
	do?</para>
1913
1944
1914
      <para>There is a way to bar specific users from logging on to a
1945
      <para>There is a way to bar specific users from logging on to a
1915
        machine, even if they are present in the NIS database.  To do
1946
	machine, even if they are present in the NIS database.  To do
1916
        this, all you must do is add
1947
	this, all you must do is add
1917
        <literal>-<replaceable>username</replaceable></literal> to the
1948
	<literal>-<replaceable>username</replaceable></literal> to the
1918
        end of the <filename>/etc/master.passwd</filename> file on the
1949
	end of the <filename>/etc/master.passwd</filename> file on the
1919
        client machine, where <replaceable>username</replaceable> is
1950
	client machine, where <replaceable>username</replaceable> is
1920
        the username of the user you wish to bar from logging in.
1951
	the username of the user you wish to bar from logging in.
1921
        This should preferably be done using <command>vipw</command>,
1952
	This should preferably be done using <command>vipw</command>,
1922
        since <command>vipw</command> will sanity check your changes
1953
	since <command>vipw</command> will sanity check your changes
1923
        to <filename>/etc/master.passwd</filename>, as well as
1954
	to <filename>/etc/master.passwd</filename>, as well as
1924
        automatically rebuild the password database when you finish
1955
	automatically rebuild the password database when you finish
1925
        editing.  For example, if we wanted to bar user
1956
	editing.  For example, if we wanted to bar user
1926
        <username>bill</username> from logging on to
1957
	<username>bill</username> from logging on to
1927
        <hostid>basie</hostid> we would:</para>
1958
	<hostid>basie</hostid> we would:</para>
1928
1959
1929
        <screen>basie&prompt.root; <userinput>vipw</userinput>
1960
      <screen>basie&prompt.root; <userinput>vipw</userinput>
1930
<userinput>[add -bill to the end, exit]</userinput>
1961
<userinput>[add -bill to the end, exit]</userinput>
1931
vipw: rebuilding the database...
1962
vipw: rebuilding the database...
1932
vipw: done
1963
vipw: done
Lines 1956-2120 Link Here
1956
1987
1957
    <sect2 id="network-netgroups">
1988
    <sect2 id="network-netgroups">
1958
      <sect2info>
1989
      <sect2info>
1959
        <authorgroup>
1990
	<authorgroup>
1960
          <author>
1991
	  <author>
1961
            <firstname>Udo</firstname>
1992
	    <firstname>Udo</firstname>
1962
            <surname>Erdelhoff</surname>
1993
	    <surname>Erdelhoff</surname>
1963
            <contrib>Contributed by </contrib>
1994
	    <contrib>Contributed by </contrib>
1964
          </author>
1995
	  </author>
1965
        </authorgroup>
1996
	</authorgroup>
1966
      </sect2info>
1997
      </sect2info>
1967
1998
1968
      <title>Using Netgroups</title>
1999
      <title>Using Netgroups</title>
1969
      <indexterm><primary>netgroups</primary></indexterm>
2000
      <indexterm>
2001
	<primary>netgroups</primary>
2002
      </indexterm>
1970
2003
1971
      <para>The method shown in the previous section works reasonably
2004
      <para>The method shown in the previous section works reasonably
1972
        well if you need special rules for a very small number of
2005
	well if you need special rules for a very small number of
1973
        users and/or machines.  On larger networks, you
2006
	users and/or machines.  On larger networks, you
1974
        <emphasis>will</emphasis> forget to bar some users from logging
2007
	<emphasis>will</emphasis> forget to bar some users from logging
1975
        onto sensitive machines, or you may even have to modify each
2008
	onto sensitive machines, or you may even have to modify each
1976
        machine separately, thus losing the main benefit of NIS:
2009
	machine separately, thus losing the main benefit of NIS:
1977
        <emphasis>centralized</emphasis> administration.</para>
2010
	<emphasis>centralized</emphasis> administration.</para>
1978
2011
1979
      <para>The NIS developers' solution for this problem is called
2012
      <para>The NIS developers' solution for this problem is called
1980
        <emphasis>netgroups</emphasis>.  Their purpose and semantics
2013
	<emphasis>netgroups</emphasis>.  Their purpose and semantics
1981
        can be compared to the normal groups used by &unix; file
2014
	can be compared to the normal groups used by &unix; file
1982
        systems.  The main differences are the lack of a numeric ID
2015
	systems.  The main differences are the lack of a numeric ID
1983
        and the ability to define a netgroup by including both user
2016
	and the ability to define a netgroup by including both user
1984
        accounts and other netgroups.</para>
2017
	accounts and other netgroups.</para>
1985
2018
1986
      <para>Netgroups were developed to handle large, complex networks
2019
      <para>Netgroups were developed to handle large, complex networks
1987
        with hundreds of users and machines.  On one hand, this is
2020
	with hundreds of users and machines.  On one hand, this is
1988
        a Good Thing if you are forced to deal with such a situation.
2021
	a Good Thing if you are forced to deal with such a situation.
1989
        On the other hand, this complexity makes it almost impossible to
2022
	On the other hand, this complexity makes it almost impossible to
1990
        explain netgroups with really simple examples.  The example
2023
	explain netgroups with really simple examples.  The example
1991
        used in the remainder of this section demonstrates this
2024
	used in the remainder of this section demonstrates this
1992
        problem.</para>
2025
	problem.</para>
1993
2026
1994
      <para>Let us assume that your successful introduction of NIS in
2027
      <para>Let us assume that your successful introduction of NIS in
1995
        your laboratory caught your superiors' interest.  Your next
2028
	your laboratory caught your superiors' interest.  Your next
1996
        job is to extend your NIS domain to cover some of the other
2029
	job is to extend your NIS domain to cover some of the other
1997
        machines on campus.  The two tables contain the names of the
2030
	machines on campus.  The two tables contain the names of the
1998
        new users and new machines as well as brief descriptions of
2031
	new users and new machines as well as brief descriptions of
1999
        them.</para>
2032
	them.</para>
2000
2033
2001
      <informaltable frame="none" pgwide="1">
2034
      <informaltable frame="none" pgwide="1">
2002
        <tgroup cols="2">
2035
	<tgroup cols="2">
2003
          <thead>
2036
	  <thead>
2004
            <row>
2037
	    <row>
2005
              <entry>User Name(s)</entry>
2038
	      <entry>User Name(s)</entry>
2006
              <entry>Description</entry>
2039
	      <entry>Description</entry>
2007
            </row>
2040
	    </row>
2008
          </thead>
2041
	  </thead>
2009
2042
2010
          <tbody>
2043
	  <tbody>
2011
            <row>
2044
	    <row>
2012
              <entry><username>alpha</username>, <username>beta</username></entry>
2045
	      <entry><username>alpha</username>, <username>beta</username></entry>
2013
              <entry>Normal employees of the IT department</entry>
2046
	      <entry>Normal employees of the IT department</entry>
2014
            </row>
2047
	    </row>
2015
2048
2016
            <row>
2049
	    <row>
2017
              <entry><username>charlie</username>, <username>delta</username></entry>
2050
	      <entry><username>charlie</username>, <username>delta</username></entry>
2018
              <entry>The new apprentices of the IT department</entry>
2051
	      <entry>The new apprentices of the IT department</entry>
2019
            </row>
2052
	    </row>
2020
2053
2021
            <row>
2054
	    <row>
2022
              <entry><username>echo</username>, <username>foxtrott</username>, <username>golf</username>, ...</entry>
2055
	      <entry><username>echo</username>, <username>foxtrott</username>, <username>golf</username>, ...</entry>
2023
              <entry>Ordinary employees</entry>
2056
	      <entry>Ordinary employees</entry>
2024
            </row>
2057
	    </row>
2025
2058
2026
            <row>
2059
	    <row>
2027
              <entry><username>able</username>, <username>baker</username>, ...</entry>
2060
	      <entry><username>able</username>, <username>baker</username>, ...</entry>
2028
              <entry>The current interns</entry>
2061
	      <entry>The current interns</entry>
2029
            </row>
2062
	    </row>
2030
          </tbody>
2063
	  </tbody>
2031
        </tgroup>
2064
	</tgroup>
2032
      </informaltable>
2065
      </informaltable>
2033
2066
2034
      <informaltable frame="none" pgwide="1">
2067
      <informaltable frame="none" pgwide="1">
2035
        <tgroup cols="2">
2068
	<tgroup cols="2">
2036
          <thead>
2069
	  <thead>
2037
            <row>
2070
	    <row>
2038
              <entry>Machine Name(s)</entry>
2071
	      <entry>Machine Name(s)</entry>
2039
              <entry>Description</entry>
2072
	      <entry>Description</entry>
2040
            </row>
2073
	    </row>
2041
          </thead>
2074
	  </thead>
2042
2075
2043
          <tbody>
2076
	<tbody>
2044
            <row>
2077
	    <row>
2045
              <!--  Names taken from "Good Omens" by Neil Gaiman and Terry
2078
	      <!--  Names taken from "Good Omens" by Neil Gaiman and Terry
2046
                    Pratchett.  Many thanks for a brilliant book.  -->
2079
		    Pratchett.  Many thanks for a brilliant book.  -->
2047
2080
2048
              <entry><hostid>war</hostid>, <hostid>death</hostid>,
2081
	      <entry><hostid>war</hostid>, <hostid>death</hostid>,
2049
              <hostid>famine</hostid>,
2082
		<hostid>famine</hostid>,
2050
              <hostid>pollution</hostid></entry>
2083
		<hostid>pollution</hostid></entry>
2051
              <entry>Your most important servers.  Only the IT
2084
	      <entry>Your most important servers.  Only the IT
2052
                employees are allowed to log onto these
2085
		employees are allowed to log onto these
2053
                machines.</entry>
2086
		machines.</entry>
2054
            </row>
2087
	     </row>
2055
            <row>
2088
	    <row>
2056
              <!-- gluttony was omitted because it was too fat -->
2089
              <!-- gluttony was omitted because it was too fat -->
2057
2090
2058
              <entry><hostid>pride</hostid>, <hostid>greed</hostid>,
2091
	      <entry><hostid>pride</hostid>, <hostid>greed</hostid>,
2059
              <hostid>envy</hostid>, <hostid>wrath</hostid>,
2092
		<hostid>envy</hostid>, <hostid>wrath</hostid>,
2060
              <hostid>lust</hostid>, <hostid>sloth</hostid></entry>
2093
		<hostid>lust</hostid>, <hostid>sloth</hostid></entry>
2061
              <entry>Less important servers.  All members of the IT
2094
	      <entry>Less important servers.  All members of the IT
2062
              department are allowed to login onto these
2095
		department are allowed to login onto these
2063
              machines.</entry>
2096
		machines.</entry>
2064
            </row>
2097
	     </row>
2065
2098
2066
            <row>
2099
	    <row>
2067
              <entry><hostid>one</hostid>, <hostid>two</hostid>,
2100
	      <entry><hostid>one</hostid>, <hostid>two</hostid>,
2068
                <hostid>three</hostid>, <hostid>four</hostid>,
2101
		<hostid>three</hostid>, <hostid>four</hostid>,
2069
                ...</entry>
2102
		...</entry>
2070
2103
2071
              <entry>Ordinary workstations.  Only the
2104
	      <entry>Ordinary workstations.  Only the
2072
                <emphasis>real</emphasis> employees are allowed to use
2105
		<emphasis>real</emphasis> employees are allowed to use
2073
                these machines.</entry>
2106
		these machines.</entry>
2074
            </row>
2107
	     </row>
2075
2108
2076
            <row>
2109
	    <row>
2077
              <entry><hostid>trashcan</hostid></entry>
2110
	      <entry><hostid>trashcan</hostid></entry>
2078
              <entry>A very old machine without any critical data.
2111
	      <entry>A very old machine without any critical data.
2079
                Even the intern is allowed to use this box.</entry>
2112
		Even the intern is allowed to use this box.</entry>
2080
            </row>
2113
	     </row>
2081
          </tbody>
2114
	  </tbody>
2082
        </tgroup>
2115
	</tgroup>
2083
      </informaltable>
2116
      </informaltable>
2084
2117
2085
      <para>If you tried to implement these restrictions by separately
2118
      <para>If you tried to implement these restrictions by separately
2086
        blocking each user, you would have to add one
2119
	blocking each user, you would have to add one
2087
        <literal>-<replaceable>user</replaceable></literal> line to
2120
	<literal>-<replaceable>user</replaceable></literal> line to
2088
        each system's <filename>passwd</filename> for each user who is
2121
	each system's <filename>passwd</filename> for each user who is
2089
        not allowed to login onto that system.  If you forget just one
2122
	not allowed to login onto that system.  If you forget just one
2090
        entry, you could be in trouble.  It may be feasible to do this
2123
	entry, you could be in trouble.  It may be feasible to do this
2091
        correctly during the initial setup, however you
2124
	correctly during the initial setup, however you
2092
        <emphasis>will</emphasis> eventually forget to add the lines
2125
	<emphasis>will</emphasis> eventually forget to add the lines
2093
        for new users during day-to-day operations.  After all, Murphy
2126
	for new users during day-to-day operations.  After all, Murphy
2094
        was an optimist.</para>
2127
	was an optimist.</para>
2095
2128
2096
      <para>Handling this situation with netgroups offers several
2129
      <para>Handling this situation with netgroups offers several
2097
        advantages.  Each user need not be handled separately; you
2130
	advantages.  Each user need not be handled separately; you
2098
        assign a user to one or more netgroups and allow or forbid
2131
	assign a user to one or more netgroups and allow or forbid
2099
        logins for all members of the netgroup.  If you add a new
2132
	logins for all members of the netgroup.  If you add a new
2100
        machine, you will only have to define login restrictions for
2133
	machine, you will only have to define login restrictions for
2101
        netgroups.  If a new user is added, you will only have to add
2134
	netgroups.  If a new user is added, you will only have to add
2102
        the user to one or more netgroups.  Those changes are
2135
	the user to one or more netgroups.  Those changes are
2103
        independent of each other: no more <quote>for each combination
2136
	independent of each other: no more <quote>for each combination
2104
        of user and machine do...</quote> If your NIS setup is planned
2137
	of user and machine do...</quote> If your NIS setup is planned
2105
        carefully, you will only have to modify exactly one central
2138
	carefully, you will only have to modify exactly one central
2106
        configuration file to grant or deny access to machines.</para>
2139
	configuration file to grant or deny access to machines.</para>
2107
2140
2108
      <para>The first step is the initialization of the NIS map
2141
      <para>The first step is the initialization of the NIS map
2109
        netgroup.  FreeBSD's &man.ypinit.8; does not create this map by
2142
	netgroup.  FreeBSD's &man.ypinit.8; does not create this map by
2110
        default, but its NIS implementation will support it once it has
2143
	default, but its NIS implementation will support it once it has
2111
        been created.  To create an empty map, simply type</para>
2144
	been created.  To create an empty map, simply type</para>
2112
2145
2113
      <screen>ellington&prompt.root; <userinput>vi /var/yp/netgroup</userinput></screen>
2146
      <screen>ellington&prompt.root; <userinput>vi /var/yp/netgroup</userinput></screen>
2114
2147
2115
      <para>and start adding content.  For our example, we need at
2148
      <para>and start adding content.  For our example, we need at
2116
         least four netgroups: IT employees, IT apprentices, normal
2149
	least four netgroups: IT employees, IT apprentices, normal
2117
         employees and interns.</para>
2150
	employees and interns.</para>
2118
2151
2119
      <programlisting>IT_EMP  (,alpha,test-domain)    (,beta,test-domain)
2152
      <programlisting>IT_EMP  (,alpha,test-domain)    (,beta,test-domain)
2120
IT_APP  (,charlie,test-domain)  (,delta,test-domain)
2153
IT_APP  (,charlie,test-domain)  (,delta,test-domain)
Lines 2123-2207 Link Here
2123
INTERNS (,able,test-domain)     (,baker,test-domain)</programlisting>
2156
INTERNS (,able,test-domain)     (,baker,test-domain)</programlisting>
2124
2157
2125
      <para><literal>IT_EMP</literal>, <literal>IT_APP</literal> etc.
2158
      <para><literal>IT_EMP</literal>, <literal>IT_APP</literal> etc.
2126
        are the names of the netgroups.  Each bracketed group adds
2159
	are the names of the netgroups.  Each bracketed group adds
2127
        one or more user accounts to it.  The three fields inside a
2160
	one or more user accounts to it.  The three fields inside a
2128
        group are:</para>
2161
	group are:</para>
2129
2162
2130
      <orderedlist>
2163
      <orderedlist>
2131
        <listitem>
2164
	<listitem>
2132
          <para>The name of the host(s) where the following items are
2165
	  <para>The name of the host(s) where the following items are
2133
            valid.  If you do not specify a hostname, the entry is
2166
	    valid.  If you do not specify a hostname, the entry is
2134
            valid on all hosts.  If you do specify a hostname, you
2167
	    valid on all hosts.  If you do specify a hostname, you
2135
            will enter a realm of darkness, horror and utter confusion.</para>
2168
	    will enter a realm of darkness, horror and utter confusion.</para>
2136
        </listitem>
2169
	</listitem>
2137
2170
2138
        <listitem>
2171
	<listitem>
2139
          <para>The name of the account that belongs to this
2172
	  <para>The name of the account that belongs to this
2140
            netgroup.</para>
2173
	    netgroup.</para>
2141
        </listitem>
2174
	</listitem>
2142
2175
2143
        <listitem>
2176
	<listitem>
2144
          <para>The NIS domain for the account.  You can import
2177
	  <para>The NIS domain for the account.  You can import
2145
            accounts from other NIS domains into your netgroup if you
2178
	    accounts from other NIS domains into your netgroup if you
2146
            are one of the unlucky fellows with more than one NIS
2179
	    are one of the unlucky fellows with more than one NIS
2147
            domain.</para>
2180
	    domain.</para>
2148
        </listitem>
2181
	</listitem>
2149
      </orderedlist>
2182
      </orderedlist>
2150
2183
2151
      <para>Each of these fields can contain wildcards.  See
2184
      <para>Each of these fields can contain wildcards.  See
2152
        &man.netgroup.5; for details.</para>
2185
	&man.netgroup.5; for details.</para>
2153
2186
2154
      <note>
2187
      <note>
2155
        <indexterm><primary>netgroups</primary></indexterm>
2188
	<indexterm>
2156
        <para>Netgroup names longer than 8 characters should not be
2189
	  <primary>netgroups</primary>
2157
          used, especially if you have machines running other
2190
	</indexterm>
2158
          operating systems within your NIS domain.  The names are
2191
	<para>Netgroup names longer than 8 characters should not be
2159
          case sensitive; using capital letters for your netgroup
2192
	  used, especially if you have machines running other
2160
          names is an easy way to distinguish between user, machine
2193
	  operating systems within your NIS domain.  The names are
2161
          and netgroup names.</para>
2194
	  case sensitive; using capital letters for your netgroup
2195
	  names is an easy way to distinguish between user, machine
2196
	  and netgroup names.</para>
2162
2197
2163
        <para>Some NIS clients (other than FreeBSD) cannot handle
2198
	<para>Some NIS clients (other than FreeBSD) cannot handle
2164
          netgroups with a large number of entries.  For example, some
2199
	  netgroups with a large number of entries.  For example, some
2165
          older versions of &sunos; start to cause trouble if a netgroup
2200
	  older versions of &sunos; start to cause trouble if a netgroup
2166
          contains more than 15 <emphasis>entries</emphasis>.  You can
2201
	  contains more than 15 <emphasis>entries</emphasis>.  You can
2167
          circumvent this limit by creating several sub-netgroups with
2202
	  circumvent this limit by creating several sub-netgroups with
2168
          15 users or less and a real netgroup that consists of the
2203
	  15 users or less and a real netgroup that consists of the
2169
          sub-netgroups:</para>
2204
	  sub-netgroups:</para>
2170
2205
2171
        <programlisting>BIGGRP1  (,joe1,domain)  (,joe2,domain)  (,joe3,domain) [...]
2206
	<programlisting>BIGGRP1  (,joe1,domain)  (,joe2,domain)  (,joe3,domain) [...]
2172
BIGGRP2  (,joe16,domain)  (,joe17,domain) [...]
2207
BIGGRP2  (,joe16,domain)  (,joe17,domain) [...]
2173
BIGGRP3  (,joe31,domain)  (,joe32,domain)
2208
BIGGRP3  (,joe31,domain)  (,joe32,domain)
2174
BIGGROUP  BIGGRP1 BIGGRP2 BIGGRP3</programlisting>
2209
BIGGROUP  BIGGRP1 BIGGRP2 BIGGRP3</programlisting>
2175
2210
2176
        <para>You can repeat this process if you need more than 225
2211
	<para>You can repeat this process if you need more than 225
2177
          users within a single netgroup.</para>
2212
	  users within a single netgroup.</para>
2178
      </note>
2213
      </note>
2179
2214
2180
      <para>Activating and distributing your new NIS map is
2215
      <para>Activating and distributing your new NIS map is
2181
        easy:</para>
2216
	easy:</para>
2182
2217
2183
      <screen>ellington&prompt.root; <userinput>cd /var/yp</userinput>
2218
      <screen>ellington&prompt.root; <userinput>cd /var/yp</userinput>
2184
ellington&prompt.root; <userinput>make</userinput></screen>
2219
ellington&prompt.root; <userinput>make</userinput></screen>
2185
2220
2186
      <para>This will generate the three NIS maps
2221
      <para>This will generate the three NIS maps
2187
        <filename>netgroup</filename>,
2222
	<filename>netgroup</filename>,
2188
        <filename>netgroup.byhost</filename> and
2223
	<filename>netgroup.byhost</filename> and
2189
        <filename>netgroup.byuser</filename>.  Use &man.ypcat.1; to
2224
	<filename>netgroup.byuser</filename>.  Use &man.ypcat.1; to
2190
        check if your new NIS maps are available:</para>
2225
	check if your new NIS maps are available:</para>
2191
2226
2192
      <screen>ellington&prompt.user; <userinput>ypcat -k netgroup</userinput>
2227
      <screen>ellington&prompt.user; <userinput>ypcat -k netgroup</userinput>
2193
ellington&prompt.user; <userinput>ypcat -k netgroup.byhost</userinput>
2228
ellington&prompt.user; <userinput>ypcat -k netgroup.byhost</userinput>
2194
ellington&prompt.user; <userinput>ypcat -k netgroup.byuser</userinput></screen>
2229
ellington&prompt.user; <userinput>ypcat -k netgroup.byuser</userinput></screen>
2195
2230
2196
      <para>The output of the first command should resemble the
2231
      <para>The output of the first command should resemble the
2197
        contents of <filename>/var/yp/netgroup</filename>.  The second
2232
	contents of <filename>/var/yp/netgroup</filename>.  The second
2198
        command will not produce output if you have not specified
2233
	command will not produce output if you have not specified
2199
        host-specific netgroups.  The third command can be used to
2234
	host-specific netgroups.  The third command can be used to
2200
        get the list of netgroups for a user.</para>
2235
	get the list of netgroups for a user.</para>
2201
2236
2202
      <para>The client setup is quite simple.  To configure the server
2237
      <para>The client setup is quite simple.  To configure the server
2203
        <hostid>war</hostid>, you only have to start
2238
	<hostid>war</hostid>, you only have to start
2204
        &man.vipw.8; and replace the line</para>
2239
	&man.vipw.8; and replace the line</para>
2205
2240
2206
      <programlisting>+:::::::::</programlisting>
2241
      <programlisting>+:::::::::</programlisting>
2207
2242
Lines 2210-2218 Link Here
2210
      <programlisting>+@IT_EMP:::::::::</programlisting>
2245
      <programlisting>+@IT_EMP:::::::::</programlisting>
2211
2246
2212
      <para>Now, only the data for the users defined in the netgroup
2247
      <para>Now, only the data for the users defined in the netgroup
2213
        <literal>IT_EMP</literal> is imported into
2248
	<literal>IT_EMP</literal> is imported into
2214
        <hostid>war</hostid>'s password database and only
2249
	<hostid>war</hostid>'s password database and only
2215
        these users are allowed to login.</para>
2250
	these users are allowed to login.</para>
2216
2251
2217
      <para>Unfortunately, this limitation also applies to the
2252
      <para>Unfortunately, this limitation also applies to the
2218
	<literal>~</literal> function of the shell and all routines
2253
	<literal>~</literal> function of the shell and all routines
Lines 2227-2323 Link Here
2227
	servers</emphasis>.</para>
2262
	servers</emphasis>.</para>
2228
2263
2229
      <para>This can be achieved by adding another line to
2264
      <para>This can be achieved by adding another line to
2230
        <filename>/etc/master.passwd</filename>.  This line should
2265
	<filename>/etc/master.passwd</filename>.  This line should
2231
        contain:</para>
2266
	contain:</para>
2232
2267
2233
      <para><literal>+:::::::::/sbin/nologin</literal>, meaning
2268
      <para><literal>+:::::::::/sbin/nologin</literal>, meaning
2234
        <quote>Import all entries but replace the shell with
2269
	<quote>Import all entries but replace the shell with
2235
        <filename>/sbin/nologin</filename> in the imported
2270
	<filename>/sbin/nologin</filename> in the imported
2236
        entries</quote>.  You can replace any field in the
2271
	entries</quote>.  You can replace any field in the
2237
        <literal>passwd</literal> entry by placing a default value in
2272
	<literal>passwd</literal> entry by placing a default value in
2238
        your <filename>/etc/master.passwd</filename>.</para>
2273
	your <filename>/etc/master.passwd</filename>.</para>
2239
2274
2240
      <!-- Been there, done that, got the scars to prove it - ue -->
2275
      <!-- Been there, done that, got the scars to prove it - ue -->
2241
      <warning>
2276
      <warning>
2242
        <para>Make sure that the line
2277
	<para>Make sure that the line
2243
        <literal>+:::::::::/sbin/nologin</literal> is placed after
2278
	<literal>+:::::::::/sbin/nologin</literal> is placed after
2244
        <literal>+@IT_EMP:::::::::</literal>.  Otherwise, all user
2279
	<literal>+@IT_EMP:::::::::</literal>.  Otherwise, all user
2245
        accounts imported from NIS will have <filename>/sbin/nologin</filename> as their
2280
	accounts imported from NIS will have <filename>/sbin/nologin</filename> as their
2246
        login shell.</para>
2281
	login shell.</para>
2247
      </warning>
2282
      </warning>
2248
2283
2249
      <para>After this change, you will only have to change one NIS
2284
      <para>After this change, you will only have to change one NIS
2250
        map if a new employee joins the IT department.  You could use
2285
	map if a new employee joins the IT department.  You could use
2251
        a similar approach for the less important servers by replacing
2286
	a similar approach for the less important servers by replacing
2252
        the old <literal>+:::::::::</literal> in their local version
2287
	the old <literal>+:::::::::</literal> in their local version
2253
        of <filename>/etc/master.passwd</filename> with something like
2288
	of <filename>/etc/master.passwd</filename> with something like
2254
        this:</para>
2289
	this:</para>
2255
2290
2256
      <programlisting>+@IT_EMP:::::::::
2291
      <programlisting>+@IT_EMP:::::::::
2257
+@IT_APP:::::::::
2292
+@IT_APP:::::::::
2258
+:::::::::/sbin/nologin</programlisting>
2293
+:::::::::/sbin/nologin</programlisting>
2259
2294
2260
      <para>The corresponding lines for the normal workstations
2295
      <para>The corresponding lines for the normal workstations
2261
        could be:</para>
2296
	could be:</para>
2262
2297
2263
      <programlisting>+@IT_EMP:::::::::
2298
      <programlisting>+@IT_EMP:::::::::
2264
+@USERS:::::::::
2299
+@USERS:::::::::
2265
+:::::::::/sbin/nologin</programlisting>
2300
+:::::::::/sbin/nologin</programlisting>
2266
2301
2267
      <para>And everything would be fine until there is a policy
2302
      <para>And everything would be fine until there is a policy
2268
        change a few weeks later: The IT department starts hiring
2303
	change a few weeks later: The IT department starts hiring
2269
        interns.  The IT interns are allowed to use the normal
2304
	interns.  The IT interns are allowed to use the normal
2270
        workstations and the less important servers; and the IT
2305
	workstations and the less important servers; and the IT
2271
        apprentices are allowed to login onto the main servers.  You
2306
	apprentices are allowed to login onto the main servers.  You
2272
        add a new netgroup <literal>IT_INTERN</literal>, add the new
2307
	add a new netgroup <literal>IT_INTERN</literal>, add the new
2273
        IT interns to this netgroup and start to change the
2308
	IT interns to this netgroup and start to change the
2274
        configuration on each and every machine...  As the old saying
2309
	configuration on each and every machine...  As the old saying
2275
        goes: <quote>Errors in centralized planning lead to global
2310
	goes: <quote>Errors in centralized planning lead to global
2276
        mess</quote>.</para>
2311
	mess</quote>.</para>
2277
2312
2278
      <para>NIS' ability to create netgroups from other netgroups can
2313
      <para>NIS' ability to create netgroups from other netgroups can
2279
        be used to prevent situations like these.  One possibility
2314
	be used to prevent situations like these.  One possibility
2280
        is the creation of role-based netgroups.  For example, you
2315
	is the creation of role-based netgroups.  For example, you
2281
        could create a netgroup called
2316
	could create a netgroup called
2282
        <literal>BIGSRV</literal> to define the login
2317
	<literal>BIGSRV</literal> to define the login
2283
        restrictions for the important servers, another netgroup
2318
	restrictions for the important servers, another netgroup
2284
        called <literal>SMALLSRV</literal> for the less
2319
	called <literal>SMALLSRV</literal> for the less
2285
        important servers and a third netgroup called
2320
	important servers and a third netgroup called
2286
        <literal>USERBOX</literal> for the normal
2321
	<literal>USERBOX</literal> for the normal
2287
        workstations.  Each of these netgroups contains the netgroups
2322
	workstations.  Each of these netgroups contains the netgroups
2288
        that are allowed to login onto these machines.  The new
2323
	that are allowed to login onto these machines.  The new
2289
        entries for your NIS map netgroup should look like this:</para>
2324
	entries for your NIS map netgroup should look like this:</para>
2290
2325
2291
      <programlisting>BIGSRV    IT_EMP  IT_APP
2326
      <programlisting>BIGSRV    IT_EMP  IT_APP
2292
SMALLSRV  IT_EMP  IT_APP  ITINTERN
2327
SMALLSRV  IT_EMP  IT_APP  ITINTERN
2293
USERBOX   IT_EMP  ITINTERN USERS</programlisting>
2328
USERBOX   IT_EMP  ITINTERN USERS</programlisting>
2294
2329
2295
      <para>This method of defining login restrictions works
2330
      <para>This method of defining login restrictions works
2296
        reasonably well if you can define groups of machines with
2331
	reasonably well if you can define groups of machines with
2297
        identical restrictions.  Unfortunately, this is the exception
2332
	identical restrictions.  Unfortunately, this is the exception
2298
        and not the rule.  Most of the time, you will need the ability
2333
	and not the rule.  Most of the time, you will need the ability
2299
        to define login restrictions on a per-machine basis.</para>
2334
	to define login restrictions on a per-machine basis.</para>
2300
2335
2301
      <para>Machine-specific netgroup definitions are the other
2336
      <para>Machine-specific netgroup definitions are the other
2302
        possibility to deal with the policy change outlined above.  In
2337
	possibility to deal with the policy change outlined above.  In
2303
        this scenario, the <filename>/etc/master.passwd</filename> of
2338
	this scenario, the <filename>/etc/master.passwd</filename> of
2304
        each box contains two lines starting with <quote>+</quote>.
2339
	each box contains two lines starting with <quote>+</quote>.
2305
        The first of them adds a netgroup with the accounts allowed to
2340
	The first of them adds a netgroup with the accounts allowed to
2306
        login onto this machine, the second one adds all other
2341
	login onto this machine, the second one adds all other
2307
        accounts with <filename>/sbin/nologin</filename> as shell.  It
2342
	accounts with <filename>/sbin/nologin</filename> as shell.  It
2308
        is a good idea to use the <quote>ALL-CAPS</quote> version of
2343
	is a good idea to use the <quote>ALL-CAPS</quote> version of
2309
        the machine name as the name of the netgroup.  In other words,
2344
	the machine name as the name of the netgroup.  In other words,
2310
        the lines should look like this:</para>
2345
	the lines should look like this:</para>
2311
2346
2312
      <programlisting>+@<replaceable>BOXNAME</replaceable>:::::::::
2347
      <programlisting>+@<replaceable>BOXNAME</replaceable>:::::::::
2313
+:::::::::/sbin/nologin</programlisting>
2348
+:::::::::/sbin/nologin</programlisting>
2314
2349
2315
      <para>Once you have completed this task for all your machines,
2350
      <para>Once you have completed this task for all your machines,
2316
        you will not have to modify the local versions of
2351
	you will not have to modify the local versions of
2317
        <filename>/etc/master.passwd</filename> ever again.  All
2352
	<filename>/etc/master.passwd</filename> ever again.  All
2318
        further changes can be handled by modifying the NIS map.  Here
2353
	further changes can be handled by modifying the NIS map.  Here
2319
        is an example of a possible netgroup map for this
2354
	is an example of a possible netgroup map for this
2320
        scenario with some additional goodies:</para>
2355
	scenario with some additional goodies:</para>
2321
2356
2322
      <programlisting># Define groups of users first
2357
      <programlisting># Define groups of users first
2323
IT_EMP    (,alpha,test-domain)    (,beta,test-domain)
2358
IT_EMP    (,alpha,test-domain)    (,beta,test-domain)
Lines 2356-2415 Link Here
2356
# [...more groups to follow]</programlisting>
2391
# [...more groups to follow]</programlisting>
2357
2392
2358
      <para>If you are using some kind of database to manage your user
2393
      <para>If you are using some kind of database to manage your user
2359
        accounts, you should be able to create the first part of the
2394
	accounts, you should be able to create the first part of the
2360
        map with your database's report tools.  This way, new users
2395
	map with your database's report tools.  This way, new users
2361
        will automatically have access to the boxes.</para>
2396
	will automatically have access to the boxes.</para>
2362
2397
2363
      <para>One last word of caution: It may not always be advisable
2398
      <para>One last word of caution: It may not always be advisable
2364
        to use machine-based netgroups.  If you are deploying a couple of
2399
	to use machine-based netgroups.  If you are deploying a couple of
2365
        dozen or even hundreds of identical machines for student labs,
2400
	dozen or even hundreds of identical machines for student labs,
2366
        you should use role-based netgroups instead of machine-based
2401
	you should use role-based netgroups instead of machine-based
2367
        netgroups to keep the size of the NIS map within reasonable
2402
	netgroups to keep the size of the NIS map within reasonable
2368
        limits.</para>
2403
	limits.</para>
2369
    </sect2>
2404
    </sect2>
2370
2405
2371
    <sect2>
2406
    <sect2>
2372
      <title>Important Things to Remember</title>
2407
      <title>Important Things to Remember</title>
2373
2408
2374
      <para>There are still a couple of things that you will need to do
2409
      <para>There are still a couple of things that you will need to do
2375
        differently now that you are in an NIS environment.</para>
2410
	differently now that you are in an NIS environment.</para>
2376
2411
2377
      <itemizedlist>
2412
      <itemizedlist>
2378
        <listitem>
2413
	<listitem>
2379
          <para>Every time you wish to add a user to the lab, you
2414
	  <para>Every time you wish to add a user to the lab, you
2380
            must add it to the master NIS server <emphasis>only</emphasis>,
2415
	    must add it to the master NIS server <emphasis>only</emphasis>,
2381
            and <emphasis>you must remember to rebuild the NIS
2416
	    and <emphasis>you must remember to rebuild the NIS
2382
            maps</emphasis>.  If you forget to do this, the new user will
2417
	    maps</emphasis>.  If you forget to do this, the new user will
2383
            not be able to login anywhere except on the NIS master.
2418
	    not be able to login anywhere except on the NIS master.
2384
            For example, if we needed to add a new user
2419
	    For example, if we needed to add a new user
2385
            <username>jsmith</username> to the lab, we would:</para>
2420
	    <username>jsmith</username> to the lab, we would:</para>
2386
2421
2387
          <screen>&prompt.root; <userinput>pw useradd jsmith</userinput>
2422
	   <screen>&prompt.root; <userinput>pw useradd jsmith</userinput>
2388
&prompt.root; <userinput>cd /var/yp</userinput>
2423
&prompt.root; <userinput>cd /var/yp</userinput>
2389
&prompt.root; <userinput>make test-domain</userinput></screen>
2424
&prompt.root; <userinput>make test-domain</userinput></screen>
2390
2425
2391
          <para>You could also run <command>adduser jsmith</command> instead
2426
	  <para>You could also run <command>adduser jsmith</command> instead
2392
            of <command>pw useradd jsmith</command>.</para>
2427
	    of <command>pw useradd jsmith</command>.</para>
2393
        </listitem>
2428
	</listitem>
2394
        <listitem>
2429
	<listitem>
2395
          <para><emphasis>Keep the administration accounts out of the
2430
	  <para><emphasis>Keep the administration accounts out of the
2396
            NIS maps</emphasis>.  You do not want to be propagating
2431
	    NIS maps</emphasis>.  You do not want to be propagating
2397
            administrative accounts and passwords to machines that
2432
	    administrative accounts and passwords to machines that
2398
            will have users that should not have access to those
2433
	    will have users that should not have access to those
2399
            accounts.</para>
2434
	    accounts.</para>
2400
        </listitem>
2435
	</listitem>
2401
        <listitem>
2436
	<listitem>
2402
          <para><emphasis>Keep the NIS master and slave secure, and
2437
	  <para><emphasis>Keep the NIS master and slave secure, and
2403
            minimize their downtime</emphasis>.  If somebody either
2438
	    minimize their downtime</emphasis>.  If somebody either
2404
            hacks or simply turns off these machines, they have
2439
	    hacks or simply turns off these machines, they have
2405
            effectively rendered many people without the ability to
2440
	    effectively rendered many people without the ability to
2406
            login to the lab.</para>
2441
	    login to the lab.</para>
2407
2442
2408
          <para>This is the chief weakness of any centralized administration
2443
	  <para>This is the chief weakness of any centralized administration
2409
            system.  If you do
2444
	    system.  If you do
2410
            not protect your NIS servers, you will have a lot of angry
2445
	    not protect your NIS servers, you will have a lot of angry
2411
            users!</para>
2446
	    users!</para>
2412
        </listitem>
2447
	</listitem>
2413
      </itemizedlist>
2448
      </itemizedlist>
2414
    </sect2>
2449
    </sect2>
2415
2450
Lines 2453-2460 Link Here
2453
      <para>You can force a host to bind to a particular server by running
2488
      <para>You can force a host to bind to a particular server by running
2454
	<command>ypbind</command> with the <option>-S</option>
2489
	<command>ypbind</command> with the <option>-S</option>
2455
	flag.  If you do not want to do this manually each time you
2490
	flag.  If you do not want to do this manually each time you
2456
        reboot your NIS server, you can add the following lines to
2491
	reboot your NIS server, you can add the following lines to
2457
        your <filename>/etc/rc.conf</filename>:</para>
2492
	your <filename>/etc/rc.conf</filename>:</para>
2458
2493
2459
      <programlisting>nis_client_enable="YES"	# run client stuff as well
2494
      <programlisting>nis_client_enable="YES"	# run client stuff as well
2460
nis_client_flags="-S <replaceable>NIS domain</replaceable>,<replaceable>server</replaceable>"</programlisting>
2495
nis_client_flags="-S <replaceable>NIS domain</replaceable>,<replaceable>server</replaceable>"</programlisting>
Lines 2465-2471 Link Here
2465
    <sect2>
2500
    <sect2>
2466
      <title>Password Formats</title>
2501
      <title>Password Formats</title>
2467
      <indexterm>
2502
      <indexterm>
2468
        <primary>NIS</primary>
2503
	<primary>NIS</primary>
2469
	<secondary>password formats</secondary>
2504
	<secondary>password formats</secondary>
2470
      </indexterm>
2505
      </indexterm>
2471
      <para>One of the most common issues that people run into when trying
2506
      <para>One of the most common issues that people run into when trying
Lines 2497-2507 Link Here
2497
2532
2498
      <screen>&prompt.root; <userinput>cap_mkdb /etc/login.conf</userinput></screen>
2533
      <screen>&prompt.root; <userinput>cap_mkdb /etc/login.conf</userinput></screen>
2499
2534
2500
      <note><para>The format of passwords already in
2535
      <note>
2501
	<filename>/etc/master.passwd</filename> will not be updated
2536
	<para>The format of passwords already in
2502
	until a user changes his password for the first time
2537
	  <filename>/etc/master.passwd</filename> will not be updated
2503
	<emphasis>after</emphasis> the login capability database is
2538
	  until a user changes his password for the first time
2504
	rebuilt.</para></note>
2539
	  <emphasis>after</emphasis> the login capability database is
2540
	  rebuilt.</para>
2541
      </note>
2505
2542
2506
      <para>Next, in order to ensure that passwords are encrypted with
2543
      <para>Next, in order to ensure that passwords are encrypted with
2507
	the format that you have chosen, you should also check that
2544
	the format that you have chosen, you should also check that
Lines 2527-2537 Link Here
2527
  <sect1 id="network-dhcp">
2564
  <sect1 id="network-dhcp">
2528
    <sect1info>
2565
    <sect1info>
2529
      <authorgroup>
2566
      <authorgroup>
2530
        <author>
2567
	<author>
2531
          <firstname>Greg</firstname>
2568
	  <firstname>Greg</firstname>
2532
      	  <surname>Sutter</surname>
2569
	  <surname>Sutter</surname>
2533
	  <contrib>Written by </contrib>
2570
	  <contrib>Written by </contrib>
2534
        </author>
2571
	</author>
2535
      </authorgroup>
2572
      </authorgroup>
2536
    </sect1info>
2573
    </sect1info>
2537
    <title>Automatic Network Configuration (DHCP)</title>
2574
    <title>Automatic Network Configuration (DHCP)</title>
Lines 2539-2554 Link Here
2539
    <sect2>
2576
    <sect2>
2540
      <title>What Is DHCP?</title>
2577
      <title>What Is DHCP?</title>
2541
      <indexterm>
2578
      <indexterm>
2542
        <primary>Dynamic Host Configuration Protocol</primary>
2579
	<primary>Dynamic Host Configuration Protocol</primary>
2543
        <see>DHCP</see>
2580
	<see>DHCP</see>
2544
      </indexterm>
2581
      </indexterm>
2545
      <indexterm>
2582
      <indexterm>
2546
        <primary>Internet Systems Consortium (ISC)</primary>
2583
	<primary>Internet Systems Consortium (ISC)</primary>
2547
      </indexterm>
2584
      </indexterm>
2548
2585
2549
      <para>DHCP, the Dynamic Host Configuration Protocol, describes
2586
      <para>DHCP, the Dynamic Host Configuration Protocol, describes
2550
        the means by which a system can connect to a network and obtain the
2587
	the means by which a system can connect to a network and obtain the
2551
        necessary information for communication upon that network.  FreeBSD
2588
	necessary information for communication upon that network.  FreeBSD
2552
	uses the OpenBSD <command>dhclient</command>
2589
	uses the OpenBSD <command>dhclient</command>
2553
	taken from OpenBSD&nbsp;3.7.  All
2590
	taken from OpenBSD&nbsp;3.7.  All
2554
	information here regarding <command>dhclient</command> is for
2591
	information here regarding <command>dhclient</command> is for
Lines 2559-2578 Link Here
2559
    <sect2>
2596
    <sect2>
2560
      <title>What This Section Covers</title>
2597
      <title>What This Section Covers</title>
2561
2598
2562
      <para>This section describes both the client-side components of the ISC and OpenBSD DHCP client and
2599
      <para>This section describes both the client-side components 
2563
        server-side components of the ISC DHCP system.  The
2600
	of the ISC and OpenBSD DHCP client and
2564
        client-side program, <command>dhclient</command>, comes
2601
	server-side components of the ISC DHCP system.  The
2565
        integrated within FreeBSD, and the server-side portion is
2602
	client-side program, <command>dhclient</command>, comes
2566
        available from the <filename
2603
	integrated within FreeBSD, and the server-side portion is
2567
        role="package">net/isc-dhcp31-server</filename> port.  The
2604
	available from the <filename
2568
        &man.dhclient.8;, &man.dhcp-options.5;, and
2605
	role="package">net/isc-dhcp31-server</filename> port.  The
2569
        &man.dhclient.conf.5; manual pages, in addition to the
2606
	&man.dhclient.8;, &man.dhcp-options.5;, and
2570
        references below, are useful resources.</para>
2607
	&man.dhclient.conf.5; manual pages, in addition to the
2608
	references below, are useful resources.</para>
2571
    </sect2>
2609
    </sect2>
2572
2610
2573
    <sect2>
2611
    <sect2>
2574
      <title>How It Works</title>
2612
      <title>How It Works</title>
2575
      <indexterm><primary>UDP</primary></indexterm>
2613
      <indexterm>
2614
	<primary>UDP</primary>
2615
      </indexterm>
2576
      <para>When <command>dhclient</command>, the DHCP client, is
2616
      <para>When <command>dhclient</command>, the DHCP client, is
2577
	executed on the client machine, it begins broadcasting
2617
	executed on the client machine, it begins broadcasting
2578
	requests for configuration information.  By default, these
2618
	requests for configuration information.  By default, these
Lines 2586-2717 Link Here
2586
	network can be automatically reclaimed.</para>
2626
	network can be automatically reclaimed.</para>
2587
2627
2588
      <para>DHCP clients can obtain a great deal of information from
2628
      <para>DHCP clients can obtain a great deal of information from
2589
        the server.  An exhaustive list may be found in
2629
	the server.  An exhaustive list may be found in
2590
        &man.dhcp-options.5;.</para>
2630
	&man.dhcp-options.5;.</para>
2591
    </sect2>
2631
    </sect2>
2592
2632
2593
    <sect2>
2633
    <sect2>
2594
      <title>FreeBSD Integration</title>
2634
      <title>FreeBSD Integration</title>
2595
2635
2596
      <para>&os; fully integrates the OpenBSD DHCP client,
2636
      <para>&os; fully integrates the OpenBSD DHCP client,
2597
        <command>dhclient</command>.  DHCP client support is provided
2637
	<command>dhclient</command>.  DHCP client support is provided
2598
        within both the installer and the base system, obviating the need
2638
	within both the installer and the base system, obviating the need
2599
        for detailed knowledge of network configurations on any network
2639
	for detailed knowledge of network configurations on any network
2600
        that runs a DHCP server.</para>
2640
	that runs a DHCP server.</para>
2601
        <indexterm>
2641
	<indexterm>
2602
          <primary><application>sysinstall</application></primary>
2642
	  <primary><application>sysinstall</application></primary>
2603
        </indexterm>
2643
	</indexterm>
2604
2644
2605
        <para>DHCP is supported by
2645
      <para>DHCP is supported by
2606
          <application>sysinstall</application>.  When configuring a
2646
	<application>sysinstall</application>.  When configuring a
2607
          network interface within
2647
	network interface within
2608
          <application>sysinstall</application>, the second question
2648
	<application>sysinstall</application>, the second question
2609
          asked is: <quote>Do you want to try DHCP configuration of
2649
	asked is: <quote>Do you want to try DHCP configuration of
2610
          the interface?</quote>. Answering affirmatively will
2650
	the interface?</quote>. Answering affirmatively will
2611
          execute <command>dhclient</command>, and if successful, will
2651
	execute <command>dhclient</command>, and if successful, will
2612
          fill in the network configuration information
2652
	fill in the network configuration information
2613
          automatically.</para>
2653
	automatically.</para>
2614
2654
2615
        <para>There are two things you must do to have your system use
2655
      <para>There are two things you must do to have your system use
2616
	  DHCP upon startup:</para>
2656
	DHCP upon startup:</para>
2617
        <indexterm>
2657
      <indexterm>
2618
          <primary>DHCP</primary>
2658
	<primary>DHCP</primary>
2619
          <secondary>requirements</secondary>
2659
	<secondary>requirements</secondary>
2620
        </indexterm>
2660
      </indexterm>
2621
	<itemizedlist>
2661
      <itemizedlist>
2622
	  <listitem>
2662
	<listitem>
2623
            <para>Make sure that the <devicename>bpf</devicename>
2663
	  <para>Make sure that the <devicename>bpf</devicename>
2624
	      device is compiled into your kernel.  To do this, add
2664
	    device is compiled into your kernel.  To do this, add
2625
	      <literal>device bpf</literal> to your kernel
2665
	    <literal>device bpf</literal> to your kernel
2626
	      configuration file, and rebuild the kernel.  For more
2666
	    configuration file, and rebuild the kernel.  For more
2627
	      information about building kernels, see <xref
2667
	    information about building kernels, see <xref
2628
	      linkend="kernelconfig">.</para> <para>The
2668
	    linkend="kernelconfig">.</para> <para>The
2629
	      <devicename>bpf</devicename> device is already part of
2669
	    <devicename>bpf</devicename> device is already part of
2630
	      the <filename>GENERIC</filename> kernel that is supplied
2670
	    the <filename>GENERIC</filename> kernel that is supplied
2631
	      with FreeBSD, so if you do not have a custom kernel, you
2671
	    with FreeBSD, so if you do not have a custom kernel, you
2632
	      should not need to create one in order to get DHCP
2672
	    should not need to create one in order to get DHCP
2633
	      working.</para>
2673
	    working.</para>
2634
	    <note>
2674
	  <note>
2635
	      <para>For those who are particularly security conscious,
2675
	    <para>For those who are particularly security conscious,
2636
	        you should be warned that <devicename>bpf</devicename>
2676
	      you should be warned that <devicename>bpf</devicename>
2637
		is also the device that allows packet sniffers to work
2677
	      is also the device that allows packet sniffers to work
2638
		correctly (although they still have to be run as
2678
	      correctly (although they still have to be run as
2639
		<username>root</username>).  <devicename>bpf</devicename>
2679
	      <username>root</username>).  <devicename>bpf</devicename>
2640
		<emphasis>is</emphasis> required to use DHCP, but if
2680
	      <emphasis>is</emphasis> required to use DHCP, but if
2641
		you are very sensitive about security, you probably
2681
	      you are very sensitive about security, you probably
2642
		should not add <devicename>bpf</devicename> to your
2682
	      should not add <devicename>bpf</devicename> to your
2643
		kernel in the expectation that at some point in the
2683
	      kernel in the expectation that at some point in the
2644
		future you will be using DHCP.</para>
2684
	      future you will be using DHCP.</para>
2645
	    </note>
2685
	  </note>
2646
	  </listitem>
2686
	</listitem>
2647
          <listitem>
2687
	<listitem>
2648
            <para>Edit your <filename>/etc/rc.conf</filename> to
2688
	  <para>Edit your <filename>/etc/rc.conf</filename> to
2649
	      include the following:</para>
2689
	    include the following:</para>
2650
2690
2651
            <programlisting>ifconfig_fxp0="DHCP"</programlisting>
2691
	  <programlisting>ifconfig_fxp0="DHCP"</programlisting>
2652
2692
2653
            <note>
2693
	  <note>
2654
              <para>Be sure to replace <literal>fxp0</literal> with the
2694
	    <para>Be sure to replace <literal>fxp0</literal> with the
2655
                designation for the interface that you wish to dynamically
2695
	      designation for the interface that you wish to dynamically
2656
                 configure, as described in
2696
	      configure, as described in
2657
		 <xref linkend="config-network-setup">.</para>
2697
	      <xref linkend="config-network-setup">.</para>
2658
            </note>
2698
	  </note>
2659
2699
2660
            <para>If you are using a different location for
2700
	  <para>If you are using a different location for
2661
              <command>dhclient</command>, or if you wish to pass additional
2701
	    <command>dhclient</command>, or if you wish to pass additional
2662
              flags to <command>dhclient</command>, also include the
2702
	    flags to <command>dhclient</command>, also include the
2663
              following (editing as necessary):</para>
2703
	    following (editing as necessary):</para>
2664
2704
2665
            <programlisting>dhclient_program="/sbin/dhclient"
2705
	  <programlisting>dhclient_program="/sbin/dhclient"
2666
dhclient_flags=""</programlisting>
2706
dhclient_flags=""</programlisting>
2667
          </listitem>
2707
	</listitem>
2668
        </itemizedlist>
2708
      </itemizedlist>
2669
2709
2670
        <indexterm>
2710
      <indexterm>
2671
          <primary>DHCP</primary>
2711
	<primary>DHCP</primary>
2672
          <secondary>server</secondary>
2712
	<secondary>server</secondary>
2673
        </indexterm>
2713
      </indexterm>
2674
        <para>The DHCP server, <application>dhcpd</application>, is included
2714
      <para>The DHCP server, <application>dhcpd</application>, is included
2675
          as part of the <filename
2715
	as part of the <filename
2676
          role="package">net/isc-dhcp31-server</filename> port in the ports
2716
	role="package">net/isc-dhcp31-server</filename> port in the ports
2677
          collection.  This port contains the ISC DHCP server and
2717
	collection.  This port contains the ISC DHCP server and
2678
          documentation.</para>
2718
	documentation.</para>
2679
    </sect2>
2719
    </sect2>
2680
2720
2681
    <sect2>
2721
    <sect2>
2682
      <title>Files</title>
2722
      <title>Files</title>
2683
      <indexterm>
2723
      <indexterm>
2684
        <primary>DHCP</primary>
2724
	<primary>DHCP</primary>
2685
        <secondary>configuration files</secondary>
2725
	<secondary>configuration files</secondary>
2686
      </indexterm>
2726
      </indexterm>
2687
      <itemizedlist>
2727
      <itemizedlist>
2688
        <listitem><para><filename>/etc/dhclient.conf</filename></para>
2728
	<listitem>
2689
          <para><command>dhclient</command> requires a configuration file,
2729
	  <para><filename>/etc/dhclient.conf</filename></para>
2690
            <filename>/etc/dhclient.conf</filename>.  Typically the file
2730
	  <para><command>dhclient</command> requires a configuration file,
2691
            contains only comments, the defaults being reasonably sane.  This
2731
	    <filename>/etc/dhclient.conf</filename>.  Typically the file
2692
            configuration file is described by the &man.dhclient.conf.5;
2732
	    contains only comments, the defaults being reasonably sane.  This
2693
            manual page.</para>
2733
	    configuration file is described by the &man.dhclient.conf.5;
2694
        </listitem>
2734
	    manual page.</para>
2735
	</listitem>
2695
2736
2696
        <listitem><para><filename>/sbin/dhclient</filename></para>
2737
	<listitem>
2697
          <para><command>dhclient</command> is statically linked and
2738
	  <para><filename>/sbin/dhclient</filename></para>
2698
            resides in <filename>/sbin</filename>.  The &man.dhclient.8;
2739
	<para><command>dhclient</command> is statically linked and
2699
            manual page gives more information about
2740
	    resides in <filename>/sbin</filename>.  The &man.dhclient.8;
2700
            <command>dhclient</command>.</para>
2741
	    manual page gives more information about
2701
        </listitem>
2742
	    <command>dhclient</command>.</para>
2743
	</listitem>
2702
2744
2703
        <listitem><para><filename>/sbin/dhclient-script</filename></para>
2745
	<listitem>
2704
          <para><command>dhclient-script</command> is the FreeBSD-specific
2746
	  <para><filename>/sbin/dhclient-script</filename></para>
2705
            DHCP client configuration script.  It is described in
2747
	  <para><command>dhclient-script</command> is the FreeBSD-specific
2706
            &man.dhclient-script.8;, but should not need any user
2748
	    DHCP client configuration script.  It is described in
2707
            modification to function properly.</para>
2749
	    &man.dhclient-script.8;, but should not need any user
2708
        </listitem>
2750
	    modification to function properly.</para>
2751
	</listitem>
2709
2752
2710
        <listitem><para><filename>/var/db/dhclient.leases</filename></para>
2753
        <listitem>
2711
          <para>The DHCP client keeps a database of valid leases in this
2754
	  <para><filename>/var/db/dhclient.leases</filename></para>
2712
            file, which is written as a log.  &man.dhclient.leases.5;
2755
	   <para>The DHCP client keeps a database of valid leases in this
2713
            gives a slightly longer description.</para>
2756
	    file, which is written as a log.  &man.dhclient.leases.5;
2714
        </listitem>
2757
	    gives a slightly longer description.</para>
2758
	</listitem>
2715
      </itemizedlist>
2759
      </itemizedlist>
2716
    </sect2>
2760
    </sect2>
2717
2761
Lines 2719-2727 Link Here
2719
      <title>Further Reading</title>
2763
      <title>Further Reading</title>
2720
2764
2721
      <para>The DHCP protocol is fully described in
2765
      <para>The DHCP protocol is fully described in
2722
        <ulink url="http://www.freesoft.org/CIE/RFC/2131/">RFC 2131</ulink>.
2766
	<ulink url="http://www.freesoft.org/CIE/RFC/2131/">RFC 2131</ulink>.
2723
        An informational resource has also been set up at
2767
	An informational resource has also been set up at
2724
        <ulink url="http://www.dhcp.org/"></ulink>.</para>
2768
	<ulink url="http://www.dhcp.org/"></ulink>.</para>
2725
    </sect2>
2769
    </sect2>
2726
2770
2727
    <sect2 id="network-dhcp-server">
2771
    <sect2 id="network-dhcp-server">
Lines 2761-2778 Link Here
2761
	    supplied with FreeBSD, so you do not need to create a custom
2805
	    supplied with FreeBSD, so you do not need to create a custom
2762
	    kernel in order to get DHCP working.</para>
2806
	    kernel in order to get DHCP working.</para>
2763
2807
2764
	    <note>
2808
	  <note>
2765
	      <para>Those who are particularly security conscious
2809
	    <para>Those who are particularly security conscious
2766
	        should note that <devicename>bpf</devicename>
2810
	      should note that <devicename>bpf</devicename>
2767
		is also the device that allows packet sniffers to work
2811
	      is also the device that allows packet sniffers to work
2768
		correctly (although such programs still need privileged
2812
	      correctly (although such programs still need privileged
2769
		access).  <devicename>bpf</devicename>
2813
	      access).  <devicename>bpf</devicename>
2770
		<emphasis>is</emphasis> required to use DHCP, but if
2814
	      <emphasis>is</emphasis> required to use DHCP, but if
2771
		you are very sensitive about security, you probably
2815
	      you are very sensitive about security, you probably
2772
		should not include <devicename>bpf</devicename> in your
2816
	      should not include <devicename>bpf</devicename> in your
2773
		kernel purely because you expect to use DHCP at some
2817
	      kernel purely because you expect to use DHCP at some
2774
		point in the future.</para>
2818
	      point in the future.</para>
2775
	    </note>
2819
	  </note>
2776
2820
2777
	  <para>The next thing that you will need to do is edit the sample
2821
	  <para>The next thing that you will need to do is edit the sample
2778
	    <filename>dhcpd.conf</filename> which was installed by the
2822
	    <filename>dhcpd.conf</filename> which was installed by the
Lines 2909-2915 Link Here
2909
	    <secondary>configuration files</secondary>
2953
	    <secondary>configuration files</secondary>
2910
	  </indexterm>
2954
	  </indexterm>
2911
	  <itemizedlist>
2955
	  <itemizedlist>
2912
	    <listitem><para><filename>/usr/local/sbin/dhcpd</filename></para>
2956
	    <listitem>
2957
	      <para><filename>/usr/local/sbin/dhcpd</filename></para>
2913
	      <para><application>dhcpd</application> is statically linked and
2958
	      <para><application>dhcpd</application> is statically linked and
2914
		resides in <filename>/usr/local/sbin</filename>.  The
2959
		resides in <filename>/usr/local/sbin</filename>.  The
2915
		&man.dhcpd.8; manual page installed with the
2960
		&man.dhcpd.8; manual page installed with the
Lines 2917-2923 Link Here
2917
		<application>dhcpd</application>.</para>
2962
		<application>dhcpd</application>.</para>
2918
	    </listitem>
2963
	    </listitem>
2919
2964
2920
	    <listitem><para><filename>/usr/local/etc/dhcpd.conf</filename></para>
2965
	    <listitem>
2966
	      <para><filename>/usr/local/etc/dhcpd.conf</filename></para>
2921
	      <para><application>dhcpd</application> requires a configuration
2967
	      <para><application>dhcpd</application> requires a configuration
2922
		file, <filename>/usr/local/etc/dhcpd.conf</filename> before it
2968
		file, <filename>/usr/local/etc/dhcpd.conf</filename> before it
2923
		will start providing service to clients.  This file needs to
2969
		will start providing service to clients.  This file needs to
Lines 2928-2941 Link Here
2928
		by the port.</para>
2974
		by the port.</para>
2929
	    </listitem>
2975
	    </listitem>
2930
2976
2931
	    <listitem><para><filename>/var/db/dhcpd.leases</filename></para>
2977
	    <listitem>
2978
	      <para><filename>/var/db/dhcpd.leases</filename></para>
2932
	      <para>The DHCP server keeps a database of leases it has issued
2979
	      <para>The DHCP server keeps a database of leases it has issued
2933
		in this file, which is written as a log.  The manual page
2980
		in this file, which is written as a log.  The manual page
2934
		&man.dhcpd.leases.5;, installed by the port
2981
		&man.dhcpd.leases.5;, installed by the port
2935
		gives a slightly longer description.</para>
2982
		gives a slightly longer description.</para>
2936
	    </listitem>
2983
	    </listitem>
2937
2984
2938
	    <listitem><para><filename>/usr/local/sbin/dhcrelay</filename></para>
2985
	    <listitem>
2986
	      <para><filename>/usr/local/sbin/dhcrelay</filename></para>
2939
	      <para><application>dhcrelay</application> is used in advanced
2987
	      <para><application>dhcrelay</application> is used in advanced
2940
		environments where one DHCP server forwards a request from a
2988
		environments where one DHCP server forwards a request from a
2941
		client to another DHCP server on a separate network.  If you
2989
		client to another DHCP server on a separate network.  If you
Lines 2954-2964 Link Here
2954
  <sect1 id="network-dns">
3002
  <sect1 id="network-dns">
2955
    <sect1info>
3003
    <sect1info>
2956
      <authorgroup>
3004
      <authorgroup>
2957
        <author>
3005
	<author>
2958
          <firstname>Chern</firstname>
3006
	  <firstname>Chern</firstname>
2959
          <surname>Lee</surname>
3007
	  <surname>Lee</surname>
2960
          <contrib>Contributed by </contrib>
3008
	  <contrib>Contributed by </contrib>
2961
        </author>
3009
	</author>
2962
3010
2963
	<author>
3011
	<author>
2964
	  <firstname>Tom</firstname>
3012
	  <firstname>Tom</firstname>
Lines 2975-2981 Link Here
2975
3023
2976
    <sect2>
3024
    <sect2>
2977
      <title>Overview</title>
3025
      <title>Overview</title>
2978
      <indexterm><primary>BIND</primary></indexterm>
3026
      <indexterm>
3027
	<primary>BIND</primary>
3028
      </indexterm>
2979
3029
2980
      <para>&os; utilizes, by default, a version of BIND (Berkeley
3030
      <para>&os; utilizes, by default, a version of BIND (Berkeley
2981
	Internet Name Domain), which is the most common implementation
3031
	Internet Name Domain), which is the most common implementation
Lines 2997-3003 Link Here
2997
	installation provides enhanced security features, a new file
3047
	installation provides enhanced security features, a new file
2998
	system layout and automated &man.chroot.8; configuration.</para>
3048
	system layout and automated &man.chroot.8; configuration.</para>
2999
3049
3000
      <indexterm><primary>DNS</primary></indexterm>
3050
      <indexterm>
3051
	<primary>DNS</primary>
3052
      </indexterm>
3001
      <para><acronym>DNS</acronym> is coordinated across the Internet
3053
      <para><acronym>DNS</acronym> is coordinated across the Internet
3002
	through a somewhat complex system of authoritative root, Top
3054
	through a somewhat complex system of authoritative root, Top
3003
	Level Domain (<acronym>TLD</acronym>), and other smaller-scale
3055
	Level Domain (<acronym>TLD</acronym>), and other smaller-scale
Lines 3015-3023 Link Here
3015
      <para>To understand this document, some terms related to
3067
      <para>To understand this document, some terms related to
3016
	<acronym>DNS</acronym> must be understood.</para>
3068
	<acronym>DNS</acronym> must be understood.</para>
3017
3069
3018
      <indexterm><primary>resolver</primary></indexterm>
3070
      <indexterm>
3019
      <indexterm><primary>reverse DNS</primary></indexterm>
3071
	<primary>resolver</primary>
3020
      <indexterm><primary>root zone</primary></indexterm>
3072
      </indexterm>
3073
      <indexterm>
3074
	<primary>reverse DNS</primary>
3075
      </indexterm>
3076
      <indexterm>
3077
	<primary>root zone</primary>
3078
      </indexterm>
3021
3079
3022
      <informaltable frame="none" pgwide="1">
3080
      <informaltable frame="none" pgwide="1">
3023
	<tgroup cols="2">
3081
	<tgroup cols="2">
Lines 3246-3253 Link Here
3246
      <screen>&prompt.root; <userinput>/etc/rc.d/named onestart</userinput></screen>
3304
      <screen>&prompt.root; <userinput>/etc/rc.d/named onestart</userinput></screen>
3247
3305
3248
      <para>To ensure the <application>named</application> daemon is
3306
      <para>To ensure the <application>named</application> daemon is
3249
         started at boot each time, put the following line into the
3307
	started at boot each time, put the following line into the
3250
         <filename>/etc/rc.conf</filename>:</para>
3308
	<filename>/etc/rc.conf</filename>:</para>
3251
3309
3252
      <programlisting>named_enable="YES"</programlisting>
3310
      <programlisting>named_enable="YES"</programlisting>
3253
3311
Lines 3666-3728 Link Here
3666
; Aliases
3724
; Aliases
3667
www             IN      CNAME   example.org.</programlisting>
3725
www             IN      CNAME   example.org.</programlisting>
3668
3726
3669
        <para>Note that every hostname ending in a <quote>.</quote> is an
3727
	<para>Note that every hostname ending in a <quote>.</quote> is an
3670
          exact hostname, whereas everything without a trailing
3728
	  exact hostname, whereas everything without a trailing
3671
          <quote>.</quote> is relative to the origin.  For example,
3729
	   <quote>.</quote> is relative to the origin.  For example,
3672
          <literal>ns1</literal> is translated into
3730
	  <literal>ns1</literal> is translated into
3673
          <literal>ns1.<replaceable>example.org.</replaceable></literal></para>
3731
	  <literal>ns1.<replaceable>example.org.</replaceable></literal></para>
3674
3732
3675
        <para>The format of a zone file follows:</para>
3733
	<para>The format of a zone file follows:</para>
3676
3734
3677
        <programlisting>recordname      IN recordtype   value</programlisting>
3735
	<programlisting>recordname      IN recordtype   value</programlisting>
3678
3736
3679
	<indexterm>
3737
	<indexterm>
3680
	  <primary>DNS</primary>
3738
	  <primary>DNS</primary>
3681
	  <secondary>records</secondary>
3739
	  <secondary>records</secondary>
3682
	</indexterm>
3740
	</indexterm>
3683
3741
3684
        <para>The most commonly used DNS records:</para>
3742
	<para>The most commonly used DNS records:</para>
3685
3743
3686
	<variablelist>
3744
	<variablelist>
3687
	  <varlistentry>
3745
	  <varlistentry>
3688
	    <term>SOA</term>
3746
	    <term>SOA</term>
3689
3747
3690
	    <listitem><para>start of zone authority</para></listitem>
3748
	    <listitem>
3749
	      <para>start of zone authority</para>
3750
	    </listitem>
3691
	  </varlistentry>
3751
	  </varlistentry>
3692
3752
3693
	  <varlistentry>
3753
	  <varlistentry>
3694
	    <term>NS</term>
3754
	    <term>NS</term>
3695
3755
3696
	    <listitem><para>an authoritative name server</para></listitem>
3756
	    <listitem>
3757
	      <para>an authoritative name server</para>
3758
	    </listitem>
3697
	  </varlistentry>
3759
	  </varlistentry>
3698
3760
3699
	  <varlistentry>
3761
	  <varlistentry>
3700
	    <term>A</term>
3762
	    <term>A</term>
3701
3763
3702
	    <listitem><para>a host address</para></listitem>
3764
	    <listitem>
3765
	      <para>a host address</para>
3766
	    </listitem>
3703
	  </varlistentry>
3767
	  </varlistentry>
3704
3768
3705
	  <varlistentry>
3769
	  <varlistentry>
3706
	    <term>CNAME</term>
3770
	    <term>CNAME</term>
3707
3771
3708
	    <listitem><para>the canonical name for an alias</para></listitem>
3772
	    <listitem>
3773
	      <para>the canonical name for an alias</para>
3774
	    </listitem>
3709
	  </varlistentry>
3775
	  </varlistentry>
3710
3776
3711
	  <varlistentry>
3777
	  <varlistentry>
3712
	    <term>MX</term>
3778
	    <term>MX</term>
3713
3779
3714
	    <listitem><para>mail exchanger</para></listitem>
3780
	    <listitem>
3781
	      <para>mail exchanger</para>
3782
	    </listitem>
3715
	  </varlistentry>
3783
	  </varlistentry>
3716
3784
3717
	  <varlistentry>
3785
	  <varlistentry>
3718
	    <term>PTR</term>
3786
	    <term>PTR</term>
3719
3787
3720
	    <listitem><para>a domain name pointer (used in reverse DNS)
3788
	    <listitem>
3721
	      </para></listitem>
3789
	      <para>a domain name pointer (used in reverse DNS)</para>
3790
	    </listitem>
3722
	  </varlistentry>
3791
	  </varlistentry>
3723
	</variablelist>
3792
	</variablelist>
3724
3793
3725
        <programlisting>example.org. IN SOA ns1.example.org. admin.example.org. (
3794
	<programlisting>example.org. IN SOA ns1.example.org. admin.example.org. (
3726
                        2006051501      ; Serial
3795
                        2006051501      ; Serial
3727
                        10800           ; Refresh after 3 hours
3796
                        10800           ; Refresh after 3 hours
3728
                        3600            ; Retry after 1 hour
3797
                        3600            ; Retry after 1 hour
Lines 3777-3838 Link Here
3777
	  </varlistentry>
3846
	  </varlistentry>
3778
	</variablelist>
3847
	</variablelist>
3779
3848
3780
        <programlisting>       IN NS           ns1.example.org.</programlisting>
3849
	<programlisting>       IN NS           ns1.example.org.</programlisting>
3781
3850
3782
        <para>This is an NS entry.  Every name server that is going to reply
3851
	<para>This is an NS entry.  Every name server that is going to reply
3783
          authoritatively for the zone must have one of these entries.</para>
3852
	  authoritatively for the zone must have one of these entries.</para>
3784
3853
3785
        <programlisting>localhost       IN      A       127.0.0.1
3854
	<programlisting>localhost       IN      A       127.0.0.1
3786
ns1             IN      A       192.168.1.2
3855
ns1             IN      A       192.168.1.2
3787
ns2             IN      A       192.168.1.3
3856
ns2             IN      A       192.168.1.3
3788
mx              IN      A       192.168.1.4
3857
mx              IN      A       192.168.1.4
3789
mail            IN      A       192.168.1.5</programlisting>
3858
mail            IN      A       192.168.1.5</programlisting>
3790
3859
3791
        <para>The A record indicates machine names.  As seen above,
3860
	<para>The A record indicates machine names.  As seen above,
3792
          <hostid role="fqdn">ns1.example.org</hostid> would resolve
3861
	  <hostid role="fqdn">ns1.example.org</hostid> would resolve
3793
          to <hostid role="ipaddr">192.168.1.2</hostid>.</para>
3862
	  to <hostid role="ipaddr">192.168.1.2</hostid>.</para>
3794
3863
3795
        <programlisting>                IN      A       192.168.1.1</programlisting>
3864
	<programlisting>                IN      A       192.168.1.1</programlisting>
3796
3865
3797
	<para>This line assigns IP address
3866
	<para>This line assigns IP address
3798
	  <hostid role="ipaddr">192.168.1.1</hostid> to the current origin,
3867
	  <hostid role="ipaddr">192.168.1.1</hostid> to the current origin,
3799
	  in this case <hostid role="domainname">example.org</hostid>.</para>
3868
	  in this case <hostid role="domainname">example.org</hostid>.</para>
3800
3869
3801
        <programlisting>www             IN CNAME        @</programlisting>
3870
	<programlisting>www             IN CNAME        @</programlisting>
3802
3871
3803
        <para>The canonical name record is usually used for giving aliases
3872
	<para>The canonical name record is usually used for giving aliases
3804
          to a machine.  In the example, <hostid>www</hostid> is
3873
	  to a machine.  In the example, <hostid>www</hostid> is
3805
          aliased to the <quote>master</quote> machine whose name happens
3874
	  aliased to the <quote>master</quote> machine whose name happens
3806
          to be the same as the domain name
3875
	  to be the same as the domain name
3807
          <hostid role="domainname">example.org</hostid>
3876
	  <hostid role="domainname">example.org</hostid>
3808
          (<hostid role="ipaddr">192.168.1.1</hostid>).
3877
	  (<hostid role="ipaddr">192.168.1.1</hostid>).
3809
          CNAMEs can never be used together with another kind of record
3878
	  CNAMEs can never be used together with another kind of record
3810
	  for the same hostname.</para>
3879
	  for the same hostname.</para>
3811
3880
3812
	<indexterm>
3881
	<indexterm>
3813
	  <primary>MX record</primary>
3882
	  <primary>MX record</primary>
3814
	</indexterm>
3883
	</indexterm>
3815
3884
3816
        <programlisting>               IN MX   10      mail.example.org.</programlisting>
3885
	<programlisting>               IN MX   10      mail.example.org.</programlisting>
3817
3886
3818
        <para>The MX record indicates which mail
3887
	<para>The MX record indicates which mail
3819
          servers are responsible for handling incoming mail for the
3888
	  servers are responsible for handling incoming mail for the
3820
          zone.  <hostid role="fqdn">mail.example.org</hostid> is the
3889
	  zone.  <hostid role="fqdn">mail.example.org</hostid> is the
3821
          hostname of a mail server, and 10 is the priority of
3890
	  hostname of a mail server, and 10 is the priority of
3822
          that mail server.</para>
3891
	  that mail server.</para>
3823
3892
3824
        <para>One can have several mail servers, with priorities of 10,
3893
	<para>One can have several mail servers, with priorities of 10,
3825
          20 and so on.  A mail server attempting to deliver to <hostid
3894
	  20 and so on.  A mail server attempting to deliver to <hostid
3826
	    role="domainname">example.org</hostid> would first try the
3895
	  role="domainname">example.org</hostid> would first try the
3827
          highest priority MX (the record with the lowest priority
3896
	  highest priority MX (the record with the lowest priority
3828
	  number), then the second highest, etc, until the mail can be
3897
	  number), then the second highest, etc, until the mail can be
3829
	  properly delivered.</para>
3898
	  properly delivered.</para>
3830
3899
3831
        <para>For in-addr.arpa zone files (reverse DNS), the same format is
3900
	<para>For in-addr.arpa zone files (reverse DNS), the same format is
3832
          used, except with PTR entries instead of
3901
	  used, except with PTR entries instead of  A or CNAME.</para>
3833
	  A or CNAME.</para>
3834
3902
3835
        <programlisting>$TTL 3600
3903
	<programlisting>$TTL 3600
3836
3904
3837
1.168.192.in-addr.arpa. IN SOA ns1.example.org. admin.example.org. (
3905
1.168.192.in-addr.arpa. IN SOA ns1.example.org. admin.example.org. (
3838
                        2006051501      ; Serial
3906
                        2006051501      ; Serial
Lines 3850-3857 Link Here
3850
4       IN      PTR     mx.example.org.
3918
4       IN      PTR     mx.example.org.
3851
5       IN      PTR     mail.example.org.</programlisting>
3919
5       IN      PTR     mail.example.org.</programlisting>
3852
3920
3853
        <para>This file gives the proper IP address to hostname
3921
	<para>This file gives the proper IP address to hostname
3854
          mappings for the above fictitious domain.</para>
3922
	  mappings for the above fictitious domain.</para>
3855
3923
3856
	<para>It is worth noting that all names on the right side
3924
	<para>It is worth noting that all names on the right side
3857
	  of a PTR record need to be fully qualified (i.e., end in
3925
	  of a PTR record need to be fully qualified (i.e., end in
Lines 3862-3921 Link Here
3862
    <sect2>
3930
    <sect2>
3863
      <title>Caching Name Server</title>
3931
      <title>Caching Name Server</title>
3864
      <indexterm>
3932
      <indexterm>
3865
        <primary>BIND</primary>
3933
	<primary>BIND</primary>
3866
        <secondary>caching name server</secondary>
3934
	<secondary>caching name server</secondary>
3867
      </indexterm>
3935
      </indexterm>
3868
3936
3869
      <para>A caching name server is a name server whose primary role
3937
      <para>A caching name server is a name server whose primary role
3870
	is to resolve recursive queries.  It simply asks queries of its
3938
	is to resolve recursive queries.  It simply asks queries of its
3871
        own, and remembers the answers for later use.</para>
3939
	own, and remembers the answers for later use.</para>
3872
    </sect2>
3940
    </sect2>
3873
3941
3874
    <sect2>
3942
    <sect2>
3875
      <title><acronym
3943
      <title><acronym
3876
        role="Doman Name Security Extensions">DNSSEC</acronym></title>
3944
	role="Doman Name Security Extensions">DNSSEC</acronym></title>
3877
      <indexterm>
3945
      <indexterm>
3878
        <primary>BIND</primary>
3946
	<primary>BIND</primary>
3879
        <secondary>DNS security extensions</secondary>
3947
	<secondary>DNS security extensions</secondary>
3880
      </indexterm>
3948
      </indexterm>
3881
3949
3882
      <para>Domain Name System Security Extensions, or <acronym
3950
      <para>Domain Name System Security Extensions, or <acronym
3883
        role="Domain Name Security Extensions">DNSSEC</acronym> for short, is a
3951
	role="Domain Name Security Extensions">DNSSEC</acronym> for short, is a
3884
        suite of specifications to protect resolving name servers from forged 
3952
	suite of specifications to protect resolving name servers from forged 
3885
        <acronym>DNS</acronym> data, such as spoofed <acronym>DNS</acronym>
3953
	<acronym>DNS</acronym> data, such as spoofed <acronym>DNS</acronym>
3886
        records.  By using digital signatures, a resolver can verify the 
3954
	records.  By using digital signatures, a resolver can verify the 
3887
        integrity of the record.  Note that <acronym
3955
	integrity of the record.  Note that <acronym
3888
        role="Domain Name Security Extensions">DNSSEC</acronym> only provides 
3956
	role="Domain Name Security Extensions">DNSSEC</acronym> only provides 
3889
        integrity via digitally signing the Resource Records (<acronym 
3957
	integrity via digitally signing the Resource Records (<acronym 
3890
        role="Resource Record">RR</acronym>s).  It provides neither
3958
	role="Resource Record">RR</acronym>s).  It provides neither
3891
        confidentiality nor protection against false end-user assumptions.
3959
	confidentiality nor protection against false end-user assumptions.
3892
        This means that it cannot protect against people going to <hostid
3960
	This means that it cannot protect against people going to <hostid
3893
        role="domainname">example.net</hostid> instead of <hostid
3961
	role="domainname">example.net</hostid> instead of <hostid
3894
        role="domainname">example.com</hostid>.  The only thing
3962
	role="domainname">example.com</hostid>.  The only thing
3895
        <acronym>DNSSEC</acronym> does is authenticate that the data has not
3963
	<acronym>DNSSEC</acronym> does is authenticate that the data has not
3896
        been compromised in transit.  The security of <acronym>DNS</acronym> is 
3964
	been compromised in transit.  The security of <acronym>DNS</acronym> is 
3897
        an important step in securing the Internet in general.  For more
3965
	an important step in securing the Internet in general.  For more
3898
        in-depth details of how <acronym>DNSSEC</acronym> works, the relevant
3966
	in-depth details of how <acronym>DNSSEC</acronym> works, the relevant
3899
        <acronym>RFC</acronym>s are a good place to start.  See the list in
3967
	<acronym>RFC</acronym>s are a good place to start.  See the list in
3900
        <xref linkend="dns-read">.</para>
3968
	<xref linkend="dns-read">.</para>
3901
3969
3902
      <para>The following sections will demonstrate how to enable
3970
      <para>The following sections will demonstrate how to enable
3903
        <acronym>DNSSEC</acronym> for an authoritative <acronym>DNS</acronym>
3971
	<acronym>DNSSEC</acronym> for an authoritative <acronym>DNS</acronym>
3904
        server and a recursive (or caching) <acronym>DNS</acronym> server
3972
	server and a recursive (or caching) <acronym>DNS</acronym> server
3905
        running <acronym>BIND</acronym> 9.  While all versions of
3973
	running <acronym>BIND</acronym> 9.  While all versions of
3906
        <acronym>BIND</acronym> 9 support <acronym>DNSSEC</acronym>, it is
3974
	<acronym>BIND</acronym> 9 support <acronym>DNSSEC</acronym>, it is
3907
        necessary to have at least version 9.6.2 in order to be able to use the
3975
	necessary to have at least version 9.6.2 in order to be able to use the
3908
        signed root zone when validating <acronym>DNS</acronym> queries.  This
3976
	signed root zone when validating <acronym>DNS</acronym> queries.  This
3909
        is because earlier versions lack the required algorithms to enable
3977
	is because earlier versions lack the required algorithms to enable
3910
        validation using the root zone key.  It is strongly recommended to use
3978
	validation using the root zone key.  It is strongly recommended to use
3911
        the latest version of <acronym>BIND</acronym> 9.7 or later to take
3979
	the latest version of <acronym>BIND</acronym> 9.7 or later to take
3912
        advantage of automatic key updating for the root key, as well as other
3980
	advantage of automatic key updating for the root key, as well as other
3913
        features to automatically keep zones signed and signatures up to date.
3981
	features to automatically keep zones signed and signatures up to date.
3914
        Where configurations differ between 9.6.2 and 9.7 and later,
3982
	Where configurations differ between 9.6.2 and 9.7 and later,
3915
        differences will be pointed out.</para>
3983
	differences will be pointed out.</para>
3916
3984
3917
      <sect3>
3985
      <sect3>
3918
        <title>Recursive <acronym>DNS</acronym> server configuration</title>
3986
	<title>Recursive <acronym>DNS</acronym> server configuration</title>
3919
3987
3920
	<para>Enabling <acronym>DNSSEC</acronym> validation of queries
3988
	<para>Enabling <acronym>DNSSEC</acronym> validation of queries
3921
	  performed by a recursive <acronym>DNS</acronym> server requires a few
3989
	  performed by a recursive <acronym>DNS</acronym> server requires a few
Lines 3959-3966 Link Here
3959
	  role="Key Signing Key">KSK</acronym>).  The second key, with value
4027
	  role="Key Signing Key">KSK</acronym>).  The second key, with value
3960
	  256, is a subordinate key, commonly called a Zone Signing Key
4028
	  256, is a subordinate key, commonly called a Zone Signing Key
3961
	  (<acronym role="Zone Signing Key">ZSK</acronym>).  More on the
4029
	  (<acronym role="Zone Signing Key">ZSK</acronym>).  More on the
3962
	  different key types later in the <xref
4030
	  different key types later in <xref linkend="dns-dnssec-auth">.</para>
3963
	  linkend="dns-dnssec-auth">.</para>
3964
4031
3965
	<para>Now the key must be verified and formatted so that
4032
	<para>Now the key must be verified and formatted so that
3966
	  <acronym>BIND</acronym> can use it.  To verify the key, generate a
4033
	  <acronym>BIND</acronym> can use it.  To verify the key, generate a
Lines 4202-4209 Link Here
4202
      <title>Security</title>
4269
      <title>Security</title>
4203
4270
4204
      <para>Although BIND is the most common implementation of DNS,
4271
      <para>Although BIND is the most common implementation of DNS,
4205
        there is always the issue of security.  Possible and
4272
	there is always the issue of security.  Possible and
4206
        exploitable security holes are sometimes found.
4273
	exploitable security holes are sometimes found.
4207
      </para>
4274
      </para>
4208
4275
4209
      <para>While &os; automatically drops
4276
      <para>While &os; automatically drops
Lines 4228-4235 Link Here
4228
      <title>Further Reading</title>
4295
      <title>Further Reading</title>
4229
4296
4230
      <para>BIND/<application>named</application> manual pages:
4297
      <para>BIND/<application>named</application> manual pages:
4231
        &man.rndc.8; &man.named.8; &man.named.conf.5; &man.nsupdate.8;
4298
	&man.rndc.8; &man.named.8; &man.named.conf.5; &man.nsupdate.8;
4232
        &man.dnssec-signzone.8; &man.dnssec-keygen.8;</para>
4299
	&man.dnssec-signzone.8; &man.dnssec-keygen.8;</para>
4233
4300
4234
      <itemizedlist>
4301
      <itemizedlist>
4235
	<listitem>
4302
	<listitem>
Lines 4243-4250 Link Here
4243
	</listitem>
4310
	</listitem>
4244
4311
4245
	<listitem>
4312
	<listitem>
4246
  	  <para><ulink url="http://www.oreilly.com/catalog/dns5/">O'Reilly
4313
	  <para><ulink url="http://www.oreilly.com/catalog/dns5/">O'Reilly
4247
  	    DNS and BIND 5th Edition</ulink></para>
4314
	    DNS and BIND 5th Edition</ulink></para>
4248
	</listitem>
4315
	</listitem>
4249
4316
4250
	<listitem>
4317
	<listitem>
Lines 4290-4298 Link Here
4290
	</listitem>
4357
	</listitem>
4291
4358
4292
	<listitem>
4359
	<listitem>
4293
 	  <para><ulink url="http://tools.ietf.org/html/rfc5011">RFC 5011
4360
	  <para><ulink url="http://tools.ietf.org/html/rfc5011">RFC 5011
4294
 	    - Automated Updates of DNS Security (<acronym>DNSSEC</acronym>
4361
	    - Automated Updates of DNS Security (<acronym>DNSSEC</acronym>
4295
 	    Trust Anchors</ulink></para>
4362
	    Trust Anchors</ulink></para>
4296
	</listitem>
4363
	</listitem>
4297
      </itemizedlist>
4364
      </itemizedlist>
4298
    </sect2>
4365
    </sect2>
Lines 4310-4349 Link Here
4310
    </sect1info>
4377
    </sect1info>
4311
    <title>Apache HTTP Server</title>
4378
    <title>Apache HTTP Server</title>
4312
4379
4313
    <indexterm><primary>web servers</primary>
4380
    <indexterm>
4314
      <secondary>setting up</secondary></indexterm>
4381
      <primary>web servers</primary>
4315
    <indexterm><primary>Apache</primary></indexterm>
4382
      <secondary>setting up</secondary>
4383
    </indexterm>
4384
    <indexterm>
4385
      <primary>Apache</primary>
4386
    </indexterm>
4316
4387
4317
    <sect2>
4388
    <sect2>
4318
      <title>Overview</title>
4389
      <title>Overview</title>
4319
4390
4320
      <para>&os; is used to run some of the busiest web sites in the
4391
      <para>&os; is used to run some of the busiest web sites in the
4321
        world.  The majority of web servers on the Internet are using
4392
	world.  The majority of web servers on the Internet are using
4322
        the <application>Apache HTTP Server</application>.
4393
	the <application>Apache HTTP Server</application>.
4323
        <application>Apache</application> software packages should be
4394
	<application>Apache</application> software packages should be
4324
        included on your FreeBSD installation media.  If you did not
4395
	included on your FreeBSD installation media.  If you did not
4325
        install <application>Apache</application> when you first
4396
	install <application>Apache</application> when you first
4326
        installed FreeBSD, then you can install it from the <filename
4397
	installed FreeBSD, then you can install it from the <filename
4327
        role="package">www/apache13</filename> or <filename
4398
	role="package">www/apache13</filename> or <filename
4328
        role="package">www/apache22</filename> port.</para>
4399
	role="package">www/apache22</filename> port.</para>
4329
4400
4330
      <para>Once <application>Apache</application> has been installed
4401
      <para>Once <application>Apache</application> has been installed
4331
        successfully, it must be configured.</para>
4402
	successfully, it must be configured.</para>
4332
4403
4333
      <note><para>This section covers version 1.3.X of the
4404
      <note>
4334
        <application>Apache HTTP Server</application> as that is the
4405
	<para>This section covers version 1.3.X of the
4335
        most widely used version for &os;.  <application>Apache</application>&nbsp;2.X introduces many
4406
	  <application>Apache HTTP Server</application> as that is the
4336
        new technologies but they are not discussed here.  For more
4407
	  most widely used version for &os;.  <application>Apache</application>&nbsp;2.X introduces many
4337
        information about <application>Apache</application>&nbsp;2.X, please see <ulink
4408
	  new technologies but they are not discussed here.  For more
4338
        url="http://httpd.apache.org/"></ulink>.</para></note>
4409
	  information about <application>Apache</application>&nbsp;2.X, please see <ulink
4410
	  url="http://httpd.apache.org/"></ulink>.</para>
4411
	</note>
4339
4412
4340
    </sect2>
4413
    </sect2>
4341
4414
4342
    <sect2>
4415
    <sect2>
4343
      <title>Configuration</title>
4416
      <title>Configuration</title>
4344
4417
4345
      <indexterm><primary>Apache</primary>
4418
      <indexterm>
4346
	<secondary>configuration file</secondary></indexterm>
4419
	<primary>Apache</primary>
4420
	<secondary>configuration file</secondary>
4421
      </indexterm>
4347
4422
4348
      <para>The main <application>Apache HTTP Server</application> configuration file is
4423
      <para>The main <application>Apache HTTP Server</application> configuration file is
4349
	installed as
4424
	installed as
Lines 4421-4437 Link Here
4421
    <sect2>
4496
    <sect2>
4422
      <title>Running <application>Apache</application></title>
4497
      <title>Running <application>Apache</application></title>
4423
4498
4424
      <indexterm><primary>Apache</primary>
4499
      <indexterm>
4425
	<secondary>starting or stopping</secondary></indexterm>
4500
	<primary>Apache</primary>
4501
	<secondary>starting or stopping</secondary>
4502
      </indexterm>
4426
4503
4427
      <para><application>Apache</application> does not run from the
4504
      <para><application>Apache</application> does not run from the
4428
        <application>inetd</application> super server as many other
4505
	<application>inetd</application> super server as many other
4429
        network servers do.  It is configured to run standalone for
4506
	network servers do.  It is configured to run standalone for
4430
        better performance for incoming HTTP requests from client web
4507
	better performance for incoming HTTP requests from client web
4431
        browsers.  A shell script wrapper is included to make
4508
	browsers.  A shell script wrapper is included to make
4432
        starting, stopping, and restarting the server as simple as
4509
	starting, stopping, and restarting the server as simple as
4433
        possible.  To start up <application>Apache</application> for
4510
	possible.  To start up <application>Apache</application> for
4434
        the first time, just run:</para>
4511
	the first time, just run:</para>
4435
4512
4436
      <screen>&prompt.root; <userinput>/usr/local/sbin/apachectl start</userinput></screen>
4513
      <screen>&prompt.root; <userinput>/usr/local/sbin/apachectl start</userinput></screen>
4437
4514
Lines 4440-4446 Link Here
4440
      <screen>&prompt.root; <userinput>/usr/local/sbin/apachectl stop</userinput></screen>
4517
      <screen>&prompt.root; <userinput>/usr/local/sbin/apachectl stop</userinput></screen>
4441
4518
4442
      <para>After making changes to the configuration file for any
4519
      <para>After making changes to the configuration file for any
4443
      reason, you will need to restart the server:</para>
4520
	reason, you will need to restart the server:</para>
4444
4521
4445
      <screen>&prompt.root; <userinput>/usr/local/sbin/apachectl restart</userinput></screen>
4522
      <screen>&prompt.root; <userinput>/usr/local/sbin/apachectl restart</userinput></screen>
4446
4523
Lines 4453-4460 Link Here
4453
	&man.apachectl.8; manual page.</para>
4530
	&man.apachectl.8; manual page.</para>
4454
4531
4455
      <para>To launch <application>Apache</application> at system
4532
      <para>To launch <application>Apache</application> at system
4456
        startup, add the following line to
4533
	startup, add the following line to
4457
        <filename>/etc/rc.conf</filename>:</para>
4534
	<filename>/etc/rc.conf</filename>:</para>
4458
4535
4459
      <programlisting>apache_enable="YES"</programlisting>
4536
      <programlisting>apache_enable="YES"</programlisting>
4460
4537
Lines 4471-4480 Link Here
4471
      <programlisting>apache_flags=""</programlisting>
4548
      <programlisting>apache_flags=""</programlisting>
4472
4549
4473
      <para>Now that the web server is running, you can view your web
4550
      <para>Now that the web server is running, you can view your web
4474
        site by pointing a web browser to
4551
	site by pointing a web browser to
4475
        <literal>http://localhost/</literal>.  The default web page
4552
	<literal>http://localhost/</literal>.  The default web page
4476
        that is displayed is
4553
	that is displayed is
4477
        <filename>/usr/local/www/data/index.html</filename>.</para>
4554
	<filename>/usr/local/www/data/index.html</filename>.</para>
4478
4555
4479
    </sect2>
4556
    </sect2>
4480
4557
Lines 4488-4503 Link Here
4488
	different domains to share the same IP address.</para>
4565
	different domains to share the same IP address.</para>
4489
4566
4490
      <para>To setup <application>Apache</application> to use
4567
      <para>To setup <application>Apache</application> to use
4491
        Name-based Virtual Hosting add an entry like the following to
4568
	Name-based Virtual Hosting add an entry like the following to
4492
        your <filename>httpd.conf</filename>:</para>
4569
	your <filename>httpd.conf</filename>:</para>
4493
4570
4494
      <programlisting>NameVirtualHost *</programlisting>
4571
      <programlisting>NameVirtualHost *</programlisting>
4495
4572
4496
      <para>If your webserver was named <hostid role="fqdn">www.domain.tld</hostid> and
4573
      <para>If your webserver was named <hostid role="fqdn">www.domain.tld</hostid>
4497
        you wanted to setup a virtual domain for
4574
	and you wanted to setup a virtual domain for
4498
        <hostid role="fqdn">www.someotherdomain.tld</hostid> then you would add
4575
	<hostid role="fqdn">www.someotherdomain.tld</hostid> then you would add
4499
        the following entries to
4576
	the following entries to
4500
        <filename>httpd.conf</filename>:</para>
4577
	<filename>httpd.conf</filename>:</para>
4501
4578
4502
      <screen>&lt;VirtualHost *&gt;
4579
      <screen>&lt;VirtualHost *&gt;
4503
ServerName www.domain.tld
4580
ServerName www.domain.tld
Lines 4510-4550 Link Here
4510
&lt;/VirtualHost&gt;</screen>
4587
&lt;/VirtualHost&gt;</screen>
4511
4588
4512
      <para>Replace the addresses with the addresses you want to use
4589
      <para>Replace the addresses with the addresses you want to use
4513
        and the path to the documents with what you are using.</para>
4590
	and the path to the documents with what you are using.</para>
4514
4591
4515
      <para>For more information about setting up virtual hosts,
4592
      <para>For more information about setting up virtual hosts,
4516
        please consult the official <application>Apache</application>
4593
	please consult the official <application>Apache</application>
4517
        documentation at: <ulink
4594
	documentation at: <ulink
4518
        url="http://httpd.apache.org/docs/vhosts/"></ulink>.</para>
4595
	url="http://httpd.apache.org/docs/vhosts/"></ulink>.</para>
4519
4596
4520
    </sect2>
4597
    </sect2>
4521
4598
4522
    <sect2>
4599
    <sect2>
4523
      <title>Apache Modules</title>
4600
      <title>Apache Modules</title>
4524
4601
4525
      <indexterm><primary>Apache</primary>
4602
      <indexterm>
4526
	<secondary>modules</secondary></indexterm>
4603
	<primary>Apache</primary>
4604
	<secondary>modules</secondary>
4605
      </indexterm>
4527
4606
4528
      <para>There are many different <application>Apache</application> modules available to add
4607
      <para>There are many different <application>Apache</application>
4529
        functionality to the basic server.  The FreeBSD Ports
4608
	modules available to add
4530
        Collection provides an easy way to install
4609
	functionality to the basic server.  The FreeBSD Ports
4531
        <application>Apache</application> together with some of the
4610
	Collection provides an easy way to install
4532
        more popular add-on modules.</para>
4611
	<application>Apache</application> together with some of the
4612
	more popular add-on modules.</para>
4533
4613
4534
      <sect3>
4614
      <sect3>
4535
        <title>mod_ssl</title>
4615
	<title>mod_ssl</title>
4536
4616
4537
	<indexterm><primary>web servers</primary>
4617
	<indexterm>
4538
          <secondary>secure</secondary></indexterm>
4618
	  <primary>web servers</primary>
4539
	<indexterm><primary>SSL</primary></indexterm>
4619
	  <secondary>secure</secondary>
4540
	<indexterm><primary>cryptography</primary></indexterm>
4620
	</indexterm>
4621
	<indexterm>
4622
	  <primary>SSL</primary>
4623
	</indexterm>
4624
	<indexterm>
4625
	  <primary>cryptography</primary>
4626
	</indexterm>
4541
4627
4542
        <para>The <application>mod_ssl</application> module uses the OpenSSL library to provide
4628
	<para>The <application>mod_ssl</application> module uses the OpenSSL library to provide
4543
          strong cryptography via the Secure Sockets Layer (SSL v2/v3)
4629
	  strong cryptography via the Secure Sockets Layer (SSL v2/v3)
4544
          and Transport Layer Security (TLS v1) protocols.  This
4630
	  and Transport Layer Security (TLS v1) protocols.  This
4545
          module provides everything necessary to request a signed
4631
	  module provides everything necessary to request a signed
4546
          certificate from a trusted certificate signing authority so
4632
	  certificate from a trusted certificate signing authority so
4547
          that you can run a secure web server on &os;.</para>
4633
	  that you can run a secure web server on &os;.</para>
4548
4634
4549
	<para>If you have not yet installed
4635
	<para>If you have not yet installed
4550
	  <application>Apache</application>, then a version of <application>Apache</application>
4636
	  <application>Apache</application>, then a version of <application>Apache</application>
Lines 4560-4620 Link Here
4560
      </sect3>
4646
      </sect3>
4561
4647
4562
      <sect3>
4648
      <sect3>
4563
        <title>Language Bindings</title>
4649
	<title>Language Bindings</title>
4564
4650
4565
        <para>There are Apache modules for most major scripting
4651
	<para>There are Apache modules for most major scripting
4566
          languages.  These modules typically make it possible to
4652
	  languages.  These modules typically make it possible to
4567
          write <application>Apache</application> modules entirely in
4653
	  write <application>Apache</application> modules entirely in
4568
          a scripting language.  They are also often used as a
4654
	  a scripting language.  They are also often used as a
4569
          persistent interpreter embedded into the server that avoids
4655
	  persistent interpreter embedded into the server that avoids
4570
          the overhead of starting an external interpreter and the
4656
	  the overhead of starting an external interpreter and the
4571
          startup-time penalty for dynamic websites, as described in
4657
	  startup-time penalty for dynamic websites, as described in
4572
          the next section.</para>
4658
	  the next section.</para>
4573
      </sect3>
4659
      </sect3>
4574
    </sect2>
4660
    </sect2>
4575
4661
4576
    <sect2>
4662
    <sect2>
4577
      <title>Dynamic Websites</title>
4663
      <title>Dynamic Websites</title>
4578
4664
4579
      <indexterm><primary>web servers</primary>
4665
      <indexterm>
4580
        <secondary>dynamic</secondary></indexterm>
4666
	<primary>web servers</primary>
4667
	<secondary>dynamic</secondary>
4668
      </indexterm>
4581
4669
4582
      <para>In the last decade, more businesses have turned to the
4670
      <para>In the last decade, more businesses have turned to the
4583
          Internet in order to enhance their revenue and increase
4671
	Internet in order to enhance their revenue and increase
4584
          exposure.  This has also increased the need for interactive
4672
	exposure.  This has also increased the need for interactive
4585
          web content.  While some companies, such as &microsoft;,
4673
	web content.  While some companies, such as &microsoft;,
4586
          have introduced solutions into their proprietary products,
4674
	have introduced solutions into their proprietary products,
4587
          the open source community answered the call.  Modern options
4675
	the open source community answered the call.  Modern options
4588
          for dynamic web content include Django, Ruby on Rails,
4676
	for dynamic web content include Django, Ruby on Rails,
4589
          <application>mod_perl</application>, and
4677
	<application>mod_perl</application>, and
4590
          <application>mod_php</application>.</para>
4678
	<application>mod_php</application>.</para>
4591
4679
4592
      <sect3>
4680
      <sect3>
4593
        <title>Django</title>
4681
	<title>Django</title>
4594
4682
4595
	<indexterm><primary>Python</primary></indexterm>
4683
	<indexterm>
4596
	<indexterm><primary>Django</primary></indexterm>
4684
	  <primary>Python</primary>
4685
	</indexterm>
4686
	<indexterm>
4687
	  <primary>Django</primary>
4688
	</indexterm>
4597
4689
4598
        <para>Django is a BSD licensed framework designed to allow
4690
	<para>Django is a BSD licensed framework designed to allow
4599
          developers to write high performance, elegant web
4691
	  developers to write high performance, elegant web
4600
          applications quickly.  It provides an object-relational
4692
	  applications quickly.  It provides an object-relational
4601
          mapper so that data types are developed as Python objects,
4693
	  mapper so that data types are developed as Python objects,
4602
          and a rich dynamic database-access API is provided for those
4694
	  and a rich dynamic database-access API is provided for those
4603
          objects without the developer ever having to write SQL.  It
4695
	  objects without the developer ever having to write SQL.  It
4604
          also provides an extensible template system so that the
4696
	  also provides an extensible template system so that the
4605
          logic of the application is separated from the HTML
4697
	  logic of the application is separated from the HTML
4606
          presentation.</para>
4698
	  presentation.</para>
4607
4699
4608
        <para>Django depends on <application>mod_python</application>,
4700
	<para>Django depends on <application>mod_python</application>,
4609
          <application>Apache</application>, and an SQL database
4701
	  <application>Apache</application>, and an SQL database
4610
          engine of your choice.  The FreeBSD Port will install all of
4702
	  engine of your choice.  The FreeBSD Port will install all of
4611
          these pre-requisites for you with the appropriate flags.</para>
4703
	  these pre-requisites for you with the appropriate flags.</para>
4612
4704
4613
	<example id="network-www-django-install">
4705
	<example id="network-www-django-install">
4614
	  <title>Installing Django with Apache2, mod_python3, and PostgreSQL</title>
4706
	  <title>Installing Django with Apache2, mod_python3, and PostgreSQL</title>
4615
4707
4616
	  <screen>&prompt.root; <userinput>cd /usr/ports/www/py-django; make all install clean -DWITH_MOD_PYTHON3 -DWITH_POSTGRESQL</userinput></screen>
4708
	  <screen>&prompt.root; <userinput>cd /usr/ports/www/py-django; make all install clean -DWITH_MOD_PYTHON3 -DWITH_POSTGRESQL</userinput></screen>
4617
        </example>
4709
	</example>
4618
4710
4619
	<para>Once Django and these pre-requisites are installed, you
4711
	<para>Once Django and these pre-requisites are installed, you
4620
	  will need to create a Django project directory and then
4712
	  will need to create a Django project directory and then
Lines 4624-4635 Link Here
4624
	<example id="network-www-django-apache-config">
4716
	<example id="network-www-django-apache-config">
4625
	  <title>Apache Configuration for Django/mod_python</title>
4717
	  <title>Apache Configuration for Django/mod_python</title>
4626
4718
4627
          <para>You will need to add a line to the apache
4719
	<para>You will need to add a line to the apache
4628
            <filename>httpd.conf</filename> file to configure Apache
4720
	  <filename>httpd.conf</filename> file to configure Apache
4629
            to pass requests for certain URLs to your web
4721
	  to pass requests for certain URLs to your web
4630
            application:</para>
4722
	  application:</para>
4631
4723
4632
      <screen>&lt;Location "/"&gt;
4724
	<screen>&lt;Location "/"&gt;
4633
    SetHandler python-program
4725
    SetHandler python-program
4634
    PythonPath "['/dir/to/your/django/packages/'] + sys.path"
4726
    PythonPath "['/dir/to/your/django/packages/'] + sys.path"
4635
    PythonHandler django.core.handlers.modpython
4727
    PythonHandler django.core.handlers.modpython
Lines 4641-4649 Link Here
4641
      </sect3>
4733
      </sect3>
4642
4734
4643
      <sect3>
4735
      <sect3>
4644
        <title>Ruby on Rails</title>
4736
	<title>Ruby on Rails</title>
4645
4737
4646
	<indexterm><primary>Ruby on Rails</primary></indexterm>
4738
	<indexterm>
4739
	  <primary>Ruby on Rails</primary>
4740
	</indexterm>
4647
4741
4648
	<para>Ruby on Rails is another open source web framework that
4742
	<para>Ruby on Rails is another open source web framework that
4649
	  provides a full development stack and is optimized to make
4743
	  provides a full development stack and is optimized to make
Lines 4651-4668 Link Here
4651
	  powerful applications quickly.  It can be installed easily
4745
	  powerful applications quickly.  It can be installed easily
4652
	  from the ports system.</para>
4746
	  from the ports system.</para>
4653
4747
4654
	  <screen>&prompt.root; <userinput>cd /usr/ports/www/rubygem-rails; make all install clean</userinput></screen>
4748
	<screen>&prompt.root; <userinput>cd /usr/ports/www/rubygem-rails; make all install clean</userinput></screen>
4655
      </sect3>
4749
      </sect3>
4656
4750
4657
      <sect3>
4751
      <sect3>
4658
        <title>mod_perl</title>
4752
	<title>mod_perl</title>
4659
4753
4660
	<indexterm>
4754
	<indexterm>
4661
          <primary>mod_perl</primary>
4755
	  <primary>mod_perl</primary>
4662
          <secondary>Perl</secondary>
4756
	  <secondary>Perl</secondary>
4663
        </indexterm>
4757
	</indexterm>
4664
4758
4665
        <para>The <application>Apache</application>/Perl integration project brings together the
4759
	<para>The <application>Apache</application>/Perl integration project brings together the
4666
	  full power of the Perl programming language and the <application>Apache
4760
	  full power of the Perl programming language and the <application>Apache
4667
	  HTTP Server</application>.  With the <application>mod_perl</application> module it is possible to
4761
	  HTTP Server</application>.  With the <application>mod_perl</application> module it is possible to
4668
	  write <application>Apache</application> modules entirely in Perl.  In addition, the
4762
	  write <application>Apache</application> modules entirely in Perl.  In addition, the
Lines 4670-4691 Link Here
4670
	  overhead of starting an external interpreter and the penalty
4764
	  overhead of starting an external interpreter and the penalty
4671
	  of Perl start-up time.</para>
4765
	  of Perl start-up time.</para>
4672
4766
4673
          <para><application>mod_perl</application> is available a few
4767
	<para><application>mod_perl</application> is available a few
4674
            different ways.  To use <application>mod_perl</application>
4768
	  different ways.  To use <application>mod_perl</application>
4675
            remember that <application>mod_perl</application> 1.0 only
4769
	  remember that <application>mod_perl</application> 1.0 only
4676
            works with <application>Apache</application> 1.3 and
4770
	  works with <application>Apache</application> 1.3 and
4677
            <application>mod_perl</application> 2.0 only works with
4771
	  <application>mod_perl</application> 2.0 only works with
4678
            <application>Apache</application> 2.X.
4772
	  <application>Apache</application> 2.X.
4679
            <application>mod_perl</application> 1.0 is available in
4773
	  <application>mod_perl</application> 1.0 is available in
4680
            <filename role="package">www/mod_perl</filename> and a
4774
	  <filename role="package">www/mod_perl</filename> and a
4681
            statically compiled version is available in
4775
	  statically compiled version is available in
4682
            <filename role="package">www/apache13-modperl</filename>.
4776
	  <filename role="package">www/apache13-modperl</filename>.
4683
            <application>mod_perl</application> 2.0 is available in
4777
	  <application>mod_perl</application> 2.0 is available in
4684
            <filename role="package">www/mod_perl2</filename>.</para>
4778
	  <filename role="package">www/mod_perl2</filename>.</para>
4685
        </sect3>
4779
      </sect3>
4686
4780
4687
        <sect3>
4781
      <sect3>
4688
          <sect3info>
4782
	<sect3info>
4689
	  <authorgroup>
4783
	  <authorgroup>
4690
	    <author>
4784
	    <author>
4691
	      <firstname>Tom</firstname>
4785
	      <firstname>Tom</firstname>
Lines 4693-4713 Link Here
4693
	      <contrib>Written by </contrib>
4787
	      <contrib>Written by </contrib>
4694
	    </author>
4788
	    </author>
4695
	  </authorgroup>
4789
	  </authorgroup>
4696
        </sect3info>
4790
	</sect3info>
4697
        <title>mod_php</title>
4791
	<title>mod_php</title>
4698
4792
4699
	<indexterm>
4793
	<indexterm>
4700
          <primary>mod_php</primary>
4794
	  <primary>mod_php</primary>
4701
          <secondary>PHP</secondary>
4795
	  <secondary>PHP</secondary>
4702
        </indexterm>
4796
	</indexterm>
4703
4797
4704
	<para><acronym>PHP</acronym>, also known as <quote>PHP:
4798
	<para><acronym>PHP</acronym>, also known as <quote>PHP:
4705
          Hypertext Preprocessor</quote> is a general-purpose scripting
4799
	  Hypertext Preprocessor</quote> is a general-purpose scripting
4706
          language that is especially suited for Web development.
4800
	  language that is especially suited for Web development.
4707
          Capable of being embedded into <acronym>HTML</acronym> its
4801
	  Capable of being embedded into <acronym>HTML</acronym> its
4708
          syntax draws upon C, &java;, and Perl with the intention of
4802
	  syntax draws upon C, &java;, and Perl with the intention of
4709
          allowing web developers to write dynamically generated
4803
	  allowing web developers to write dynamically generated
4710
          webpages quickly.</para>
4804
	  webpages quickly.</para>
4711
4805
4712
	<para>To gain support for <acronym>PHP</acronym>5 for the
4806
	<para>To gain support for <acronym>PHP</acronym>5 for the
4713
	  <application>Apache</application> web server, begin by
4807
	  <application>Apache</application> web server, begin by
Lines 4745-4757 Link Here
4745
	</note>
4839
	</note>
4746
4840
4747
	<para>This will install and configure the modules required
4841
	<para>This will install and configure the modules required
4748
          to support dynamic <acronym>PHP</acronym> applications.  Check
4842
	  to support dynamic <acronym>PHP</acronym> applications.  Check
4749
          to ensure the following sections have been added to
4843
	  to ensure the following sections have been added to
4750
	  <filename>/usr/local/etc/apache/httpd.conf</filename>:</para>
4844
	  <filename>/usr/local/etc/apache/httpd.conf</filename>:</para>
4751
4845
4752
	<programlisting>LoadModule php5_module        libexec/apache/libphp5.so</programlisting>
4846
	<programlisting>LoadModule php5_module        libexec/apache/libphp5.so</programlisting>
4753
4847
4754
        <programlisting>AddModule mod_php5.c
4848
	<programlisting>AddModule mod_php5.c
4755
    &lt;IfModule mod_php5.c&gt;
4849
    &lt;IfModule mod_php5.c&gt;
4756
        DirectoryIndex index.php index.html
4850
        DirectoryIndex index.php index.html
4757
    &lt;/IfModule&gt;
4851
    &lt;/IfModule&gt;
Lines 4760-4769 Link Here
4760
        AddType application/x-httpd-php-source .phps
4854
        AddType application/x-httpd-php-source .phps
4761
    &lt;/IfModule&gt;</programlisting>
4855
    &lt;/IfModule&gt;</programlisting>
4762
4856
4763
          <para>Once completed, a simple call to the
4857
	<para>Once completed, a simple call to the
4764
            <command>apachectl</command> command for a graceful
4858
	  <command>apachectl</command> command for a graceful
4765
            restart is needed to load the <acronym>PHP</acronym>
4859
	  restart is needed to load the <acronym>PHP</acronym>
4766
            module:</para>
4860
	  module:</para>
4767
4861
4768
	<screen>&prompt.root; <userinput>apachectl graceful</userinput></screen>
4862
	<screen>&prompt.root; <userinput>apachectl graceful</userinput></screen>
4769
4863
Lines 4772-4798 Link Here
4772
	  the selected <literal>OPTIONS</literal> are saved
4866
	  the selected <literal>OPTIONS</literal> are saved
4773
	  automatically by the &os; Ports framework.</para>
4867
	  automatically by the &os; Ports framework.</para>
4774
4868
4775
          <para>The <acronym>PHP</acronym> support in &os; is extremely
4869
	<para>The <acronym>PHP</acronym> support in &os; is extremely
4776
            modular so the base install is very limited.  It is very easy
4870
	   modular so the base install is very limited.  It is very easy
4777
            to add support using the
4871
	  to add support using the
4778
            <filename role="package">lang/php5-extensions</filename> port.
4872
	  <filename role="package">lang/php5-extensions</filename> port.
4779
            This port provides a menu driven interface to
4873
	  This port provides a menu driven interface to
4780
            <acronym>PHP</acronym> extension installation.
4874
	  <acronym>PHP</acronym> extension installation.
4781
            Alternatively, individual extensions can be installed using
4875
	  Alternatively, individual extensions can be installed using
4782
            the appropriate port.</para>
4876
	  the appropriate port.</para>
4783
4877
4784
	<para>For instance, to add support for the
4878
	<para>For instance, to add support for the
4785
	  <application>MySQL</application> database server to
4879
	  <application>MySQL</application> database server to
4786
	  <acronym>PHP</acronym>5, simply install the port
4880
	  <acronym>PHP</acronym>5, simply install the port
4787
	  <filename>databases/php5-mysql</filename>.</para>
4881
	  <filename>databases/php5-mysql</filename>.</para>
4788
<!-- deactivate the filename link as there is no pkg-descr file for this port -->
4882
<!-- deactivate the filename link as there is no pkg-descr file for this port -->
4789
<!--
4883
<!-- <filename role="package">databases/php5-mysql</filename> port.</para> -->
4790
	  <filename role="package">databases/php5-mysql</filename>
4884
	<para>After installing an extension, the
4791
	  port.</para>
4885
	  <application>Apache</application> server must be reloaded to
4792
-->
4886
	  pick up the new configuration changes:</para>
4793
          <para>After installing an extension, the
4794
            <application>Apache</application> server must be reloaded to
4795
              pick up the new configuration changes:</para>
4796
4887
4797
	<screen>&prompt.root; <userinput>apachectl graceful</userinput></screen>
4888
	<screen>&prompt.root; <userinput>apachectl graceful</userinput></screen>
4798
      </sect3>
4889
      </sect3>
Lines 4811-4817 Link Here
4811
    </sect1info>
4902
    </sect1info>
4812
    <title>File Transfer Protocol (FTP)</title>
4903
    <title>File Transfer Protocol (FTP)</title>
4813
4904
4814
    <indexterm><primary>FTP servers</primary></indexterm>
4905
    <indexterm>
4906
      <primary>FTP servers</primary>
4907
    </indexterm>
4815
4908
4816
    <sect2>
4909
    <sect2>
4817
      <title>Overview</title>
4910
      <title>Overview</title>
Lines 4874-4889 Link Here
4874
	for anonymous users.</para>
4967
	for anonymous users.</para>
4875
4968
4876
      <para>Once the FTP server has been configured properly, it must
4969
      <para>Once the FTP server has been configured properly, it must
4877
        be enabled in <filename>/etc/inetd.conf</filename>.  All that
4970
	be enabled in <filename>/etc/inetd.conf</filename>.  All that
4878
        is required here is to remove the comment symbol
4971
	is required here is to remove the comment symbol
4879
        <quote>#</quote> from in front of the existing
4972
	<quote>#</quote> from in front of the existing
4880
        <application>ftpd</application> line :</para>
4973
	<application>ftpd</application> line :</para>
4881
4974
4882
      <programlisting>ftp	stream	tcp	nowait	root	/usr/libexec/ftpd	ftpd -l</programlisting>
4975
      <programlisting>ftp	stream	tcp	nowait	root	/usr/libexec/ftpd	ftpd -l</programlisting>
4883
4976
4884
      <para>As explained in <xref linkend="network-inetd-reread">,
4977
      <para>As explained in <xref linkend="network-inetd-reread">,
4885
        the <application>inetd</application> configuration must be reloaded
4978
	the <application>inetd</application> configuration must be reloaded
4886
        after this configuration file is changed.  Please refer to
4979
	after this configuration file is changed.  Please refer to
4887
	<xref linkend="network-inetd-settings"> for details on enabling
4980
	<xref linkend="network-inetd-settings"> for details on enabling
4888
	<application>inetd</application> on your system.</para>
4981
	<application>inetd</application> on your system.</para>
4889
4982
Lines 4909-4924 Link Here
4909
    <sect2>
5002
    <sect2>
4910
      <title>Maintaining</title>
5003
      <title>Maintaining</title>
4911
5004
4912
      <indexterm><primary>syslog</primary></indexterm>
5005
      <indexterm>
4913
      <indexterm><primary>log files</primary>
5006
	<primary>syslog</primary>
4914
	<secondary>FTP</secondary></indexterm>
5007
      </indexterm>
5008
      <indexterm>
5009
	<primary>log files</primary>
5010
	<secondary>FTP</secondary>
5011
      </indexterm>
4915
5012
4916
      <para>The <application>ftpd</application> daemon uses
5013
      <para>The <application>ftpd</application> daemon uses
4917
        &man.syslog.3; to log messages.  By default, the system log
5014
	&man.syslog.3; to log messages.  By default, the system log
4918
        daemon will put messages related to FTP in the
5015
	daemon will put messages related to FTP in the
4919
        <filename>/var/log/xferlog</filename> file.  The location of
5016
	<filename>/var/log/xferlog</filename> file.  The location of
4920
        the FTP log can be modified by changing the following line in
5017
	the FTP log can be modified by changing the following line in
4921
        <filename>/etc/syslog.conf</filename>:</para>
5018
	<filename>/etc/syslog.conf</filename>:</para>
4922
5019
4923
      <programlisting>ftp.info      /var/log/xferlog</programlisting>
5020
      <programlisting>ftp.info      /var/log/xferlog</programlisting>
4924
5021
Lines 4928-4940 Link Here
4928
      </indexterm>
5025
      </indexterm>
4929
5026
4930
      <para>Be aware of the potential problems involved with running
5027
      <para>Be aware of the potential problems involved with running
4931
        an anonymous FTP server.  In particular, you should think
5028
	an anonymous FTP server.  In particular, you should think
4932
        twice about allowing anonymous users to upload files.  You may
5029
	twice about allowing anonymous users to upload files.  You may
4933
        find that your FTP site becomes a forum for the trade of
5030
	find that your FTP site becomes a forum for the trade of
4934
        unlicensed commercial software or worse.  If you do need to
5031
	unlicensed commercial software or worse.  If you do need to
4935
        allow anonymous FTP uploads, then you should set up the
5032
	allow anonymous FTP uploads, then you should set up the
4936
        permissions so that these files can not be read by other
5033
	permissions so that these files can not be read by other
4937
        anonymous users until they have been reviewed.</para>
5034
	anonymous users until they have been reviewed.</para>
4938
5035
4939
    </sect2>
5036
    </sect2>
4940
  </sect1>
5037
  </sect1>
Lines 4951-4958 Link Here
4951
    </sect1info>
5048
    </sect1info>
4952
    <title>File and Print Services for &microsoft.windows; clients (Samba)</title>
5049
    <title>File and Print Services for &microsoft.windows; clients (Samba)</title>
4953
5050
4954
    <indexterm><primary>Samba server</primary></indexterm>
5051
    <indexterm>
4955
    <indexterm><primary>Microsoft Windows</primary></indexterm>
5052
      <primary>Samba server</primary>
5053
    </indexterm>
5054
    <indexterm>
5055
      <primary>Microsoft Windows</primary>
5056
    </indexterm>
4956
    <indexterm>
5057
    <indexterm>
4957
      <primary>file server</primary>
5058
      <primary>file server</primary>
4958
      <secondary>Windows clients</secondary>
5059
      <secondary>Windows clients</secondary>
Lines 4966-4981 Link Here
4966
      <title>Overview</title>
5067
      <title>Overview</title>
4967
5068
4968
      <para><application>Samba</application> is a popular open source
5069
      <para><application>Samba</application> is a popular open source
4969
        software package that provides file and print services for
5070
	software package that provides file and print services for
4970
        &microsoft.windows; clients.  Such clients can connect to and
5071
	&microsoft.windows; clients.  Such clients can connect to and
4971
        use FreeBSD filespace as if it was a local disk drive, or
5072
	use FreeBSD filespace as if it was a local disk drive, or
4972
        FreeBSD printers as if they were local printers.</para>
5073
	FreeBSD printers as if they were local printers.</para>
4973
5074
4974
      <para><application>Samba</application> software packages should
5075
      <para><application>Samba</application> software packages should
4975
        be included on your FreeBSD installation media.  If you did
5076
	be included on your FreeBSD installation media.  If you did
4976
        not install <application>Samba</application> when you first
5077
	not install <application>Samba</application> when you first
4977
        installed FreeBSD, then you can install it from the <filename
5078
	installed FreeBSD, then you can install it from the <filename
4978
        role="package">net/samba34</filename> port or package.</para>
5079
	role="package">net/samba34</filename> port or package.</para>
4979
5080
4980
<!-- mention LDAP, Active Directory, WinBIND, ACL, Quotas, PAM, .. -->
5081
<!-- mention LDAP, Active Directory, WinBIND, ACL, Quotas, PAM, .. -->
4981
5082
Lines 4985-5005 Link Here
4985
      <title>Configuration</title>
5086
      <title>Configuration</title>
4986
5087
4987
      <para>A default <application>Samba</application> configuration
5088
      <para>A default <application>Samba</application> configuration
4988
        file is installed as
5089
	file is installed as
4989
        <filename>/usr/local/share/examples/samba34/smb.conf.default</filename>.  This
5090
	<filename>/usr/local/share/examples/samba34/smb.conf.default</filename>.
4990
	file must be copied to
5091
	This file must be copied to
4991
        <filename>/usr/local/etc/smb.conf</filename> and customized
5092
	<filename>/usr/local/etc/smb.conf</filename> and customized
4992
        before <application>Samba</application> can be used.</para>
5093
	before <application>Samba</application> can be used.</para>
4993
5094
4994
      <para>The <filename>smb.conf</filename> file contains runtime
5095
      <para>The <filename>smb.conf</filename> file contains runtime
4995
        configuration information for
5096
	configuration information for
4996
        <application>Samba</application>, such as definitions of the
5097
	<application>Samba</application>, such as definitions of the
4997
        printers and <quote>file system shares</quote> that you would
5098
	printers and <quote>file system shares</quote> that you would
4998
        like to share with &windows; clients.  The
5099
	like to share with &windows; clients.  The
4999
        <application>Samba</application> package includes a web based
5100
	<application>Samba</application> package includes a web based
5000
        tool called <application>swat</application> which provides a
5101
	tool called <application>swat</application> which provides a
5001
        simple way of configuring the <filename>smb.conf</filename>
5102
	simple way of configuring the <filename>smb.conf</filename>
5002
        file.</para>
5103
	file.</para>
5003
5104
5004
      <sect3>
5105
      <sect3>
5005
	<title>Using the Samba Web Administration Tool (SWAT)</title>
5106
	<title>Using the Samba Web Administration Tool (SWAT)</title>
Lines 5011-5019 Link Here
5011
	  used to configure <application>Samba</application>:</para>
5112
	  used to configure <application>Samba</application>:</para>
5012
5113
5013
	<programlisting>swat   stream  tcp     nowait/400      root    /usr/local/sbin/swat    swat</programlisting>
5114
	<programlisting>swat   stream  tcp     nowait/400      root    /usr/local/sbin/swat    swat</programlisting>
5014
        <para>As explained in <xref linkend="network-inetd-reread">,
5115
	<para>As explained in <xref linkend="network-inetd-reread">,
5015
          the <application>inetd</application> configuration must be reloaded after this configuration
5116
	  the <application>inetd</application> configuration must be reloaded after this configuration
5016
          file is changed.</para>
5117
	  file is changed.</para>
5017
5118
5018
	<para>Once <application>swat</application> has been enabled in
5119
	<para>Once <application>swat</application> has been enabled in
5019
	  <filename>inetd.conf</filename>, you can use a browser to
5120
	  <filename>inetd.conf</filename>, you can use a browser to
Lines 5052-5058 Link Here
5052
5153
5053
	  <varlistentry>
5154
	  <varlistentry>
5054
	    <term><literal>netbios name</literal></term>
5155
	    <term><literal>netbios name</literal></term>
5055
	    <indexterm><primary>NetBIOS</primary></indexterm>
5156
	    <indexterm>
5157
	      <primary>NetBIOS</primary>
5158
	    </indexterm>
5056
5159
5057
	    <listitem>
5160
	    <listitem>
5058
	      <para>This sets the NetBIOS name by which a <application>Samba</application> server
5161
	      <para>This sets the NetBIOS name by which a <application>Samba</application> server
Lines 5089-5123 Link Here
5089
5192
5090
	    <listitem>
5193
	    <listitem>
5091
	      <para>The two most common options here are
5194
	      <para>The two most common options here are
5092
	        <literal>security = share</literal> and <literal>security
5195
		<literal>security = share</literal> and <literal>security
5093
	        = user</literal>.  If your clients use usernames that
5196
		= user</literal>.  If your clients use usernames that
5094
	        are the same as their usernames on your &os; machine
5197
		are the same as their usernames on your &os; machine
5095
	        then you will want to use user level security.  This
5198
		then you will want to use user level security.  This
5096
	        is the default security policy and it requires clients
5199
		is the default security policy and it requires clients
5097
	        to first log on before they can access shared
5200
		to first log on before they can access shared
5098
	        resources.</para>
5201
		resources.</para>
5099
5202
5100
	      <para>In share level security, client do not need to log
5203
	      <para>In share level security, client do not need to log
5101
	        onto the server with a valid username and password
5204
		onto the server with a valid username and password
5102
	        before attempting to connect to a shared resource.
5205
		before attempting to connect to a shared resource.
5103
	        This was the default security model for older versions
5206
		This was the default security model for older versions
5104
	        of <application>Samba</application>.</para>
5207
		of <application>Samba</application>.</para>
5105
	    </listitem>
5208
	    </listitem>
5106
	  </varlistentry>
5209
	  </varlistentry>
5107
5210
5108
	  <varlistentry>
5211
	  <varlistentry>
5109
	    <term><literal>passdb backend</literal></term>
5212
	    <term><literal>passdb backend</literal></term>
5110
5213
5111
	    <indexterm><primary>NIS+</primary></indexterm>
5214
	    <indexterm>
5112
	    <indexterm><primary>LDAP</primary></indexterm>
5215
	      <primary>NIS+</primary>
5113
	    <indexterm><primary>SQL database</primary></indexterm>
5216
	    </indexterm>
5217
	    <indexterm>
5218
	      <primary>LDAP</primary>
5219
	    </indexterm>
5220
	    <indexterm>
5221
	      <primary>SQL database</primary>
5222
	    </indexterm>
5114
5223
5115
	    <listitem>
5224
	    <listitem>
5116
	      <para><application>Samba</application> has several
5225
	      <para><application>Samba</application> has several
5117
	        different backend authentication models.  You can
5226
		different backend authentication models.  You can
5118
	        authenticate clients with LDAP, NIS+, a SQL database,
5227
		authenticate clients with LDAP, NIS+, a SQL database,
5119
	        or a modified password file.  The default
5228
		or a modified password file.  The default
5120
	        authentication method is <literal>smbpasswd</literal>,
5229
		authentication method is <literal>smbpasswd</literal>,
5121
		and that is all that will be covered here.</para>
5230
		and that is all that will be covered here.</para>
5122
	    </listitem>
5231
	    </listitem>
5123
	  </varlistentry>
5232
	  </varlistentry>
Lines 5183-5205 Link Here
5183
	information about using rc scripts.</para>
5292
	information about using rc scripts.</para>
5184
5293
5185
      <para><application>Samba</application> actually consists of
5294
      <para><application>Samba</application> actually consists of
5186
        three separate daemons.  You should see that both the
5295
	three separate daemons.  You should see that both the
5187
        <application>nmbd</application> and <application>smbd</application> daemons
5296
	<application>nmbd</application> and <application>smbd</application> daemons
5188
        are started by the <filename>samba</filename> script.  If
5297
	are started by the <filename>samba</filename> script.  If
5189
        you enabled winbind name resolution services in
5298
	you enabled winbind name resolution services in
5190
        <filename>smb.conf</filename>, then you will also see that
5299
	<filename>smb.conf</filename>, then you will also see that
5191
        the <application>winbindd</application> daemon is started.</para>
5300
	the <application>winbindd</application> daemon is started.</para>
5192
5301
5193
      <para>You can stop <application>Samba</application> at any time
5302
      <para>You can stop <application>Samba</application> at any time
5194
        by typing :</para>
5303
	by typing :</para>
5195
5304
5196
      <screen>&prompt.root; <userinput>/usr/local/etc/rc.d/samba stop</userinput></screen>
5305
      <screen>&prompt.root; <userinput>/usr/local/etc/rc.d/samba stop</userinput></screen>
5197
5306
5198
      <para><application>Samba</application> is a complex software
5307
      <para><application>Samba</application> is a complex software
5199
        suite with functionality that allows broad integration with
5308
	suite with functionality that allows broad integration with
5200
        &microsoft.windows; networks.  For more information about
5309
	&microsoft.windows; networks.  For more information about
5201
        functionality beyond the basic installation described here,
5310
	functionality beyond the basic installation described here,
5202
        please see <ulink url="http://www.samba.org"></ulink>.</para>
5311
	please see <ulink url="http://www.samba.org"></ulink>.</para>
5203
    </sect2>
5312
    </sect2>
5204
5313
5205
  </sect1>
5314
  </sect1>
Lines 5216-5222 Link Here
5216
    </sect1info>
5325
    </sect1info>
5217
    <title>Clock Synchronization with NTP</title>
5326
    <title>Clock Synchronization with NTP</title>
5218
5327
5219
    <indexterm><primary>NTP</primary></indexterm>
5328
    <indexterm>
5329
      <primary>NTP</primary>
5330
    </indexterm>
5220
5331
5221
    <sect2>
5332
    <sect2>
5222
      <title>Overview</title>
5333
      <title>Overview</title>
Lines 5283-5289 Link Here
5283
5394
5284
      <sect3>
5395
      <sect3>
5285
	<title>Basic Configuration</title>
5396
	<title>Basic Configuration</title>
5286
	<indexterm><primary>ntpdate</primary></indexterm>
5397
	<indexterm>
5398
	  <primary>ntpdate</primary>
5399
	</indexterm>
5287
5400
5288
	<para>If you only wish to synchronize your clock when the
5401
	<para>If you only wish to synchronize your clock when the
5289
	  machine boots up, you can use &man.ntpdate.8;.  This may be
5402
	  machine boots up, you can use &man.ntpdate.8;.  This may be
Lines 5363-5369 Link Here
5363
	  server, add the following line to
5476
	  server, add the following line to
5364
	  <filename>/etc/ntp.conf</filename>:</para>
5477
	  <filename>/etc/ntp.conf</filename>:</para>
5365
5478
5366
        <programlisting>restrict default ignore</programlisting>
5479
	<programlisting>restrict default ignore</programlisting>
5367
5480
5368
	<note>
5481
	<note>
5369
	  <para>This will also prevent access from your server to
5482
	  <para>This will also prevent access from your server to
Lines 5373-5384 Link Here
5373
	    &man.ntp.conf.5; manual for more information.</para>
5486
	    &man.ntp.conf.5; manual for more information.</para>
5374
	</note>
5487
	</note>
5375
5488
5376
        <para>If you only want to allow machines within your own
5489
	<para>If you only want to allow machines within your own
5377
	  network to synchronize their clocks with your server, but
5490
	  network to synchronize their clocks with your server, but
5378
	  ensure they are not allowed to configure the server or used
5491
	  ensure they are not allowed to configure the server or used
5379
	  as peers to synchronize against, add</para>
5492
	  as peers to synchronize against, add</para>
5380
5493
5381
        <programlisting>restrict 192.168.1.0 mask 255.255.255.0 nomodify notrap</programlisting>
5494
	<programlisting>restrict 192.168.1.0 mask 255.255.255.0 nomodify notrap</programlisting>
5382
5495
5383
	<para>instead, where <hostid role="ipaddr">192.168.1.0</hostid> is
5496
	<para>instead, where <hostid role="ipaddr">192.168.1.0</hostid> is
5384
	  an IP address on your network and <hostid
5497
	  an IP address on your network and <hostid
Lines 5455-5465 Link Here
5455
  <sect1 id="network-syslogd">
5568
  <sect1 id="network-syslogd">
5456
    <sect1info>
5569
    <sect1info>
5457
      <authorgroup>
5570
      <authorgroup>
5458
        <author>
5571
	<author>
5459
          <firstname>Tom</firstname>
5572
	  <firstname>Tom</firstname>
5460
          <surname>Rhodes</surname>
5573
	  <surname>Rhodes</surname>
5461
          <contrib>Contributed by </contrib>
5574
	  <contrib>Contributed by </contrib>
5462
        </author>
5575
	</author>
5463
      </authorgroup>
5576
      </authorgroup>
5464
    </sect1info>
5577
    </sect1info>
5465
5578
Lines 5535-5541 Link Here
5535
      </note>
5648
      </note>
5536
5649
5537
      <para>Once added, all <literal>facility</literal> messages will
5650
      <para>Once added, all <literal>facility</literal> messages will
5538
        be logged to the file specified previously,
5651
	be logged to the file specified previously,
5539
	<filename>/var/log/logclient.log</filename>.</para>
5652
	<filename>/var/log/logclient.log</filename>.</para>
5540
5653
5541
      <para>The server machine must also have the following listing
5654
      <para>The server machine must also have the following listing

Return to bug 157337