ApacheforUNIXBSDLinux attack prevention

Source: Internet
Author: User
ApacheforUNIXBSDLinux attack prevention-Linux Enterprise Application-Linux server application information. For details, refer to the following section. Check if this is helpful to you.

A. ibm aix 4.3.X
B. Sun Solaris 7
C. Compaq Tru64 UNIX 5.X
D. HP HP-UX 11.0 (research ongoing)
E. Linux kernel 2.2 (tested both SuSE Linux 7.0 and RedHat 7.0)
F. FreeBSD
G. IRIX 6.5.10

Some adjustment parameters and syntaxes described below will not be automatically activated after restart, so if you need to keep these parameters for a long time at each start, you need to add these real-time commands to the following Startup file:

AIX-/etc/rc.net
Solaris-/etc/init. d/inetinit
Tru64 UNIX-use sysconfigdb or dxkerneltuner command
HP-UX --/etc/rc. config. d/nddconf
Linux kernel 2.2-/etc/sysctl. conf
FreeBSD-/etc/rc. conf
IRIX-use the fortune command

========================================================== ==================================
The following are some suggestions for adjusting the IP stack:

1. Adjust the TCP sending and receiving spaces (TCP send and receive spaces)

The space for TCP sending and receiving directly affects the TCP window size parameter (TCP window size parameter). To a certain extent, increasing the window size helps more effective transmission, in particular, some services that require a large amount of transmission, such as FTP and HTTP, are not optimized by default. Generally, we need to increase the window size to 32768 bytes. Unless you have a clear understanding of RFC1323 (http://www.ietf.org/rfc/rfc1323.txt? Number = 1323) and RFC2018 (http://www.ietf.org/rfc/rfc2018.txt? Number = 2018). Otherwise, do not increase the value to a value greater than 64 KB.

A. AIX
/Usr/sbin/no-o tcp_sendspace = 32768
/Usr/sbin/no-o tcp_recvspace = 32768

B. Solaris
/Usr/sbin/ndd-set/dev/tcp tcp_xmit_hiwat 32768
/Usr/sbin/ndd-set/dev/tcp tcp_recv_hiwat 32768

C. Tru64 UNIX
No recommended adjustments.

D. HP-UX
By default, the TCP sending and receiving space is set to 32768.

E. Linux kernel 2.2
Linux automatically allocates TCP sending and receiving spaces and supports RFC1323 (large window support, net. ipv4.tcp _ window_scaling) and RFC2018 (SACK support, net. ipv4.tcp _ sack) by default ).

F. FreeBSD
Sysctl-w net. inet. tcp. sendspace = 32768
Sysctl-w net. inet. tcp. recvspace = 32768

G. IRIX
By default, the TCP sending and receiving space is set to 64 KB.

2. Adjust the set of interface sequence to prevent SYN Attacks

Generally, one or several ports of various network application software must be opened for external use. Therefore, it must be able to be attacked by malicious attackers by these ports, one of the most popular attacks is SYNFLOOD. When an attack occurs, the source IP address of the client is forged (spoofed). The current IP routing mechanism only checks the target IP address and forwards it, after the IP packet arrives at the destination host, the return path cannot be obtained through the route, so the destination host cannot establish a connection through TCP three-way handshake. During this period, new connection requests are rejected because the TCP interface cache queue is quickly filled up. To prevent these attacks, some UNIX variants connect to the Request queue using a set of interfaces separated from the inbound. A queue opens a set of interfaces for half (SYN receiving, SYN | ACK sending ), the other queue waits for an accept () call as an excuse to fully open the set. Adding these two queues can mitigate these syn flood attacks and minimize the impact on the server:

A. AIX
/Usr/sbin/no-o clean_partial_conns = 1
This setting indicates that the kernel randomly removes the half-open interface from the q0 queue to increase the required space for the new interface.

B. Solaris
/Usr/sbin/ndd-set/dev/tcp tcp_conn_req_max_q 1024
Enable the q queue to have an interface waiting for the accept () call from the application.
/Usr/sbin/ndd-set/dev/tcp tcp_conn_req_max_q0 2048
Enable the q0 queue to maintain a half-open interface.

