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

(-)chapter.sgml (-91 / +118 lines)
Lines 187-196 Link Here
187
      successful logins.</para>
187
      successful logins.</para>
188
188
189
    <para>One must always assume that once an attacker has access to a
189
    <para>One must always assume that once an attacker has access to a
190
      user account, the attacker can break <username>root</username>.  However, the reality is
190
      user account, the attacker can break <username>root</username>.
191
      that in a well secured and maintained system, access to a user
191
      However, the reality is that in a well secured and maintained system,
192
      account does not necessarily give the attacker access to <username>root</username>.  The
192
      access to a user account does not necessarily give the attacker
193
      distinction is important because without access to <username>root</username> the attacker
193
      access to <username>root</username>.  The distinction is important
194
      because without access to <username>root</username> the attacker
194
      cannot generally hide his tracks and may, at best, be able to do
195
      cannot generally hide his tracks and may, at best, be able to do
195
      nothing more than mess with the user's files, or crash the machine.
196
      nothing more than mess with the user's files, or crash the machine.
196
      User account compromises are very common because users tend not to
197
      User account compromises are very common because users tend not to
Lines 202-220 Link Here
202
    </indexterm>
203
    </indexterm>
203
204
204
    <para>System administrators must keep in mind that there are
205
    <para>System administrators must keep in mind that there are
205
      potentially many ways to break <username>root</username> on a machine.  The attacker
206
      potentially many ways to break <username>root</username> on a machine.
206
      may know the <username>root</username> password, the attacker may find a bug in a
207
      The attacker may know the <username>root</username> password,
207
      root-run server and be able to break <username>root</username> over a network
208
      the attacker may find a bug in a root-run server and be able
209
      to break <username>root</username> over a network
208
      connection to that server, or the attacker may know of a bug in
210
      connection to that server, or the attacker may know of a bug in
209
      a suid-root program that allows the attacker to break <username>root</username> once
211
      a suid-root program that allows the attacker to break
210
      he has broken into a user's account.  If an attacker has found
212
      <username>root</username> once he has broken into a user's account.
211
      a way to break <username>root</username> on a machine, the attacker may not have a need
213
      If an attacker has found a way to break <username>root</username>
214
      on a machine, the attacker may not have a need
212
      to install a backdoor.  Many of the <username>root</username> holes
215
      to install a backdoor.  Many of the <username>root</username> holes
213
      found and closed to date involve a considerable amount of work
216
      found and closed to date involve a considerable amount of work
214
      by the attacker to cleanup after himself, so most attackers install
217
      by the attacker to cleanup after himself, so most attackers install
215
      backdoors.  A backdoor provides the attacker with a way to easily
218
      backdoors.  A backdoor provides the attacker with a way to easily
216
      regain <username>root</username> access to the system, but it also gives the smart
219
      regain <username>root</username> access to the system, but it
217
      system administrator a convenient way to detect the intrusion.
220
      also gives the smart system administrator a convenient way
221
      to detect the intrusion.
218
      Making it impossible for an attacker to install a backdoor may
222
      Making it impossible for an attacker to install a backdoor may
219
      actually be detrimental to your security, because it will not
223
      actually be detrimental to your security, because it will not
220
      close off the hole the attacker found to break in the first
224
      close off the hole the attacker found to break in the first
Lines 231-238 Link Here
231
      </listitem>
235
      </listitem>
232
236
233
      <listitem>
237
      <listitem>
234
	<para>Securing <username>root</username> &ndash; root-run servers and suid/sgid
238
	<para>Securing <username>root</username> &ndash; root-run servers
235
	  binaries.</para>
239
	  and suid/sgid binaries.</para>
236
      </listitem>
240
      </listitem>
237
241
238
      <listitem>
242
      <listitem>
Lines 280-296 Link Here
280
284
281
    <para>The sections that follow will cover the methods of securing your
285
    <para>The sections that follow will cover the methods of securing your
282
      FreeBSD system that were mentioned in the <link
286
      FreeBSD system that were mentioned in the <link
283
      linkend="security-intro">last section</link> of this chapter.</para>
287
        linkend="security-intro">last section</link> of this chapter.</para>
284
288
285
    <sect2 id="securing-root-and-staff">
289
    <sect2 id="securing-root-and-staff">
286
      <title>Securing the <username>root</username> Account and Staff Accounts</title>
290
      <title>Securing the <username>root</username> Account and
