6.2 OPENBSD安全设置
屏蔽登陆时的系统信息
# > /etc/motd
# vi /etc/rc //这里注释掉了MOTD相关的行
============================== rc ===========================
# patch /etc/motd
#if [ ! -f /etc/motd ]; then
# install -c -o root -g wheel -m 664 /dev/null /etc/motd
#fi
#T=`mktemp /tmp/_motd.XXXXXXXXXX`
#if [ $? -eq 0 ]; then
# sysctl -n kern.version | sed 1q > $T
# echo "" >> $T
# sed ''1,/^$/d'' < /etc/motd >> $T
# cmp -s $T /etc/motd || cp $T /etc/motd
# rm -f $T
#fi
============================== rc ===========================
停用SENDMAIL
# vi /etc/rc.conf
sendmail_flags=NO
修改计划任务
# vi /etc/daily
找到下面代码
===========+===========+===========+============
sh /etc/security 2>;&1 >; $OUT
if [ -s $OUT ]; then
mail -s "$host daily insecurity output" root < $OUT
fi
===========+===========+===========+============
修改如下
===========+===========+===========+============
sh /etc/security 2>;&1 >; $OUT.TMP
if [ -s $OUT.TMP ]; then
echo "$host daily insecurity output" >; $OUT
cat $OUT.TMP >;>; $OUT
rm $OUT.TMP
/usr/libexec/mail.local root >; $OUT
fi
===========+===========+===========+============
# crontab –e
将下面三行:
===========+===========+===========+============
30 1 * * * /bin/sh /etc/daily 2>;&1 | tee /var/log/daily.out | mail - s "`/bin/hostname` daily output" root
30 3 * * 6 /bin/sh /etc/weekly 2>;&1 | tee /var/log/weekly.out | mail -s "`/bin/hostname` weekly output" root
30 5 1 * * /bin/sh /etc/monthly 2>;&1 | tee /var/log/monthly.out | mail -s "`/bin/hostname` monthly output" root
===========+===========+===========+============
修改如下:
===========+===========+===========+============
30 1 * * * /bin/sh /etc/daily 2>;&1 | tee /var/log/daily.out | /usr/libexec/mail.local root
30 3 * * 6 /bin/sh /etc/weekly 2>;&1 | tee /var/log/weekly.out | /usr/libexec/mail.local root
30 5 1 * * /bin/sh /etc/monthly 2>;&1 | tee /var/log/monthly.out | /usr/libexec/mail.local root
===========+===========+===========+============
禁用由inetd启动的程序
# vi /etc/sysctl.conf
inetd=NO
禁止一般用户查看系统日志
# chmod g-w,o-r /var/log/*
为了防止cracker利用rootkit工具通过后门进入系统。对/bin,/sbin进行安全保护
# chflags schg /bin/*
# chflags schg /sbin/*
把系统的核心的运行层次设置为最安全的层次
# sysctl -w kern.securelevel=2
相关文章