C. Tru64 UNIX
/Sbin/sysconfig-r socket sominconn = 65535
The sominconn value determines how many identical SYN packets can be processed simultaneously.
/Sbin/sysconfig-r socket somaxconn = 65535
The somaxconn value sets the number of TCP connections to be retained by the system.

D. HP-UX
/Usr/sbin/ndd-set tcp_syn_rcvd_max 1024
/Usr/sbin/ndd-set tcp_conn_request_max 200

E. Linux kernel 2.2
/Sbin/sysctl-w net. ipv4.tcp _ max_syn_backlog = 1280
Effectively increase the size of the Set interface queue for q0.
/Sbin/sysctl-w net. ipv4.tcp _ syn_cookies = 1
Enabling tcp syn cookies can effectively reduce syn flood attacks, but this parameter may cause some performance problems for some large windows (see RFC1323 and RFC2018.

F. FreeBSD
Sysctl-w kern. ipc. somaxconn = 1024

G. IRIX
The listen () queue is hard set to 32. However, the number of connections to be processed is (3 * backlog)/2) + 1, and the maximum value of backlog is 49.

3. Adjust Redirects parameters.

Malicious users can use IP redirection to modify the route table in the remote host. In a well-designed network, the redirection settings at the end are not required, and the redirection packet sending and receiving must be disabled.

A. AIX
/Usr/sbin/no-o ipignoreredirects = 1
/Usr/sbin/no-o ipsendredirects = 0

B. Solaris
/Usr/sbin/ndd-set/dev/ip ip_ignore_redirect 1
/Usr/sbin/ndd-set/dev/ip ip_send_redirects 0

C. Tru64 UNIX
No recommended adjustment settings.

D. HP-UX
/Usr/sbin/ndd-set/dev/ip ip_send_redirects 0

E. Linux kernel 2.2
/Sbin/sysctl-w net. ipv4.conf. all. send_redirects = 0
/Sbin/sysctl-w net. ipv4.conf. all. accept_redirects = 0

F. FreeBSD
Sysctl-w net. inet. icmp. drop_redirect = 1
Sysctl-w net. inet. icmp. log_redirect = 1
Sysctl-w net. inet. ip. redirect = 0
Sysctl-w net. inet6.ip6. redirect = 0

G. IRIX
/Usr/sbin/systune icmp_dropredirects to 1

4. Adjust ARP cleaning settings

Adding forged ARP entries to the IP routing buffer can cause resource depletion and performance reduction attacks by malicious users. In Solaris, there are two parameters that can manage the interval to clean up IP Route buffering. For unrequested ARP responses, arp_cleanup_interval can be used, and AIX can be set through artp_killc.

A. AIX
/Usr/sbin/no-o arpt_killc = 20
B. Solaris
/Usr/sbin/ndd-set/dev/arp arp_cleanup_interval 60000
C. Tru64 UNIX
No reference settings.
D. HP-UX
The default value is 5 minutes.
E. Linux kernel 2.2
No reference settings.
F. FreeBSD
Sysctl-w net. link. ether. inet. max_age = 1200
G. IRIX
No reference settings.

5. Adjust the source route settings

Through source routing, attackers can try to reach the internal IP address, including the address in RFC1918. Therefore, they cannot accept the source route information package to prevent your internal network from being detected.

A. AIX
/Usr/sbin/no-o ipsrcroutesend = 0
Disable source route information package sending.

/Usr/sbin/no-o ipsrcrouteforward = 0
This parameter is very important if you want the system to perform routing work such as firewall. Disabling this feature can effectively prevent the conversion from source routing information packets.

B. Solaris
/Usr/sbin/ndd-set/dev/ip ip_src_route_forward 0
This parameter is very important if you want the system to perform routing work such as firewall. Disabling this feature can effectively prevent the conversion from source routing information packets.

C. Tru64 UNIX
No recommended adjustments.

D. HP-UX
Ndd-set/dev/ip ip_forward_src_routed 0
Disabling this feature can effectively prevent the conversion from source routing information packets.

E. Linux kernel 2.2
/Sbin/sysctl-w net. ipv4.conf. all. accept_source_route = 0
Discard all source address packages.
/Sbin/sysctl-w net. ipv4.conf. all. forwarding = 0
/Sbin/sysctl-w net. ipv4.conf. all. mc_forwarding = 0
Route frame without conversion source.