291
	Staff Accounts</title>
287
      <indexterm>
292
      <indexterm>
288
        <primary><command>su</command></primary>
293
        <primary><command>su</command></primary>
289
      </indexterm>
294
      </indexterm>
290
295
291
      <para>First off, do not bother securing staff accounts if you have
296
      <para>First off, do not bother securing staff accounts if you have
292
	not secured the <username>root</username> account.  Most systems have a password
297
	not secured the <username>root</username> account.
293
	assigned to the <username>root</username> account.  The first thing you do is assume
298
	Most systems have a password assigned to the <username>root</username>
299
	account.  The first thing you do is assume
294
	that the password is <emphasis>always</emphasis> compromised.
300
	that the password is <emphasis>always</emphasis> compromised.
295
	This does not mean that you should remove the password.  The
301
	This does not mean that you should remove the password.  The
296
	password is almost always necessary for console access to the
302
	password is almost always necessary for console access to the
Lines 298-350 Link Here
298
	possible to use the password outside of the console or possibly
304
	possible to use the password outside of the console or possibly
299
	even with the &man.su.1; command.  For example, make sure that
305
	even with the &man.su.1; command.  For example, make sure that
300
	your pty's are specified as being unsecure in the
306
	your pty's are specified as being unsecure in the
301
	<filename>/etc/ttys</filename> file so that direct <username>root</username> logins
307
	<filename>/etc/ttys</filename> file so that direct
308
	<username>root</username> logins
302
	via <command>telnet</command> or <command>rlogin</command> are
309
	via <command>telnet</command> or <command>rlogin</command> are
303
	disallowed.  If using other login services such as
310
	disallowed.  If using other login services such as
304
        <application>sshd</application>, make sure that direct <username>root</username>
311
        <application>sshd</application>, make sure that direct
305
        logins are disabled there as well.  You can do this by editing
312
	<username>root</username> logins are disabled there as well.
313
	You can do this by editing
306
        your <filename>/etc/ssh/sshd_config</filename> file, and making
314
        your <filename>/etc/ssh/sshd_config</filename> file, and making
307
        sure that <literal>PermitRootLogin</literal> is set to
315
        sure that <literal>PermitRootLogin</literal> is set to
308
        <literal>NO</literal>.  Consider every access method &ndash;
316
        <literal>NO</literal>.  Consider every access method &ndash;
309
        services such as FTP often fall through the cracks.  Direct <username>root</username>
317
        services such as FTP often fall through the cracks.
310
	logins should only be allowed via the system console.</para>
318
	Direct <username>root</username> logins should only be allowed
319
	via the system console.</para>
311
      <indexterm>
320
      <indexterm>
312
        <primary><groupname>wheel</groupname></primary>
321
        <primary><groupname>wheel</groupname></primary>
313
      </indexterm>
322
      </indexterm>
314
323
315
      <para>Of course, as a sysadmin you have to be able to get to <username>root</username>,
324
      <para>Of course, as a sysadmin you have to be able to get to
316
	so we open up a few holes.  But we make sure these holes require
325
	<username>root</username>, so we open up a few holes.
317
	additional password verification to operate.  One way to make <username>root</username>
326
	But we make sure these holes require additional password
327
	verification to operate.  One way to make <username>root</username>
318
	accessible is to add appropriate staff accounts to the
328
	accessible is to add appropriate staff accounts to the
319
	<groupname>wheel</groupname> group (in
329
	<groupname>wheel</groupname> group (in
320
	<filename>/etc/group</filename>). The staff members placed in the
330
	<filename>/etc/group</filename>). The staff members placed in the
321
	<groupname>wheel</groupname> group are allowed to
331
	<groupname>wheel</groupname> group are allowed to
322
	<command>su</command> to <username>root</username>.  You should never give staff
332
	<command>su</command> to <username>root</username>.
333
	You should never give staff
323
	members native wheel access by putting them in the
334
	members native wheel access by putting them in the
324
	<groupname>wheel</groupname> group in their password entry.  Staff
335
	<groupname>wheel</groupname> group in their password entry.  Staff
325
	accounts should be placed in a <groupname>staff</groupname> group, and
336
	accounts should be placed in a <groupname>staff</groupname> group, and
326
	then added to the <groupname>wheel</groupname> group via the
337
	then added to the <groupname>wheel</groupname> group via the
327
	<filename>/etc/group</filename> file.  Only those staff members
338
	<filename>/etc/group</filename> file.  Only those staff members
328
	who actually need to have <username>root</username> access should be placed in the
339
	who actually need to have <username>root</username> access
340
	should be placed in the
329
	<groupname>wheel</groupname> group.  It is also possible, when using
341
	<groupname>wheel</groupname> group.  It is also possible, when using
330
	an authentication method such as Kerberos, to use Kerberos'
342
	an authentication method such as Kerberos, to use Kerberos'
331
	<filename>.k5login</filename> file in the <username>root</username> account to allow a
343
	<filename>.k5login</filename> file in the <username>root</username>
332
	&man.ksu.1; to <username>root</username> without having to place anyone at all in the
344
	account to allow a &man.ksu.1; to <username>root</username>
345
	without having to place anyone at all in the
333
	<groupname>wheel</groupname> group.  This may be the better solution
346
	<groupname>wheel</groupname> group.  This may be the better solution
334
	since the <groupname>wheel</groupname> mechanism still allows an
347
	since the <groupname>wheel</groupname> mechanism still allows an
335
	intruder to break <username>root</username> if the intruder has gotten hold of your
348
	intruder to break <username>root</username> if the intruder
349
	has gotten hold of your
336
	password file and can break into a staff account.  While having
350
	password file and can break into a staff account.  While having
337
	the <groupname>wheel</groupname> mechanism is better than having
351
	the <groupname>wheel</groupname> mechanism is better than having
338
	nothing at all, it is not necessarily the safest option.</para>
352
	nothing at all, it is not necessarily the safest option.</para>
339
353
340
      <para>An indirect way to secure staff accounts, and ultimately
354
      <para>An indirect way to secure staff accounts, and ultimately
341
        <username>root</username> access is to use an alternative login access method and
355
        <username>root</username> access is to use an alternative
356
	login access method and
342
        do what is known as <quote>starring</quote> out the crypted
357
        do what is known as <quote>starring</quote> out the crypted
343
        password for the staff accounts. Using the &man.vipw.8;
358
        password for the staff accounts. Using the &man.vipw.8;
344
        command, one can replace each instance of a crypted password
359
        command, one can replace each instance of a crypted password
345
        with a single <quote><literal>*</literal></quote> character.  This command
360
        with a single <quote><literal>*</literal></quote> character.
346
        will update the <filename>/etc/master.passwd</filename> file
361
	This command will update the <filename>/etc/master.passwd</filename>
347
        and user/password database to disable password-authenticated
362
	file and user/password database to disable password-authenticated
348
        logins.</para>
363
        logins.</para>
349
364
350
      <para>A staff account entry such as:</para>
365
      <para>A staff account entry such as:</para>
Lines 357-363 Link Here
357
372
358
      <para>This change will prevent normal logins from occurring,
373
      <para>This change will prevent normal logins from occurring,
359
        since the encrypted password will never match
374
        since the encrypted password will never match
360
        <quote><literal>*</literal></quote>.  With this done, staff members must use
375
        <quote><literal>*</literal></quote>.  With this done,
376
	staff members must use
361
        another mechanism to authenticate themselves such as
377
        another mechanism to authenticate themselves such as
362
        &man.kerberos.1; or &man.ssh.1; using a public/private key
378
        &man.kerberos.1; or &man.ssh.1; using a public/private key
363
        pair.  When using something like Kerberos, one generally must
379
        pair.  When using something like Kerberos, one generally must
Lines 437-446 Link Here
437
	most bug-prone.  For example, running an old version of
453
	most bug-prone.  For example, running an old version of
438
	<application>imapd</application> or
454
	<application>imapd</application> or
439
	<application>popper</application> is like giving a universal
455
	<application>popper</application> is like giving a universal
440
	<username>root</username> ticket out to the entire world.  Never run a server that
456
	<username>root</username> ticket out to the entire world.
441
	you have not checked out carefully.  Many servers do not need to
457
	Never run a server that you have not checked out carefully.
442
	be run as <username>root</username>.  For example, the
458
	Many servers do not need to be run as <username>root</username>.
443
	<application>ntalk</application>,
459
	For example, the <application>ntalk</application>,
444
	<application>comsat</application>, and
460
	<application>comsat</application>, and
445
	<application>finger</application> daemons can be run in special
461
	<application>finger</application> daemons can be run in special
446
	user <firstterm>sandboxes</firstterm>.  A sandbox is not perfect,
462
	user <firstterm>sandboxes</firstterm>.  A sandbox is not perfect,
Lines 450-457 Link Here
450
	break out of the sandbox.  The more layers the attacker must
466
	break out of the sandbox.  The more layers the attacker must
451
	break through, the lower the likelihood of his success.  Root
467
	break through, the lower the likelihood of his success.  Root
452
	holes have historically been found in virtually every server
468
	holes have historically been found in virtually every server
453
	ever run as <username>root</username>, including basic system servers.  If you are
469
	ever run as <username>root</username>, including basic system servers.
454
	running a machine through which people only login via
470
	If you are running a machine through which people only login via
455
	<application>sshd</application> and never login via
471
	<application>sshd</application> and never login via
456
	<application>telnetd</application> or
472
	<application>telnetd</application> or
457
	<application>rshd</application> or
473
	<application>rshd</application> or
Lines 481-497 Link Here
481
	and others.  There are alternatives to some of these, but
497
	and others.  There are alternatives to some of these, but
482
	installing them may require more work than you are willing to
498
	installing them may require more work than you are willing to
483
	perform (the convenience factor strikes again). You may have to
499
	perform (the convenience factor strikes again). You may have to
484
	run these servers as <username>root</username> and rely on other mechanisms to detect
500
	run these servers as <username>root</username> and rely on other
485
	break-ins that might occur through them.</para>
501
	mechanisms to detect break-ins that might occur through them.</para>
486
502
487
      <para>The other big potential <username>root</username> holes in a system are the
503
      <para>The other big potential <username>root</username> holes in a
504
	system are the
488
	suid-root and sgid binaries installed on the system.  Most of
505
	suid-root and sgid binaries installed on the system.  Most of
489
	these binaries, such as <application>rlogin</application>, reside
506
	these binaries, such as <application>rlogin</application>, reside
490
	in <filename>/bin</filename>, <filename>/sbin</filename>,
507
	in <filename>/bin</filename>, <filename>/sbin</filename>,
491
	<filename>/usr/bin</filename>, or <filename>/usr/sbin</filename>.
508
	<filename>/usr/bin</filename>, or <filename>/usr/sbin</filename>.
492
	While nothing is 100% safe, the system-default suid and sgid
509
	While nothing is 100% safe, the system-default suid and sgid
493
	binaries can be considered reasonably safe.  Still, <username>root</username> holes are
510
	binaries can be considered reasonably safe.  Still,
494
	occasionally found in these binaries.  A <username>root</username> hole was found in
511
	<username>root</username> holes are occasionally found in these
512
	binaries.  A <username>root</username> hole was found in
495
	<literal>Xlib</literal> in 1998 that made
513
	<literal>Xlib</literal> in 1998 that made
496
	<application>xterm</application> (which is typically suid)
514
	<application>xterm</application> (which is typically suid)
497
	vulnerable.  It is better to be safe than sorry and the prudent
515
	vulnerable.  It is better to be safe than sorry and the prudent
Lines 537-549 Link Here
537
	passwords as you can and use ssh or
555
	passwords as you can and use ssh or
538
	Kerberos for access to those accounts.  Even though the crypted
556
	Kerberos for access to those accounts.  Even though the crypted
539
	password file (<filename>/etc/spwd.db</filename>) can only be read
557
	password file (<filename>/etc/spwd.db</filename>) can only be read
540
	by <username>root</username>, it may be possible for an intruder to obtain read access
558
	by <username>root</username>, it may be possible for an intruder
541
	to that file even if the attacker cannot obtain root-write
559
	to obtain read access to that file even if the attacker cannot
542
	access.</para>
560
	obtain root-write access.</para>
543
561
544
      <para>Your security scripts should always check for and report
562
      <para>Your security scripts should always check for and report
545
	changes to the password file (see the <link
563
	changes to the password file (see the <link
546
	linkend="security-integrity">Checking file integrity</link> section
564
	  linkend="security-integrity">Checking file integrity</link> section
547
	below).</para>
565
	below).</para>
548
    </sect2>
566
    </sect2>
549
567
Lines 551-557 Link Here
551
      <title>Securing the Kernel Core, Raw Devices, and
569
      <title>Securing the Kernel Core, Raw Devices, and
552
	Filesystems</title>
570
	Filesystems</title>
553
571
554
      <para>If an attacker breaks <username>root</username> he can do just about anything, but
