linux系统安全系统加固方案设计.docx

上传人:b****4 文档编号:13943614 上传时间:2023-06-19 格式:DOCX 页数:7 大小:16.50KB
下载 相关 举报
linux系统安全系统加固方案设计.docx_第1页
第1页 / 共7页
linux系统安全系统加固方案设计.docx_第2页
第2页 / 共7页
linux系统安全系统加固方案设计.docx_第3页
第3页 / 共7页
linux系统安全系统加固方案设计.docx_第4页
第4页 / 共7页
linux系统安全系统加固方案设计.docx_第5页
第5页 / 共7页
linux系统安全系统加固方案设计.docx_第6页
第6页 / 共7页
linux系统安全系统加固方案设计.docx_第7页
第7页 / 共7页
亲,该文档总共7页,全部预览完了,如果喜欢就下载吧!
下载资源
资源描述

linux系统安全系统加固方案设计.docx

《linux系统安全系统加固方案设计.docx》由会员分享,可在线阅读,更多相关《linux系统安全系统加固方案设计.docx(7页珍藏版)》请在冰点文库上搜索。

linux系统安全系统加固方案设计.docx

linux系统安全系统加固方案设计

 

1概述

1.1适用范围

本方案适用于银视通信息科技有限公司linux主机安全加固,供运维人员参考对linux主机进行安全加固。

2用户账户安全加固

2.1修改用户密码策略

(1)修改前备份配置文件:

/etc/login.defs

cp/etc/login.defs/etc/login.defs.bak

(2)修改编辑配置文件:

vi/etc/login.defs,修改如下配置:

PASS_MAX_DAYS90(用户的密码不过期最多的天数)

PASS_MIN_DAYS0(密码修改之间最小的天数)

PASS_MIN_LEN8(密码最小长度)

PASS_WARN_AGE7(口令失效前多少天开始通知用户更改密码)

(3)回退操作

~]#cp/etc/login.defs.bak/etc/login.defs

2.2锁定或删除系统中与服务运行,运维无关的的用户

(1)查看系统中的用户并确定无用的用户

~]#more/etc/passwd

(2)锁定不使用的账户(锁定或删除用户根据自己的需求操作一项即可)

锁定不使用的账户:

~]#usermod-Lusername

或删除不使用的账户:

~]#userdel-fusername

(3)回退操作

用户锁定后当使用时可解除锁定,解除锁定命令为:

~]#usermod-Uusername

2.3锁定或删除系统中不使用的组

(1)操作前备份组配置文件/etc/group

~]#cp/etc/group/etc/group.bak

(2)查看系统中的组并确定不使用的组

~]#cat/etc/group

(3)删除或锁定不使用的组

锁定不使用的组:

修改组配置文件/etc/group,在不使用的组前加“#”注释掉该组即可

删除不使用的组:

~]#groupdelgroupname

(4)回退操作

~]#cp/etc/group.bak/etc/group

2.4限制密码的最小长度

(1)操作前备份组配置文件/etc/pam.d/system-auth

~]#cp/etc/pam.d/etc/pam.d.bak

(2)设置密码的最小长度为8

修改配置文件/etc/pam.d,在行”passwordrequisitepam_pwquality.sotry_first_passlocal_users_onlyretry=3authtok_type=”中添加“minlen=8”,或使用sed修改:

~]#sed-i"s#passwordrequisitepam_pwquality.sotry_first_passlocal_users_onlyretry=3authtok_type=#passwordrequisitepam_pwquality.sotry_first_passlocal_users_onlyretry=3minlen=8authtok_type=#g"/etc/pam.d/system-auth

(3)回退操作

~]#cp/etc/pam.d.bak/etc/pam.d

3用户登录安全设置

3.1禁止root用户远程登录

(1)修改前备份ssh配置文件/etc/ssh/sshd_conf

~]#cp/etc/ssh/sshd_conf/etc/ssh/sshd_conf.bak

(2)修改ssh服务配置文件不允许root用户远程登录

编辑/etc/ssh/sshd_config找到“#PermitRootLoginyes”去掉注释并修改为“PermitRootLoginno”或者使用sed修改,修改命令为:

~]#sed-i"s@#PermitRootLoginyes@PermitRootLoginno@g"/etc/ssh/sshd_config

(3)修改完成后重启ssh服务

Centos6.x为:

~]#servicesshdrestart

Centos7.x为:

~]#systemctlrestartsshd.service

(4)回退操作

~]#cp/etc/ssh/sshd_config.bak/etc/ssh/sshd_config

3.2设置远程ssh登录超时时间

(1)修改前备份ssh服务配置文件/etc/ssh/sshd_config

~]#cp/etc/ssh/sshd_conf/etc/ssh/sshd_conf.bak

(2)设置远程ssh登录长时间不操作退出登录

编辑/etc/ssh/sshd_conf将”#ClientAliveInterval0”修改为”ClientAliveInterval180”,将”#ClientAliveCountMax3”去掉注释,或执行如下命令:

~]#sed-i"s@#ClientAliveInterval0@ClientAliveInterval180@g"/etc/ssh/sshd_config

~]#sed-i"s@#ClientAliveCountMax3@ClientAliveCountMax3@g"/etc/ssh/sshd_config

(3)配置完成后保存并重启ssh服务

Centos6.x为:

~]#servicesshdrestart

Centos7.x为:

~]#systemctlrestartsshd.service

(4)回退操作

~]#cp/etc/ssh/sshd_config.bak/etc/ssh/sshd_config

3.3设置当用户连续登录失败三次,锁定用户30分钟

(1)配置前备份配置文件/etc/pam.d/sshd

~]#cp/etc/pam.d/sshd/etc/pam.d/sshd.bak

(2)设置当用户连续输入密码三次时,锁定该用户30分钟

修改配置文件/etc/pam.d/sshd,在配置文件的第二行添加内容:

authrequiredpam_tally2.sodeny=3unlock_time=300

(3)若修改配置文件出现错误,回退即可,回退操作:

~]#cp/etc/pam.d/sshd.bak/etc/pam.d/sshd

3.4设置用户不能使用最近五次使用过的密码

(1)配置前备份配置文件/etc/pam.d/sshd

~]#cp/etc/pam.d/system-auth/etc/pam.d/system-auth.bak

(2)配置用户不能使用最近五次使用的密码

修改配置文件/etc/pam.d/sshd,找到行”passwordsufficientpam_unix.sosha512shadownulloktry_first_passuse_authtok”,在最后加入remember=10,或使用sed修改

~]#sed-i"s@#passwordsufficientpam_unix.sosha512shadownulloktry_first_passuse_authtok@passwordsufficientpam_unix.sosha512shadownulloktry_first_passuse_authtokremember=10@g"/etc/ssh/sshd_config

(3)回退操作

~]#cp/etc/pam.d/sshd.bak/etc/pam.d/sshd

3.5设置登陆系统账户超时自动退出登陆

(1)设置登录系统的账号长时间不操作时自动登出

修改系统环境变量配置文件/etc/profile,在文件的末尾加入”TMOUT=180”,使登录系统的用户三分钟不操作系统时自动退出登录。

~]#echoTMOUT=180>>/etc/profile

(2)使配置生效

执行命令:

~]#./etc/profile#或source/etc/profile

(3)回退操作

删除在配置文件”/etc/profile”中添加的”TMOUT=180”,执行命令./etc/profile使配置生效。

4系统安全加固

4.1关闭系统中与系统正常运行、业务无关的服务

(1)查看系统中的所有服务及运行级别,并确定哪些服务是与系统的正常运行及业务无关的服务。

~]#chkconfig--list

(2)关闭系统中不用的服务

~]#chkconfigservernameoff

(3)回退操作,如果意外关闭了与系统业务运行相关的服务,可将该服务开启

~]#chkconfigservernameon

4.2禁用“CTRL+ALT+DEL”重启系统

(1)rhel6.x中禁用“ctrl+alt+del”键重启系统

修改配置文件“/etc/init/control-alt-delete.conf”,注释掉行“startoncontrol-alt-delete ”。

或用sed命令修改:

~]#sed-i"s@startoncontrol-alt-delete@#startoncontrol-alt-delete@g"/etc/init/control-alt-delete.conf

(2)rhel7.x中禁用“ctrl+alt+del”键重启系统

修改配置文件“/usr/lib/systemd/system/ctrl-alt-del.target”,注释掉所有内容。

(3)使修改的配置生效

~]#initq

4.3加密grub菜单

1、加密Redhat6.xgrub菜单

(1)备份配置文件/boot/grub/grub.conf

~]#cp/boot/grub/grub.conf/boot/grub/grub.conf.bak

(2)将密码生成秘钥

~]#grub-md5-crypt

Password:

Retypepassword:

$1$nCPeR/$mUKEeqnBp8G.P.Hrrreus.

(3)为grub加密

修改配置文件/boot/grub/grub.conf,在”timeout=5”行下加入”password--md5$1$CgxdR/$9ipaqi8aVriEpF0nvfd8x.”,”$1$CgxdR/$9ipaqi8aVriEpF0nvfd8x.”为加密后的密码。

(4)回退

~]#cp/boot/grub/grub.conf/boot/grub/grub.conf.bak

或者删除加入行”password--md5$1$CgxdR/$9ipaqi8aVriEpF0nvfd8x.”

2、加密redhat7.xgrub菜单

(1)在”/etc/grub.d/00_header”文件末尾,添加以下内容

cat<

passwordadminqwe123

E0F

(2)重新编译生成grub.cfg文件

~]#grub2-mkconfig-o/boot/grub2/grub.cfg

(3)回退操作

删除/etc/grub.d/00_header中添加的内容,并重新编译生成grub.cfg文件

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

当前位置:首页 > 工程科技 > 能源化工

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

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