您的位置:首页 > 运维架构 > Linux

利用bastille配置安全的linux系统

2008-04-24 12:20 603 查看
作者:Linux Tux 来源:bbs.hackbase.com

今天试了一下bastille,bastille俗称城堡linux,是一个用来加固linux系统安全的软件。最大的优点就是以提问的方式完成一系列的安全设置,而且这个过程中并不需要你懂太多的linux知识。就可以得到一个安全的linux系统。
当然缺点还是有的,由于每个linux系统都会有很大的不同,bastille并不能适应所有的系统。还有由于是自动修改配置,这个过程一旦出现问题,查找起来会很困难。不如手工修改容易控制。

好现在我们开始具体的配置过程:

我是在我的ubuntu中实验的。开始安装
CODE:
sudo apt-get install acct perl-tk libgtk-perl
sudo apt-get install bastille
现在bastille已经装好了,如果你是其他的系统会有不同的安装方法。
我们来运行他,在终端输入
CODE:
InteractiveBastille
运行后Bastille会出现一些警告,警告现在运行的版本不适合在ubuntu下使用。我们先忽略,我会在文章的结尾讨论这个问题。

注意:Bastille要在root权限下运行。我们会看到Bastille图形界面,看下图。



大家会看到左面是需要配置的模块,配置完的会打上对号。右面有问题框,回答框。

我会把每个问题都列出来,然后写出我的回答,还有一些我的建议,希望对大家有帮助。我把每个问题简单的翻译一下(由于没找到译文,只能自力更生的),由于水平有限可能会出一些错误。有问题大家可以到http://bbs.hackbase.com/来讨论。

好了只要按ok按钮后,就开始具体的配置过程:

Would you like to set more restrictive permissions on the administration utilities? 选YES
为管理程序设置更多的限制。

Would you like to disable SUID status for mount/umount? 选YES
取消mount/umount的suid

一些建议:文件的SUID属性用于临时取得超级用户的权限运行程序,不过这个特性会造成一些安全问题。可以取消一些不需要的SUID

Would you like to disable SUID status for ping? 选YES
禁止ping的suid

一些建议:如果取消了一个命令的suid属性,那么普通用户就不能运行这个命令了.

Would you like to disable SUID status for at? 选YES
禁止at的suid

Would you like to disable SUID status for traceroute? 选YES
禁止traceroute的suid

Would you like to enforce password aging? 选YES
修改密码有限期限,改成180天。修改/etc/login.defs文件。

一些建议:系统默认一般是999999这个,就是几千年都不用修改密码。

Would you like to restrict the use of cron to administrative accounts 选YES
限制cron服务到管理权限。会创建/etc/cron.allow

Do you want to set the default umask? 选YES
修改默认umask值

一些建议:umask就是默认权限。系统默认一般是002或022,建议改成077。

What umask would you like to set for users on the system? 添077
定制umask值。

Should we disallow root login on all ttys? 选NO
不许root登录到全部的ttys,可以限制su成root。

Would you like to password-protect the GRUB prompt? 选YES
设置GRUB口令保护,可以防止恶意用户修改GRUB。

Enter GRUB password,please 添自己的密码
输入GRUB口令.

Would you like to disable CTRL-ALT-DELETE rebooting? 选YES
禁止使用CTRL-ALT-DELETE重启

Would you like to password protect single-user mode? 选YES
用密码保护单用户模式。

一些建议:有些系统的单用户模式不输入密码就可以进入,用密码保护起来可以防止恶意用户修改root密码。

Would you like to set a default-deny on TCP Wrappers and xinetd? 选NO
拒绝TCP Wrappers和inetd。

一些建议:这个设置不推荐在多用户环境中。

Should Bastille ensure the telnet service does not run on this system? 选YES
禁用telnet服务。

一些建议:telnet是不安全的,推荐选YES

Should Bastille ensure inetd's FTP service does not run on this system? 选YES
禁用FTP服务。

一些建议:同样的原因,推荐选YES

Would you like to display "Authorized Use" messages at log-in time? 选YES
显示指定用户的进入时间。

Who is responsible for granting authorization to use this machine? 添你的名字
就是添所有者,可以随便添。

一些建议:这个设置会在登录终端之前加一些警告文字。

Would you like to disable the gcc compiler? 选NO
禁止使用gcc编译器。

一些建议:如果经常用gcc,可以选择NO,如果是不需要编译程序的服务器,强烈建议禁用这项。

Would you like to put limits on system resource usage? 选YES
限制系统资源滥用,主要是编辑/etc/security/limits.conf

一些建议:就是限制普通用户占用内存,开很多线程的,也可以自己配置。

Should we restrict console access to a small group of user accounts? 选YES
限制用户在控制台登录。

一些建议:这个设置对个人电脑来说太严厉了些,可以根据自己的实际情况设置。

Which accounts should be able to login at console? 添root
设置一些可以在控制台登录的用户,可以添加多个用户,用空格隔开

Would you like to add additional logging? 选YES
添加额外的日志系统。

Do you have a remote logging host? 选NO
配置远程日志系统。

一些建议:如果选YES,bastille会帮你建一个远程的日志系统。

Would you like to set up process accounting? 选NO

一些建议:这个不清楚是做什么的,bastille推荐是选NO。

Would you like to disable printing 选YES
禁用打印服务,我没有打印机所以选YES。

Would you like to install TMPDIR/TMP scripts? 选YES
建立一个比/tmp更安全的环境。

一些建议:由于很多得到root的入侵都是在/tmp发掘的漏洞。所以多用户环境推荐YES。

Would you like to run the packet filtering script? 选YES
利用iptables帮你建立一个小型的防火墙.

Do you need the advanced networking options? 选NO
高级的网络配置。

一些建议:如果是个人计算机就选NO,如果是服务器就选YES。我这里选NO

下面是一些网络规则:

DNS Servers: 保持默认
Public interfaces: 保持默认
TCP services to audit: 保持默认
UDP services to audit: 保持默认
ICMP services to audit: 保持默认
TCP service names or port numbers to allow on public interfaces: 保持默认
UDP service names or port numbers to allow on public interfaces: 保持默认

Force passive mode? 选YES
强制成被动模式,和FTP有关。

TCP services to block: 保持默认
UDP services to block: 保持默认
ICMP allowed types: 保持默认

Enable source address verification? 选YES
启用源地址确认。

一些建议:防IP地址欺骗用的,建议选YES

Reject method: 保持默认
Interfaces for DHCP queries: 保持默认
NTP servers to query: 保持默认
ICMP types to disallow outbound: 保持默认

Should Bastille run the firewall and enable it at boot time? 选YES
运行bastille-firewall。配置文件/etc/Bastille/bastille-firewall.cfg

Are you finished making changes to your Bastille configuration? 选YES
把所有改变保存到Bastille配置文件。如果检查没问题了,就选YES吧!

全部配置完成后会重启计算机。

重启之后就会看到效果了,由于Bastille启动的时候出现过警告。看来对ubuntu支持不是很好,可能会出现一些问题,所以建议大家不要在自己的 ubuntu中实验。不过Bastille对Redhat,Fedora或Mandriva等系统的支持都很好,有这些系统的朋友可以试试。
还有每种linux系统的默认配置都不同,机器的用途也不同。所以本文的选择仅供参考。大家要根据自己的实际需要来配置Bastille选项。

---------------Linux Tux
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: