suse linux作業系統安全加強(服務關閉)
Suse Linux 作業系統安裝完成以後,需要安全掃描,把沒有使用的端口關閉,加強作業系統的安全
一、系統預設啟動服務:
shelly:/etc/init.d # nmap -P0 127.0.0.1
Starting Nmap 4.00 ( [url]http://www.insecure.org/nmap/[/url] ) at 2007-06-25 15:34 CST
Interesting ports on localhost (127.0.0.1):
(The 1666 ports scanned but not shown below are in state: closed)
PORT STATE SERVICE
22/tcp open ssh
25/tcp open smtp
111/tcp open rpcbind
427/tcp open svrloc
631/tcp open ipp
Nmap finished: 1 IP address (1 host up) scanned in 0.244 seconds
shelly:/etc/init.d #
二、臨時關閉服務方法:
1、 檢視服務和端口關聯關系:
比如檢視ipp服務的關聯程序:#lsof |grep ipp
2、 确認服務和端口的關聯關系:
序列 端口 服務 路徑/etc/init.d 狀态
1) 22 ssh sshd 保留
2) 25 smtp postfix 關閉
3) 111 rpc portmap 關閉
4) 427 svrloc slpd 關閉
5) 631 ipp cupsd 關閉
3、 手動關閉方法:
停止smtp:/etc/init.d/postfix stop
停止rpc:/etc/init.d/portmap stop
停止svrloc:/etc/init.d/slpd stop
停止ipp:/etc/init.d/cupsd stop
三、 永久關閉方法:
手動關閉以後每次系統啟動,服務還會自己啟動,需要從啟動配置檔案永久禁止:
使用chkconfig –l指令檢視現在系統的自動加載服務:(隻截取相關的一部分服務)
shelly:/etc/init.d # chkconfig -l |grep on
cron 0:off 1:off 2:on 3:on 4:off 5:on 6:off
cups 0:off 1:off 2:on 3:on 4:off 5:on 6:off
nfs 0:off 1:off 2:off 3:on 4:off 5:on 6:off
nfsboot 0:off 1:off 2:off 3:on 4:off 5:on 6:off
novell-zmd 0:off 1:off 2:off 3:on 4:on 5:on 6:off
nscd 0:off 1:off 2:off 3:on 4:off 5:on 6:off
portmap 0:off 1:off 2:off 3:on 4:off 5:on 6:off
postfix 0:off 1:off 2:off 3:on 4:off 5:on 6:off
powersaved 0:off 1:off 2:on 3:on 4:off 5:on 6:off
random 0:off 1:off 2:on 3:on 4:off 5:on 6:off
resmgr 0:off 1:off 2:on 3:on 4:off 5:on 6:off
slpd 0:off 1:off 2:off 3:on 4:off 5:on 6:off
shelly:/etc/init.d #
關閉方法:
shelly:/etc/init.d # chkconfig -s cups off
shelly:/etc/init.d # chkconfig -s nfs off
shelly:/etc/init.d # chkconfig -s nfsboot off
shelly:/etc/init.d # chkconfig -s portmap off
shelly:/etc/init.d # shelly:/etc/init.d # chkconfig -s postfix off
shelly:/etc/init.d # chkconfig -s slpd off
備注:永久關閉portmap和nfs有關聯,必須先關閉nfs和nfsboot程序,否則會有如下報錯。
shelly:/etc/init.d # chkconfig -s portmap off
insserv: Service portmap has to be enabled for service nfs
insserv: Service portmap has to be enabled for service nfsboot
insserv: exiting now!
/sbin/insserv failed, exit code 1
支援停止順序:
shelly:/etc/init.d # chkconfig -s nfs off
shelly:/etc/init.d # chkconfig -s nfsboot off
shelly:/etc/init.d # chkconfig -s portmap off
shelly:/etc/init.d #
四、 掃描系統:
重新啟動系統,掃描系統端口
shelly:/etc/init.d # nmap -P0 127.0.0.1
Starting Nmap 4.00 ( [url]http://www.insecure.org/nmap/[/url] ) at 2007-06-25 16:16 CST
Interesting ports on localhost (127.0.0.1):
(The 1670 ports scanned but not shown below are in state: closed)
PORT STATE SERVICE
22/tcp open ssh
Nmap finished: 1 IP address (1 host up) scanned in 0.213 seconds
shelly:/etc/init.d #