使用SOLARIS的初步设置( 二 )


# ssh-keygen -t rsa1 -f /usr/local/etc/ssh_host_key -N ""
# ssh-keygen -t dsa -f /usr/local/etc/ssh_host_dsa_key -N ""
# ssh-keygen -t rsa -f /usr/local/etc/ssh_host_rsa_key -N ""
# vi /etc/init.d/sshd
===========================sshd============================
#!/sbin/sh
#
# Copyright (c) 2004 by llzqq
# All rights reserved.
# mail: llzqq@126.com
#ident "@(#)sshd 1.1 01/09/24 SMI"

case "$1" in
start)
/usr/local/sbin/sshd

stop)
pkill sshd

*)
echo "Usage: $0 { start | stop }"
exit 1

esac
exit 0
===========================sshd============================
# chmod 750 /etc/init.d/sshd
# chown root:sys /etc/init.d/sshd
# ln –s /etc/init.d/sshd /etc/rc2.d/S98sshd
# vi /etc/hosts.deny
sshd:ALL
# vi /etc/hosts.allow
sshd:192.168.0.15
# rm /.ssh/*

8.安装SAMBA-3

# cp /etc/rc3.d/S90samba bak.S90samba
# pkgrm SUNWsmbac SUNWsmbar SUNWsmbau
# gzip -d samba-3.0.2a-sol9-intel-local.gz
# gzip -d popt-1.7-sol9-intel-local.gz
# pkgadd -d popt-1.7-sol9-intel-local
# pkgadd -d samba-3.0.2a-sol9-intel-local
# cd /usr/local/samba/doc/samba/examples/
# cp smb.conf.default /usr/local/samba/lib/smb.conf
# 设置smb.conf文件过程略
# mv /etc/rc3.d/bak.S90samba S90samba
# chown root:sys /etc/rc3.d/S90samba
# vim /etc/rc3.d/S90samba
=======================S90samba========================
#!/sbin/sh
#
# Copyright (c) 2004 by llzqq
# All rights reserved.
# mail: llzqq@126.com
#ident "@(#)samba 1.1 01/09/24 SMI"

case "$1" in
start)
[ -f /usr/local/samba/lib/smb.conf ] || exit 0

/usr/local/samba/sbin/smbd -D
/usr/local/samba/sbin/nmbd -D

stop)
pkill smbd
pkill nmbd

*)
echo "Usage: $0 { start | stop }"
exit 1

esac
exit 0
=======================S90samba========================

9.初步的系统安全设置

为安全起见在/etc/inetd.conf中注释掉除下列服务的所有服务

ftp
echo
echo
discard
discard
rstatd/2-4
fs
100083/1

在只需要不多图形操作的服务器或是要保证相当的安全,你也许应该关掉字体服务fs,也可以关掉系统性能监视器rstatd和tooltalk服务器ttdbserverd(100083/1),查找剩下需要关闭的端口的进程用这个命令:
# /usr/local/bin/lsof -i | grep port

为安全起见在防止堆栈溢出

# cp /etc/system /etc/system.BACKUP
# vi /etc/system
在文件的最后,加上以下两行:
set noexec_user_stack=1
set noexec_user_stack_log=1

禁用自动启动DESKTOP

# /usr/dt/bin/dtconfig –d

为安全起见停掉几个系统服务:

卸载SENDMAIL:
# pkgrm SUNWsndmr SUNWsndmu
卸载TELNET:
# pkgrm SUNWtnetc SUNWtnetd SUNWtnetr
# cd /etc/rc2.d
# mv S71ldap.clIEnt _S71ldap.client
# mv S72inetsvc _S72inetsvc
# mv S74autofs _S74autofs
# mv S74xntpd _S74xntpd
# mv S80lp _S80lp
# mv S71rpc _S71rpc
# mv S73nfs.client _S73nfs.client

# cd /etc/rc3.d
# mv S34dhcp _S34dhcp
# mv S15nfs.server _S15nfs.server
# mv S76snmpdx _S76snmpdx

卸载PCMCIA支持:
# pkgrm SUNWpcelx SUNWpcmci SUNWpcmcu SUNWpcmem SUNWpcser SUNWPSdpr

安装PORT扫描工具NMAP

# gzip -d nmap-3.50-sol9-intel-local.gz
# gzip -d pcre-4.5-sol9-intel-local.gz
# pkgadd -d nmap-3.50-sol9-intel-local
# pkgadd -d pcre-4.5-sol9-intel-local
扫描本机端口:
# nmap -P0 -sT localhost

安装网络漏洞扫描工具NESSUS:

# gzip -d nessus-2.0.9-sol9-intel-local.gz
# pkgadd -d nessus-2.0.9-sol9-intel-local
建立SSL证书:
# nessus-mkcert
添加NESSUS用户:
# nessus-adduser
以ROOT启动NESSUS服务器:
# nessus –D
启动NESSUS的GUI客户端:
# nessus

推荐阅读