old-www/LDP/solrhe/Securing-Optimizing-Linux-R.../chap5sec56.html

246 lines
4.3 KiB
HTML

<HTML
><HEAD
><TITLE
>Enable TCP SYN Cookie Protection</TITLE
><META
NAME="GENERATOR"
CONTENT="Modular DocBook HTML Stylesheet Version 1.60"><LINK
REL="HOME"
TITLE="Securing and Optimizing Linux"
HREF="index.html"><LINK
REL="UP"
TITLE="General System Security"
HREF="gen-syssecured.html"><LINK
REL="PREVIOUS"
TITLE="Routing Protocols"
HREF="chap5sec55.html"><LINK
REL="NEXT"
TITLE="Disable ICMP Redirect Acceptance"
HREF="chap5sec57.html"></HEAD
><BODY
CLASS="section"
BGCOLOR="#FFFFFF"
TEXT="#000000"
LINK="#0000FF"
VLINK="#840084"
ALINK="#0000FF"
><DIV
CLASS="NAVHEADER"
><TABLE
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TH
COLSPAN="3"
ALIGN="center"
>Securing and Optimizing Linux: RedHat Edition -A Hands on Guide</TH
></TR
><TR
><TD
WIDTH="10%"
ALIGN="left"
VALIGN="bottom"
><A
HREF="chap5sec55.html"
>Prev</A
></TD
><TD
WIDTH="80%"
ALIGN="center"
VALIGN="bottom"
>Chapter 5. General System Security</TD
><TD
WIDTH="10%"
ALIGN="right"
VALIGN="bottom"
><A
HREF="chap5sec57.html"
>Next</A
></TD
></TR
></TABLE
><HR
ALIGN="LEFT"
WIDTH="100%"></DIV
><DIV
CLASS="section"
><H1
CLASS="section"
><A
NAME="AEN4104"
>5.27. Enable TCP SYN Cookie Protection</A
></H1
><P
>&#13; A <SPAN
CLASS="acronym"
>SYN</SPAN
> Attack is a denial of service <SPAN
CLASS="acronym"
>DoS</SPAN
> attack that consumes all the resources on your machine, forcing you to reboot. Denial of service attacks -attacks which incapacitate a server due to high
traffic volume or ones that tie-up system resources enough that the server cannot respond to a legitimate connection request from a remote system) are easily achievable from internal resources
or external connections via extranets and Internet. To enable it, you have to do:
<DIV
CLASS="mediaobject"
><P
><IMG
SRC="images/Version6.1.gif"
ALT="Version 6.1.only"
></IMG
></P
></DIV
>
<TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
WIDTH="100%"
><TR
><TD
><PRE
CLASS="screen"
>&#13; [root@deep] /# echo 1 &#62; /proc/sys/net/ipv4/tcp_syncookies
</PRE
></TD
></TR
></TABLE
>
Add the above commands to the <TT
CLASS="filename"
>/etc/rc.d/rc.local</TT
> script file and you'll not have to type it again the next time you reboot your system.
</P
><P
>&#13; <DIV
CLASS="mediaobject"
><P
><IMG
SRC="images/Version6.2.gif"
ALT="Version 6.2 only"
></IMG
></P
></DIV
>
Edit the <TT
CLASS="filename"
>/etc/sysctl.conf</TT
> file and add the following line:
<TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
WIDTH="100%"
><TR
><TD
><PRE
CLASS="programlisting"
>&#13; # Enable TCP SYN Cookie Protection
net.ipv4.tcp_syncookies = 1
</PRE
></TD
></TR
></TABLE
>
You must restart your network for the change to take effect. The command to restart the network is the following:
<TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
WIDTH="100%"
><TR
><TD
><PRE
CLASS="screen"
>&#13; [root@deep] /# /etc/rc.d/init.d/network <B
CLASS="command"
>restart</B
>
Setting network parameters [ OK ]
Bringing up interface lo [ OK ]
Bringing up interface eth0 [ OK ]
Bringing up interface eth1 [ OK ]
</PRE
></TD
></TR
></TABLE
>
If you receive an error message during execution of the above command, check that you have enabled the <SPAN
CLASS="acronym"
>TCP</SPAN
> syncookies option in your kernel configuration:
<TT
CLASS="computeroutput"
>IP: TCP syncookie support</TT
> <EM
>not enabled per default</EM
> <B
CLASS="command"
>CONFIG_SYN_COOKIES</B
> <TT
CLASS="literal"
>Y/n/?</TT
>.
</P
></DIV
><DIV
CLASS="NAVFOOTER"
><HR
ALIGN="LEFT"
WIDTH="100%"><TABLE
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
><A
HREF="chap5sec55.html"
>Prev</A
></TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="index.html"
>Home</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
><A
HREF="chap5sec57.html"
>Next</A
></TD
></TR
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
>Routing Protocols</TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="gen-syssecured.html"
>Up</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
>Disable ICMP Redirect Acceptance</TD
></TR
></TABLE
></DIV
></BODY
></HTML
>