572
      <para>If an attacker breaks <username>root</username> he can do
573
        just about anything, but
555
	there are certain conveniences.  For example, most modern kernels
574
	there are certain conveniences.  For example, most modern kernels
556
	have a packet sniffing device driver built in.  Under FreeBSD it
575
	have a packet sniffing device driver built in.  Under FreeBSD it
557
	is called the <devicename>bpf</devicename> device.  An intruder
576
	is called the <devicename>bpf</devicename> device.  An intruder
Lines 765-772 Link Here
765
	delivery you can run the queue at a much lower interval, such as
784
	delivery you can run the queue at a much lower interval, such as
766
	<option>-q1m</option>, but be sure to specify a reasonable
785
	<option>-q1m</option>, but be sure to specify a reasonable
767
	<literal>MaxDaemonChildren</literal> option for
786
	<literal>MaxDaemonChildren</literal> option for
768
	<emphasis>that</emphasis> sendmail to prevent cascade failures.
787
	<emphasis>that</emphasis> sendmail to prevent cascade failures.</para>
769
	</para>
770
788
771
      <para><application>Syslogd</application> can be attacked directly
789
      <para><application>Syslogd</application> can be attacked directly
772
	and it is strongly recommended that you use the <option>-s</option>
790
	and it is strongly recommended that you use the <option>-s</option>
Lines 783-789 Link Here
783
	external access by firewalling them off at your border routers.
801
	external access by firewalling them off at your border routers.
784
	The idea here is to prevent saturation attacks from outside your
802
	The idea here is to prevent saturation attacks from outside your
785
	LAN, not so much to protect internal services from network-based
803
	LAN, not so much to protect internal services from network-based
786
	<username>root</username> compromise.  Always configure an exclusive firewall, i.e.,
804
	<username>root</username> compromise.
805
	Always configure an exclusive firewall, i.e.,
787
	<quote>firewall everything <emphasis>except</emphasis> ports A, B,
806
	<quote>firewall everything <emphasis>except</emphasis> ports A, B,
788
	C, D, and M-Z</quote>.  This way you can firewall off all of your
807
	C, D, and M-Z</quote>.  This way you can firewall off all of your
789
	low ports except for certain specific services such as
808
	low ports except for certain specific services such as
Lines 903-909 Link Here
903
	ssh to an unsecure machine, your keys
922
	ssh to an unsecure machine, your keys
904
	becomes exposed.  The actual keys themselves are not exposed, but
923
	becomes exposed.  The actual keys themselves are not exposed, but
905
	ssh installs a forwarding port for the
924
	ssh installs a forwarding port for the
906
	duration of your login, and if an attacker has broken <username>root</username> on the
925
	duration of your login, and if an attacker has broken
926
	<username>root</username> on the
907
	unsecure machine he can utilize that port to use your keys to gain
927
	unsecure machine he can utilize that port to use your keys to gain
908
	access to any other machine that your keys unlock.</para>
928
	access to any other machine that your keys unlock.</para>
909
929
Lines 1445-1452 Link Here
1445
      <para>You should now edit the <filename>krb.conf</filename> and
1465
      <para>You should now edit the <filename>krb.conf</filename> and
1446
	<filename>krb.realms</filename> files to define your Kerberos realm.
1466
	<filename>krb.realms</filename> files to define your Kerberos realm.
1447
	In this case the realm will be <filename>EXAMPLE.COM</filename> and the
1467
	In this case the realm will be <filename>EXAMPLE.COM</filename> and the
1448
	server is <hostid role="fqdn">grunt.example.com</hostid>.  We edit or create
1468
	server is <hostid role="fqdn">grunt.example.com</hostid>.  We edit
1449
	the <filename>krb.conf</filename> file:</para>
1469
	or create the <filename>krb.conf</filename> file:</para>
1450
	  
1470
	  
1451
      <screen>&prompt.root; <userinput>cat krb.conf</userinput>
1471
      <screen>&prompt.root; <userinput>cat krb.conf</userinput>
1452
EXAMPLE.COM
1472
EXAMPLE.COM
Lines 1804-1811 Link Here
1804
	<literal>&lt;principal&gt;.&lt;instance&gt;</literal> of the form
1824
	<literal>&lt;principal&gt;.&lt;instance&gt;</literal> of the form
1805
	<literal>&lt;username&gt;.</literal><username>root</username> will allow
