Fedoracore2 server platform security settings secrets 1

Source: Internet
Author: User
Article Title: Fedoracore2 server platform security settings secrets 1. 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.
   Preface
  
I have long wanted to write an article on Linux security settings. One advantage of writing an article is that you can understand your own ideas, and you will be able to remember it if you forget to write an article later. This article is just some of my experiences in my daily work and study. If something is wrong, I hope you can correct it.
  
   1. Set the startup Service
  
After installing the system, run # netstat? You can see that many network-related services are started by default, so many ports are opened for LISTENING ). We know that the more open ports, the more likely the system will be infiltrated from the outside, so we should try to close some unnecessary startup services to close the ports as much as possible, provides system security.
  
Here I will directly provide the startup service to keep the system running normally, and other services can be closed. Run # ntsysv to start only the following services.
  
   Ii. Netfilter/iptables firewall settings
  
# Touch/etc/rc. d/firewall
# Chmod u + x/etc/rc. d/firewall
# Vi/etc/rc. d/rc. local
Write a row:/etc/rc. d/firewall
Note: The content of/etc/rc. d/firewall is as follows:
  
1. Single Nic host settings
  
Note: This setting applies to setting up a host dedicated to providing web services or FTP services.
  
# First clear all firewall rules
#! /Bin/bash
PATH =/sbin:/bin:/usr/sbin:/usr/bin
# Prevent syn flood attacks
Echo "1">/proc/sys/net/ipv4/tcp_syncookies
  
Iptables-F
Iptables-X
Iptables? Z
# Disable all packages
Iptables-P INPUT DROP
Iptables-P OUTPUT DROP
Iptables-P FORWARD DROP
# Allow communication on local loopback Devices
Iptables? A input-I lo-p all-j ACCEPT
Iptables-a output-o lo-p all-j ACCEPT
# Let response packets that have been established or related to our host pass through
Iptables-a input-p tcp-m state -- state ESTABLISHED, RELATED-j ACCEPT
# Allow SSH remote host Management
Iptables-a input-p tcp -- dport 22-j ACCEPT
Iptables-a output-p tcp -- sport 22-j ACCEPT
# Limit the number of IP fragmentation to prevent IP fragmentation attacks
Iptables-a input-f-m limit -- limit 100/s -- limit-burst 100-j ACCEPT
  
# If your host provides web Services, open port 80.
Iptables-a input-p tcp-m tcp -- sport 80-j ACCEPT
Iptables-a output-p tcp-m tcp -- dport 80-j ACCEPT
  
# Set the icmp protocol to allow the host to perform the ping operation to test the network, but other hosts are not allowed to ping the host.
Iptables? A output-p icmp -- icmp-type echo-request? J ACCEPT
Iptables? A input? P icmp -- icmp-type echo-reply? J ACCEPT
  
With the above settings, this host only opens ports and 80 to the network, ensuring the maximum security of the host.
  
2. NAT host settings
  
Note: This setting applies to hosts of the NAT Gateway server type. Eth0 is an Internet Nic, and eth1 is an intranet Nic. The Intranet CIDR block is 192.168.1.0/24.

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.