F. FreeBSD
Sysctl-w net. inet. ip. sourceroute = 0
Sysctl-w net. inet. ip. accept_sourceroute = 0

G. IRIX
/Usr/sbin/systune ipforward to 2

6. Adjust TIME_WAIT setting settings

On some busy WEB servers, many sets of interfaces may be in the TIME_WAIT status, which is caused by the fact that some client applications with irregular encoding do not properly process the set of interfaces, this may cause DDOS attacks.

A. AIX
No Recommended settings.

B. Solaris
/Usr/sbin/ndd-set/dev/tcp tcp_time_wait_interval 60000

This parameter affects the number of times the TCP interface maintains the TIME_WAIT status. By default, a busy WEB server is too high, so it must be set to lower than every 60 seconds, this parameter name is applicable to Solaris7 or later versions. In versions earlier than Solaris 7, the table with incorrect names is tcp_close_wait_interval.

C. Tru64 UNIX
No recommended adjustment settings.

D. HP-UX
Ndd-set/dev/tcp tcp_time_wait_interval 60000
The set of interfaces will remain in the TIME_WAIT status for no more than 60 seconds.

E. Linux kernel 2.2
/Sbin/sysctl-w net. ipv4.vs. timeout_timewait = 60
The set of interfaces will remain in the TIME_WAIT status for no more than 60 seconds.

F. FreeBSD
No recommended adjustment settings.

G. IRIX
/Usr/sbin/une tcp_2msl to 60

7. Adjust the broadcast ECHO response

The Smurf attack is a counterfeit address that sends ICMP 8 0 (echo request) information to a broadcast address. Some IP stack will respond to this information by default, so this feature must be disabled. If the host is used as a firewall, disabling this feature cannot process broadcasts.

A. AIX
/Usr/sbin/no-o directed_broadcast = 0
Direct Broadcast is not responded.

B. Solaris
/Usr/sbin/ndd-set/dev/ip ip_respond_to_echo_broadcast 0
Direct Broadcast is not responded.
/Usr/sbin/ndd-set/dev/ip ip_forward_directed_broadcasts 0
Direct Broadcast is not forwarded.

C. Tru64 UNIX
No adjustment settings are recommended.

D. HP-UX
Ndd-set/dev/ip ip_respond_to_echo_broadcast 0
Direct Broadcast is not responded.
Ndd-set/dev/ip ip_forward_directed_broadcasts 0
Direct Broadcast is not forwarded.

E. Linux kernel 2.2
/Sbin/sysctl-w net. ipv4.icmp _ echo_ignore_broadcasts = 1
Direct Broadcast is not responded.

F. FreeBSD
Sysctl-w net. inet. icmp. bmcastecho = 0

G. IRIX
/Usr/sbin/systune allow_brdaddr_srcaddr to 0

8. Adjustments to other broadcast probes

The other two Broadcast probes can be used by malicious users. One is the address mask query, which can be used to detect the network segment size and range. Timestamp broadcast can map and authenticate host types.

A. AIX
/Usr/sbin/no-o icmpaddressmask = 0
Prevent address masking queries.

B. Solaris
/Usr/sbin/ndd-set/dev/ip ip_respond_to_address_mask_broadcast 0
Prevent address masking queries.

/Usr/sbin/ndd-set/dev/ip ip_respond_to_timestamp_broadcast 0
Disable the response to the time stamp broadcast query.

C. Tru64 UNIX
No recommended adjustments.

D. HP-UX
Ndd-set/dev/ip ip_respond_to_address_mask_broadcast 0
Prevents leakage of the network mask configured by the host.

Ndd-set/dev/ip ip_respond_to_timestamp_broadcast 0
Disable the response to the time stamp broadcast query.

E. Linux kernel 2.2
No recommended adjustments.

F. FreeBSD
Sysctl-w net. inet. icmp. maskrepl = 0

G. IRIX
Use ipfilterd to block unwanted ICMP types.

9. Adjust parameters to support RFC1948

The following adjustments will use RFC1948
TCP/IP serial number generation technology to ensure that the serial number for a TCP set of interfaces is difficult to guess:

B. Solaris
Set TCP_STRONG_ISS = 2 in/etc/default/inetinit.
This requires a restart to enable.

G. IRIX
/Usr/sbin/une tcpiss_md5 to 1

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.