1825
	<literal>&lt;username&gt;.</literal><username>root</username> will allow
1806
	that <literal>&lt;username&gt;</literal> to <command>su</command> to
1826
	that <literal>&lt;username&gt;</literal> to <command>su</command> to
1807
	<username>root</username> if the necessary entries are in the <filename>.klogin</filename>
1827
	<username>root</username> if the necessary entries are in the
1808
	file in <username>root</username>'s home directory:</para>
1828
	<filename>.klogin</filename> file in <username>root</username>'s
1829
	home directory:</para>
1809
	  
1830
	  
1810
      <screen>&prompt.root; <userinput>cat /root/.klogin</userinput>
1831
      <screen>&prompt.root; <userinput>cat /root/.klogin</userinput>
1811
jane.root@EXAMPLE.COM</screen>
1832
jane.root@EXAMPLE.COM</screen>
Lines 1838-1844 Link Here
1838
1859
1839
FreeBSD BUILT-19950429 (GR386) #0: Sat Apr 29 17:50:09 SAT 1995</screen>
1860
FreeBSD BUILT-19950429 (GR386) #0: Sat Apr 29 17:50:09 SAT 1995</screen>
1840
	  
1861
	  
1841
      <para>Or Jack logs into Jane's account on the same machine (<username>jane</username> having
1862
      <para>Or Jack logs into Jane's account on the same machine
