CentOS4.4 and the most common and effective security settings in Linux

Source: Internet
Author: User
Article Title: CentOS4.4 and the most common and effective security settings in Linux. Linux is a technology channel of the IT lab in China. Includes basic categories such as desktop applications, Linux system management, kernel research, embedded systems, and open source.

For CentOS or Red Had Enterprise Linux 4, you must first enable SElinux by modifying selinux = "" in the/etc/SELINUX/config file to enforcing. It ensures that your system will not crash abnormally. Some people think it should be disabled. I strongly do not recommend it. Of course, it is just to use centos for play. It doesn't matter if it is not used for actual servers.

2. Enabling the iptables firewall has many benefits for increasing system security. Set firewall rules.

3. execute setup to close services that are not needed. Remember to open less services, which is less risky.

4. Disable the Control-Alt-Delete command on the keyboard.
Comment out the following line in the "/etc/inittab" file (use #):
Ca: ctrlaltdel:/sbin/shutdown-t3-r now
Changed:
# Ca: ctrlaltdel:/sbin/shutdown-t3-r now
To make this change take effect, enter the following command:
#/Sbin/init q

5. Set permissions for the script file under "/etc/rc. d/init. d ".
Set permissions for script files of programs executed during execution or shutdown.
# Chmod-R 700/etc/rc. d/init. d /*
This indicates that only the root user can read, write, and execute script files in this directory.

6. Modify the "/etc/host. conf" File
"/Etc/host. conf" describes how to resolve the address. Edit the "/etc/host. conf" file (vi/etc/host. conf) and add the following line:
# Lookup names via DNS first then fall back to/etc/hosts.
Order bind, hosts
# We have machines with multiple IP addresses.
Multi on
# Check for IP address spoofing.
Nospoof on
The first setting first resolves the IP address through DNS and then the hosts file. The second setting checks whether the host in the "/etc/hosts" file has multiple IP addresses (for example, multiple Ethernet interfaces ). The third setting indicates that you should pay attention to unauthorized electronic spoofing on the local machine.

7. Make the "/etc/services" file immune
Make the "/etc/services" file immune to prevent unauthorized deletion or addition of services:
# Chattr + I/etc/services

8. Prevent your system from responding to any external/internal ping requests.
Since no one can ping your machine and receive a response, you can greatly enhance the security of your site. You can add the following command to/etc/rc. d/rc. local to run automatically after each startup.
Echo 1>/proc/sys/net/ipv4/icmp_echo_ignore_all

9. Setting resource limits for all users on your system can prevent DoS attacks (denial of service attacks)
Such as the maximum number of processes and the number of memories. For example, the following restrictions apply to all users:
Vi/etc/security/limits. conf

In the following code example, each session of all users is limited to 10 MB, and four logins are allowed at the same time. The third line disables the kernel dump for everyone. The fourth row removes all bin restrictions. Ftp allows 10 concurrent sessions (especially for anonymous ftp accounts); the number of processes in the managers Group is limited to 40. Developers has a 64 MB memlock limit. wwwusers members cannot create files larger than 50 MB.

Listing 3. Setting quotas and limits

* Hard rss 10000
* Hard maxlogins 4
* Hard core 0
Bin-
Ftp hard maxlogins 10
@ Managers hard nproc 40
@ Developers hard memlock 64000
@ Wwwusers hard fsize 50000

To activate these limits, add the following line at the bottom of/etc/pam. d/login: session required/lib/security/pam_limits.so.

[1] [2] Next page

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.