linux系统安全详解.docx

上传人:b****3 文档编号:4618074 上传时间:2023-05-07 格式:DOCX 页数:14 大小:24.50KB
下载 相关 举报
linux系统安全详解.docx_第1页
第1页 / 共14页
linux系统安全详解.docx_第2页
第2页 / 共14页
linux系统安全详解.docx_第3页
第3页 / 共14页
linux系统安全详解.docx_第4页
第4页 / 共14页
linux系统安全详解.docx_第5页
第5页 / 共14页
linux系统安全详解.docx_第6页
第6页 / 共14页
linux系统安全详解.docx_第7页
第7页 / 共14页
linux系统安全详解.docx_第8页
第8页 / 共14页
linux系统安全详解.docx_第9页
第9页 / 共14页
linux系统安全详解.docx_第10页
第10页 / 共14页
linux系统安全详解.docx_第11页
第11页 / 共14页
linux系统安全详解.docx_第12页
第12页 / 共14页
linux系统安全详解.docx_第13页
第13页 / 共14页
linux系统安全详解.docx_第14页
第14页 / 共14页
亲,该文档总共14页,全部预览完了,如果喜欢就下载吧!
下载资源
资源描述

linux系统安全详解.docx

《linux系统安全详解.docx》由会员分享,可在线阅读,更多相关《linux系统安全详解.docx(14页珍藏版)》请在冰点文库上搜索。

linux系统安全详解.docx

linux系统安全详解

linux系统安全详解

一,BIOS安全(硬件上的安全)

1,最基本最简单的安全配置,保障计算机硬件配置等不被别人更改.给BIOS设置密码,防止改变启动顺序从软盘或

光盘启动.防止特殊的启动盘启动用户的系统,进入rescue或其他模式.改变或删除当前配置等.每一个细心的网

管每个细节都不应该忽视!

2,禁止使用contral+alt+delete重起机器

编辑/etc/inittab文件,注释掉下面一行.

ca:

:

ctrlaltdel:

/sbin/shutdown-t3-rnow

该成:

