Chinaunix首页 | 论坛 | 博客
  • 博客访问: 86488
  • 博文数量: 10
  • 博客积分: 1410
  • 博客等级: 上尉
  • 技术积分: 220
  • 用 户 组: 普通用户
  • 注册时间: 2008-02-18 18:17
文章分类

全部博文(10)

文章存档

2011年(2)

2010年(8)

我的朋友

分类: LINUX

2011-03-14 15:14:03

1.iptables
  最基础的配置
   #cat iptables.sh
   #!/bin/sh
     WHITELIST=/root/shell/whitelist.txt
     ALLOWED="53"
     IFNET="eth1"
     /sbin/iptables -F
     /sbin/iptables -A INPUT -p icmp --icmp-type any -j ACCEPT
     for port in $ALLOWED; do
     echo "Accepting port $port..."
     /sbin/iptables -A INPUT -p tcp --dport $port -j ACCEPT
     /sbin/iptables -A INPUT -p tcp --sport $port -j ACCEPT
     done
     for x in `grep -v ^# $WHITELIST | awk '{print $1}'`; do
      echo "Permitting $x..."
     /sbin/iptables -A INPUT -s $x -j ACCEPT
     done
     /sbin/iptables -A INPUT -p tcp --dport  53 -j ACCEPT
     /sbin/iptables -A OUTPUT -p tcp --sport 53 -j ACCEPT
     /sbin/iptables -A INPUT -p udp --dport 53 -j ACCEPT
     /sbin/iptables -A OUTPUT -p udp --sport 53 -j ACCEPT
     /sbin/iptables -A INPUT -i $IFNET -j DROP
     ####################################
     # cat whitelist.txt
      127.0.0.0/24
      192.168.1.0/24
2.ssh 端口
     1.更改端口号 Port 22222
     2,建立普通用户
     3,禁止root直接登陆 PermitRootLogin no
3.denyhosts 配置
     1.配置文件位置在 /usr/share/denyhosts/denyhosts.cfg
     2.相关文件  /etc/hosts.deny       /etc/hosts.allow
4.关闭没有的系统服务
阅读(424) | 评论(1) | 转发(0) |
给主人留下些什么吧!~~

chinaunix网友2011-03-27 16:00:53

很好的, 收藏了 推荐一个博客,提供很多免费软件编程电子书下载: http://free-ebooks.appspot.com