1863
	(<username>jane</username> having
1842
	set up the <filename>.klogin</filename> file as above, and the person
1864
	set up the <filename>.klogin</filename> file as above, and the person
1843
	in charge of Kerberos having set up principal
1865
	in charge of Kerberos having set up principal
1844
	<emphasis>jack</emphasis> with a null instance:</para>
1866
	<emphasis>jack</emphasis> with a null instance:</para>
Lines 2640-2646 Link Here
2640
      elsewhere, and is not available for unrestricted use.
2662
      elsewhere, and is not available for unrestricted use.
2641
      IDEA is included in the OpenSSL sources in FreeBSD, but it is not
2663
      IDEA is included in the OpenSSL sources in FreeBSD, but it is not
2642
      built by default.  If you wish to use it, and you comply with the
2664
      built by default.  If you wish to use it, and you comply with the
2643
      license terms, enable the <literal>MAKE_IDEA</literal> switch in <filename>/etc/make.conf</filename> and
2665
      license terms, enable the <literal>MAKE_IDEA</literal> switch in
2666
      <filename>/etc/make.conf</filename> and
2644
      rebuild your sources using <command>make world</command>.</para>
2667
      rebuild your sources using <command>make world</command>.</para>
2645
2668
2646
    <para>Today, the RSA algorithm is free for use in USA and other
2669
    <para>Today, the RSA algorithm is free for use in USA and other
Lines 2726-2746 Link Here
2726
        From HOST B to HOST A, new AH and new ESP are combined.</para>
2749
        From HOST B to HOST A, new AH and new ESP are combined.</para>
2727
2750
2728
      <para>Now we should choose an algorithm to be used corresponding to
2751
      <para>Now we should choose an algorithm to be used corresponding to
2729
        <quote>AH</quote>/<quote>new AH</quote>/<quote>ESP</quote>/<quote>new ESP</quote>.  Please refer to the &man.setkey.8; man
2752
        <quote>AH</quote>/<quote>new AH</quote>/<quote>ESP</quote>/
2753
	<quote>new ESP</quote>.  Please refer to the &man.setkey.8; man
2730
        page to know algorithm names.  Our choice is MD5 for AH, new-HMAC-SHA1
2754
        page to know algorithm names.  Our choice is MD5 for AH, new-HMAC-SHA1
2731
        for new AH, and new-DES-expIV with 8 byte IV for new ESP.</para>
2755
        for new AH, and new-DES-expIV with 8 byte IV for new ESP.</para>
2732
2756
2733
      <para>Key length highly depends on each algorithm.  For example, key
2757
      <para>Key length highly depends on each algorithm.  For example, key
2734
        length must be equal to 16 bytes for MD5, 20 for new-HMAC-SHA1,
2758
        length must be equal to 16 bytes for MD5, 20 for new-HMAC-SHA1,
2735
        and 8 for new-DES-expIV.  Now we choose <quote>MYSECRETMYSECRET</quote>,
2759
        and 8 for new-DES-expIV.  Now we choose <quote>MYSECRETMYSECRET</quote>,
2736
        <quote>KAMEKAMEKAMEKAMEKAME</quote>, <quote>PASSWORD</quote>, respectively.</para>
2760
        <quote>KAMEKAMEKAMEKAMEKAME</quote>, <quote>PASSWORD</quote>,
2761
	respectively.</para>
2737
2762
2738
      <para>OK, let us assign SPI (Security Parameter Index) for each protocol.
2763
      <para>OK, let us assign SPI (Security Parameter Index) for each protocol.
2739
        Please note that we need 3 SPIs for this secure channel since three
2764
        Please note that we need 3 SPIs for this secure channel since three
2740
        security headers are produced (one for from HOST A to HOST B, two for
2765
        security headers are produced (one for from HOST A to HOST B, two for
2741
        from HOST B to HOST A).  Please also note that SPI MUST be greater
2766
        from HOST B to HOST A).  Please also note that SPI MUST be greater
2742
        than or equal to 256.  We choose, 1000, 2000, and 3000, respectively.
2767
        than or equal to 256.  We choose, 1000, 2000, and 3000,
2743
      </para>
2768
	respectively.</para>
2744
2769
2745
      <screen>
2770
      <screen>
2746
	         (1)
2771
	         (1)
Lines 2827-2835 Link Here
2827
          fec0::10 -------------------- fec0::11
2852
          fec0::10 -------------------- fec0::11
2828
</screen>
2853
</screen>
2829
2854
2830
      <para>Encryption algorithm is blowfish-cbc whose key is <quote>kamekame</quote>, and
2855
      <para>Encryption algorithm is blowfish-cbc whose key is
2831
        authentication algorithm is hmac-sha1 whose key is <quote>this is the test
2856
	<quote>kamekame</quote>, and authentication algorithm is hmac-sha1
2832
        key</quote>.  Configuration at Host-A:</para>
2857
	whose key is <quote>this is the test key</quote>.
2858
	Configuration at Host-A:</para>
2833
2859
2834
      <screen>
2860
      <screen>
2835
        &prompt.root; <command>setkey -c</command> &lt;&lt;<filename>EOF</filename>
2861
        &prompt.root; <command>setkey -c</command> &lt;&lt;<filename>EOF</filename>
Lines 2899-2908 Link Here
2899
        EOF
2925
        EOF
2900
</screen>
2926
</screen>
2901
2927
2902
      <para>If the port number field is omitted such as above then <literal>[any]</literal> is
2928
      <para>If the port number field is omitted such as above then
2903
        employed. <literal>-m</literal> specifies the mode of SA to be used. <literal>-m any</literal> means
2929
	<literal>[any]</literal> is employed. <literal>-m</literal>
2904
        wild-card of mode of security protocol. You can use this SA for both
2930
	specifies the mode of SA to be used. <literal>-m any</literal> means
2905
        tunnel and transport mode.</para>
2931
	wild-card of mode of security protocol. You can use this SA for both
2932
	tunnel and transport mode.</para>
2906
2933
2907
      <para>and at Gateway-B:</para>
2934
      <para>and at Gateway-B:</para>
2908
2935
Lines 3062-3073 Link Here
3062
      </indexterm>
3089
      </indexterm>
3063
3090
3064
      <para>Be sure to make the following additions to your 
3091
      <para>Be sure to make the following additions to your 
3065
        <filename>rc.conf</filename> file:
3092
        <filename>rc.conf</filename> file:</para>
3066
      </para>
3067
      <screen>sshd_enable="YES"</screen>
3093
      <screen>sshd_enable="YES"</screen>
3068
      <para>This will load the <application>ssh</application> daemon the next time your system
3094
      <para>This will load the <application>ssh</application> daemon
3069
        initializes.  Alternatively, you can simply run the
3095
	the next time your system initializes.  Alternatively, you can
3070
        <application>sshd</application> daemon.</para>
3096
	simply run the <application>sshd</application> daemon.</para>
3071
    </sect2>
3097
    </sect2>
3072
3098
3073
    <sect2>
3099
    <sect2>
Lines 3090-3096 Link Here
3090
        created using <command>rlogin</command> or telnet.  SSH utilizes a 
3116
        created using <command>rlogin</command> or telnet.  SSH utilizes a 
3091
	key fingerprint
3117
	key fingerprint
3092
        system for verifying the authenticity of the server when the 
3118
        system for verifying the authenticity of the server when the 
3093
        client connects.  The user is prompted to enter <literal>yes</literal> only when
3119
        client connects.  The user is prompted to enter
3120
	<literal>yes</literal> only when
3094
        connecting for the first time.  Future attempts to login are all
3121
        connecting for the first time.  Future attempts to login are all
3095
        verified against the saved fingerprint key.  The SSH client
3122
        verified against the saved fingerprint key.  The SSH client
3096
        will alert you if the saved fingerprint differs from the
3123
        will alert you if the saved fingerprint differs from the
Lines 3117-3125 Link Here
3117
      </indexterm>
3144
      </indexterm>
3118
      <indexterm><primary><command>scp</command></primary></indexterm>
3145
      <indexterm><primary><command>scp</command></primary></indexterm>
3119
3146
3120
      <para>The <command>scp</command> command works similarly to <command>rcp</command>;
3147
      <para>The <command>scp</command> command works similarly to
3121
        it copies a file to or from a remote machine, except in a
3148
	<command>rcp</command>; it copies a file to or from a remote machine,
3122
        secure fashion.</para>
3149
	except in a secure fashion.</para>
3123
3150
3124
      <screen>&prompt.root <userinput> scp <replaceable>user@example.com:/COPYRIGHT COPYRIGHT</replaceable></userinput>
3151
      <screen>&prompt.root <userinput> scp <replaceable>user@example.com:/COPYRIGHT COPYRIGHT</replaceable></userinput>
3125
user@example.com's password: 
3152
user@example.com's password: 
Lines 3128-3135 Link Here
3128
&prompt.root</screen>
3155
&prompt.root</screen>
3129
      <para>Since the fingerprint was already saved for this host in the
3156
      <para>Since the fingerprint was already saved for this host in the
3130
        previous example, it is verified when using <command>scp</command>
3157
        previous example, it is verified when using <command>scp</command>
3131
        here.
3158
        here.</para>
3132
      </para>
3133
3159
3134
      <para>The arguments passed to <command>scp</command> are similar
3160
      <para>The arguments passed to <command>scp</command> are similar
3135
	to <command>cp</command>, with the file or files in the first
3161
	to <command>cp</command>, with the file or files in the first
Lines 3278-3296 Link Here
3278
      </variablelist>
3304
      </variablelist>
3279
3305
3280
3306
3281
      <para>An SSH tunnel works by creating a listen socket on <hostid>localhost</hostid>
3307
      <para>An SSH tunnel works by creating a listen socket on
3282
	on the specified port.  It then forwards any connection received
3308
	<hostid>localhost</hostid> on the specified port.
3309
	It then forwards any connection received
3283
	on the local host/port via the SSH connection to the specified
3310
	on the local host/port via the SSH connection to the specified
3284
	remote host and port.</para>
3311
	remote host and port.</para>
3285
3312
3286
      <para>In the example, port <replaceable>5023</replaceable> on
3313
      <para>In the example, port <replaceable>5023</replaceable> on
3287
	<hostid>localhost</hostid> is being forwarded to port
3314
	<hostid>localhost</hostid> is being forwarded to port
3288
	<replaceable>23</replaceable> on <hostid>localhost</hostid> of the remote
3315
	<replaceable>23</replaceable> on <hostid>localhost</hostid>
3289
	machine.  Since <replaceable>23</replaceable> is telnet, this
3316
	of the remote machine.  Since <replaceable>23</replaceable> is telnet,
3290
	would create a secure telnet session through an SSH tunnel.</para>
3317
	this would create a secure telnet session through an SSH tunnel.</para>
3291
3318
3292
       <para>This can be used to wrap any number of insecure TCP protocols 
3319
      <para>This can be used to wrap any number of insecure TCP protocols 
3293
         such as smtp, pop3, ftp, etc.</para>
3320
        such as smtp, pop3, ftp, etc.</para>
3294
3321
3295
       <para>A typical SSH Tunnel</para>
3322
       <para>A typical SSH Tunnel</para>
3296
       <screen>&prompt.user; <userinput>ssh -2 -N -f -L <replaceable>5025:localhost:25 user@mailserver.example.com</replaceable></userinput>
3323
       <screen>&prompt.user; <userinput>ssh -2 -N -f -L <replaceable>5025:localhost:25 user@mailserver.example.com</replaceable></userinput>

Return to bug 32094