(使用#)

#ca:

:

ctrlaltdel:

/sbin/shutdown-t3-rnow

 

二,帐号安全

口令,系统的第一道防线,目前大多数数攻击都是截获口令或猜测口令等口令攻击开始的.

/etc目录下主要存放系统的配置文件.我们要对这个目录下的好多文件进行修改.

1,/etc/login.defs文件是login程序的配置文件.口令的长度和口令的有效期等可以在这里设置.

[root@tp~]#vi/etc/login.defs

...

PASS_MAX_DAYS  9999 密码被用最多天数

PASS_MIN_DAYS  0    密码被用最少天数

PASS_MIN_LEN   5    系统默认密码长度5,我们可以该成8或更多.

PASS_WARN_AGE  7    密码有效期警告,超过7天将提示用户更换新的密码.

...

 

2,/etc/profile文件是环境变量设置文件.在此文件设置环境变量将对所有用户生效.我们要在此文件设置自动

注销帐户的时间.及命令的历史记录数.

[root@tp~]#vi/etc/profile

...

HOSTNAME=`/bin/hostname`

HISTSIZE=1000这里1000代表用户操作命令的历史记录.应尽量小一些.设置成0也可以,呵呵.

tmout=600添加此行,如果系统用户在600秒(10分钟)内不做任何操作,将自动注销这个用户.

...

3,/etc/passwd文件存放系统用户名,用户标识(UID),组标识(GID)等的地方.我们要在这里找到并清除没有设置

口令的用户.同时还要清除一些特别帐号(因为可能会存在潜在的危险).

[root@tp~]#vi/etc/passwd

root:

x:

0:

0:

root:

/root:

/bin/bash

bin:

x:

1:

1:

bin:

/bin:

/sbin/nologin

...

wh:

:

500:

501:

:

/home/wh:

/bin/bash

仔细观察上面的一行(wh用户),在第二项,两个冒号中间什么都没有,而上面的的用户(如root用户)都是x.这表

明此用户没有密码.要不添加上,要不删掉.

4,特别帐号的处理

如果不启动用sendmail,删除如下用户

[root@tpwh]#userdeladm

[root@tpwh]#userdellp

[root@tpwh]#userdelsync

[root@tpwh]#userdelshudown

[root@tpwh]#userdelhalt

[root@tpwh]#userdelmail

如果不用Xwindows服务器.可有删除

[root@tpwh]#userdelnews

[root@tpwh]#userdeluucp

[root@tpwh]#userdeloperator

[root@tpwh]#userdelgames

如果不允许匿名FTP帐号登陆,可删除

[root@tpwh]#userdelgopher

[root@tpwh]#userdelftp

 

三,重要文件的安全设置.

首先要了解两个命令

1,chmod:

改变文件的属主

2,chattr:

改变文件属性

我们要做的是把重要文件的属主改成root并给相应的权限,还有就是改变文件的属性让它禁止被修改

我们来统计一下重要文件:

(其实,只要你不想让其他用户更改的文件都可以这么做,我这里只是为安全而选择了

下面的文件.)

1,/etc/passwd,passwd-,passwd.OLD,group,group-用户,组的ID等信息文件.

2,/etc/shadow,shadow-,gshadow,gshadow-用户,组密码加密文件.

3,/etc/xinetd.conf网络守护进程主配置文件

4,/etc/inittab 系统在启动是会读取这个文件里的内容.

5,/etc/services防止未经许可的删除或添加服务

6,/etc/rc.d/rc.sysinit系统启动是需要读取的文件,

7,/etc/rc.d/init.d/* 

以一个文件为例,其它都一样

[root@tpetc]#chmod700passwd

[root@tpetc]#chattr+ipasswd

当chattr+i时就是禁止对文件进行修改,当我们要添加用户时,就会有麻烦,因为passwd文件禁止修改写入.所以

我们还要该掉它的属性.chattr-i.

 

四,防止攻击系统安全设置

1,限制用户使用系统资源,主要包括资源最大进程数,内存使用量等.这样可以防止DOS类型攻击.

需要编辑文件

[root@tp/]#vi/etc/security/limits.conf

...

(这三行是添加的)

*hardcore0   禁止创建core文件

*hardrss5000 其他用户(除root)最多使用5M内存

*hardnproc20 最多进程数限制在20

注:

*表示所有登陆到linux的用户.

#Endoffile

[root@tp/]#vi/etc/pam.d/login

...

在文件末尾加入下面一行

sessionrequired/lib/security/pam_limits.so

2,限制控制台的访问

[root@tp/]#vi/etc/securetty

...

我们注释掉

tty1

#tty2

#tty3

#tty4

#tty5

#tty6

只留下tty1,这时,root仅可在tty1终端登录

3,禁止外来ping请求.

[root@tp/]#vi/etc/rc.d/rc.local

...

在最后加入一行

echo1>/proc/sys/net/ipv4/icmp_echo_ignore_all

4,防止IP地址欺骗

[root@tp/]#vi/etc/host.conf

加入如下几行

orderbind,hosts

multioff

nospoofon

5,禁止su命令进入root(这一部我反复测试总是不成功,group组里的用户依然不能su成root用户.希望知道的朋

友告诉我,谢谢)

[root@tppam.d]#vi/etc/pam.d/su

...

在下面加入如下两行

authsufficient/lib/security/pam_rootok.sodebug

authrequired/lib/security/pam_wheel.sogroup=xxx

这表示只有xxx组的用户可以su成root.

6,使用TCP_WRAPPER

在默认情况下linux系统允许所有请求,可用TCP_WRAPPER增强安全性,

在/etc/hosts.deny写入"ALL:

ALL"禁止所有请求

[root@tpetc]#vi/etc/hosts.deny

#

#hosts.deny   Thisfiledescribesthenamesofthehostswhichare

#              *not*allowedtousethelocalINETservices,asdecided

#              bythe'/usr/sbin/tcpd'server.

#

#Theportmaplineisredundant,butitislefttoremindyouthat

#thenewsecureportmapuseshosts.denyandhosts.allow. Inparticular

#youshouldknowthatNFSusesportmap!

  "ALL:

ALL"

把允许访问的客户,或服务添加到/etc/hosts.allow,冒号左边为服务,冒号右边为授权的机器

[root@tpetc]#vi/etc/hosts.allow

#

#hosts.allow  Thisfiledescribesthenamesofthehostswhichare

#              allowedtousethelocalINETservices,asdecided

#              bythe'/usr/sbin/tcpd'server.

#

vsftp:

211.101.46.253   注:

仅如许IP地址为211.101.46.253的机器访问FIP服务器

7.删减登录信息

 [root@tp~]#rm-f/etc/issue

 [root@tp~]#rm-f/etc/

 [root@tp~]#touch/etc/issue

 [root@tp~]#touch/etc/

 

五,确保开启服务的安全性

我们先来看一下自己系统开启了多少服务.

[root@tp~]#ps-eaf|wc-l

55

我的是55

我们可以通过当前的进程里在来看一下都是什么服务

[root@tp~]#ps-aux

Warning:

badsyntax,perhapsabogus'-'?

See/usr/share/doc/procps-3.2.3/FAQ

USER      PID%CPU%MEM  VSZ RSSTTY     STATSTART  TIMECOMMAND

root        1 0.0 0.2 2592 560?

       S   21:

02  0:

00init[3]                          

                 

root        2 0.0 0.0    0   0?

       SN  21:

02  0:

00[ksoftirqd/0]

root        3 0.0 0.0    0   0?

       S<  21:

02  0:

00[events/0]

root        4 0.0 0.0    0   0?

       S<  21:

02  0:

00[khelper]

root        5 0.0 0.0    0   0?

       S<  21:

02  0:

00[kacpid]

root       20 0.0 0.0    0   0?

       S<  21:

02  0:

00[kblockd/0]

root       30 0.0 0.0    0   0?

       S   21:

02  0:

00[pdflush]

root       31 0.0 0.0    0   0?

       S   21:

02  0:

00[pdflush]

root       33 0.0 0.0    0   0?

       S<  21:

02  0:

00[aio/0]

root       21 0.0 0.0    0   0?

       S   21:

02  0:

00[khubd]

root       32 0.0 0.0    0   0?

       S   21:

02  0:

00[kswapd0]

root      107 0.0 0.0    0   0?

       S   21:

02  0:

00[kseriod]

root      181 0.0 0.0    0   0?

       S<  21:

03  0:

00[kmirrord]

root      182 0.0 0.0    0   0?

       S<  21:

03  0:

00[kmir_mon]

root      190 0.0 0.0    0   0?

       S   21:

03  0:

00[kjournald]

root     1085 0.0 0.1 2604 444?

       S

03  0:

00udevd

root     1611 0.0 0.0    0   0?

       S<  21:

03  0:

00[kauditd]

root     1745 0.0 0.0    0   0?

       S<  21:

03  0:

00[kmpathd/0]

root     1769 0.0 0.0    0   0?

       S   21:

03  0:

00[kjournald]

root     2250 0.0 0.2 2668 632?

       Ss  21:

03  0:

00syslogd-m0

root     2254 0.0 0.1 3352 472?

       Ss  21:

03  0:

00klogd-x

rpc      2274 0.0 0.2 2220 572?

       Ss  21:

03  0:

00portmap

rpcuser  2294 0.0 0.2 2108 756?

       Ss  21:

03  0:

00rpc.statd

root     2322 0.0 0.3 5344 992?

       Ss  21:

03  0:

00rpc.idmapd

root     2399 0.0 0.3 2612 816?

       S   21:

03  0:

00/usr/sbin/smartd

root     2409 0.0 0.2 3176 540?

       Ss  21:

03  0:

00/usr/sbin/acpid

root     2440 0.0 1.4111923680?

       Ss  21:

03  0:

00cupsd

root     2497 0.0 0.6 50441712?

       Ss  21:

03  0:

00/usr/sbin/sshd

root     2526 0.0 0.3 2760 876?

       Ss  21:

03  0:

00xinetd-stayalive-pidfile

/var/run/xinetd.pid

root     2536 0.0 0.2 1788 528?

       Ss  21:

03  0:

00gpm-m/dev/input/mice-timps2

htt      2565 0.0 0.1 1960 316?

       Ss  21:

03  0:

00/usr/sbin/htt-retryonerror0

htt      2566 0.0 1.1 82563024?

       S   21:

03  0:

00htt_server-nodaemon

canna    2578 0.0 6.81993217628?

      Ss  21:

03  0:

00/usr/sbin/cannaserver-syslog-u

canna

root     2590 0.0 0.4 74281204?

       Ss  21:

03  0:

00crond

xfs      2628 0.0 1.3 56923332?

       Ss  21:

03  0:

00xfs-droppriv-daemon

root     2638 0.0 0.2 2092 640?

       SNs 21:

03  0:

00anacron-s

root     2647 0.0 0.2 3712 740?

       Ss  21:

03  0:

00/usr/sbin/atd

dbus     2657 0.0 0.5132961324?

       Ssl 21:

03  0:

00dbus-daemon-1--system

root     2668 0.0 0.4 31561040?

       Ss  21:

03  0:

00cups-config-daemon

root     2679 0.0 1.7 65404424?

       Ss  21:

03  0:

00hald

root     2688 0.0 0.5 29161288?

       Ss  21:

03  0:

00login--root   

root     2689 0.0 0.1 1528 404tty2    Ss+ 21:

03  0:

00/sbin/mingettytty2

root     2690 0.0 0.1 2048 404tty3    Ss+ 21:

03  0:

00/sbin/mingettytty3

root     2691 0.0 0.1 3488 404tty4    Ss+ 21:

03  0:

00/sbin/mingettytty4

root     2692 0.0 0.1 2368 404tty5    Ss+ 21:

03  0:

00/sbin/mingettytty5

root     2693 0.0 0.1 3296 404tty6    Ss+ 21:

03  0:

00/sbin/mingettytty6

root     3136 0.0 0.5 59201396tty1    Ss+ 21:

05  0:

00-bash

root     3574 0.0 0.8 84002276?

       Ss  21:

05  0:

00sshd:

root@pts/0

root     3576 0.0 0.5 68961388pts/0   Ss  21:

05  0:

00-bash

root     3608 0.0 0.4 65841216pts/0   S+  21:

05  0:

00ntsysv

root     4019 0.0 0.8 84082276?

       Rs  21:

09  0:

00sshd:

root@pts/1

root     4021 0.0 0.5 69121388pts/1   Ss  21:

09  0:

00-bash

root     4084 0.0 0.2 2852 748pts/1   R+  21:

17  0:

00ps-aux

这些进程,服务,都是开机自动加载的!

我们可以用命令来看一下,

[root@tp~]#ntsysv

 

那些前面有*号的就是开机自动启动的服务.也就是说我们开机的话就要同时开启这么多的服务.(和我们windows

里的服务是一样的,没用的完全可以关了).

我们要掌握一个原则:

就是运行的服务越少,肯定系统就越安全.

上面看的是系统开机都会开启那些服务.那么那些服务是正在运行的呢?

[root@tp~]#netstat-an

ActiveInternetconnections(serversandestablished)

ProtoRecv-QSend-QLocalAddress              ForeignAddress            State    

tcp       0     00.0.0.0:

32768              0.0.0.0:

*                  LISTEN    

tcp       0     00.0.0.0:

111                0.0.0.0:

*                  LISTEN    

tcp       0     00.0.0.0:

113                0.0.0.0:

*                  LISTEN    

tcp       0     0127.0.0.1:

631              0.0.0.0:

*                  LISTEN    

tcp       0     0:

:

:

80                      :

:

:

*                       LISTEN    

tcp       0     0:

:

:

22                      :

:

:

*                       LISTEN    

tcp       0     0:

:

:

443                     :

:

:

*                       LISTEN    

tcp       0   880:

:

ffff:

192.168.0.1:

22      :

:

ffff:

192.168.0.5:

2683    ESTABLISHED

udp       0     00.0.0.0:

32768              0.0.0.0:

*                             

udp       0     00.0.0.0:

111                0.0.0.0:

*                             

udp

展开阅读全文
相关资源
猜你喜欢
相关搜索
资源标签

当前位置:首页 > 法律文书 > 调解书

copyright@ 2008-2023 冰点文库 网站版权所有

经营许可证编号:鄂ICP备19020893号-2