系统安全的几点细节
发表于:2026-11-01 作者:千家信息网编辑
千家信息网最后更新 2026年11月01日,#设定用户90天修改密码,提前7天提醒UserList=$(ls /home/|awk '{print $NF}'|grep -v lost+found)for user in $UserListd
千家信息网最后更新 2026年11月01日系统安全的几点细节
#设定用户90天修改密码,提前7天提醒UserList=$(ls /home/|awk '{print $NF}'|grep -v lost+found)for user in $UserListdo chage -M 90 -W 7 $userdone#禁pingecho 1 > /proc/sys/net/ipv4/icmp_echo_ignore_all#设定用户过期时间90默认密码长度8位cp /etc/login.defs /etc/login.defs.baksed -i '/PASS_MIN_LEN/s/[0-9]\{1,6\}/90/' /etc/login.defssed -i '/PASS_MIN_LEN/s/[0-9]\{1,3\}/8/' /etc/login.defs#设定用户登录,普通用户登录识别超过6次锁定300s.echo "account required pam_tally2.so deny=100 no_magic_root reset" >>/etc/pam.d/system-authecho "auth required pam_tally2.so onerr=fail deny=6 unlock_time=300" >>/etc/pam.d/system-auth#隐藏系统版本号mv /etc/issue /etc/isseumv /etc/issue.net /etc/isseu.netmv /etc/redhat-release /etc/rehdat-release#优化配置参数。echo '# Kernel sysctl configuration file for Red Hat Linux## For binary values, 0 is disabled, 1 is enabled. See sysctl(8) and# sysctl.conf(5) for more details.# Controls IP packet forwardingnet.ipv4.ip_forward = 0# Controls source route verificationnet.ipv4.conf.default.rp_filter = 1# Do not accept source routingnet.ipv4.conf.default.accept_source_route = 0# Controls the System Request debugging functionality of the kernelkernel.sysrq = 0# Controls whether core dumps will append the PID to the core filename# Useful for debugging multi-threaded applicationskernel.core_uses_pid = 1# Controls the use of TCP syncookiesnet.ipv4.tcp_syncookies = 1# Controls the maximum size of a message, in byteskernel.msgmnb = 65536# Controls the default maxmimum size of a mesage queuekernel.msgmax = 65536# Controls the maximum shared segment size, in byteskernel.shmmax = 68719476736# Controls the maximum number of shared memory segments, in pageskernel.shmall = 4294967296# ------------- Kernel Optimization -------------net.ipv4.tcp_max_tw_buckets = 60000net.ipv4.tcp_sack = 1net.ipv4.tcp_window_scaling = 1net.ipv4.tcp_rmem = 4096 87380 4194304net.ipv4.tcp_wmem = 4096 16384 4194304net.core.wmem_default = 8388608net.core.rmem_default = 8388608net.core.rmem_max = 16777216net.core.wmem_max = 16777216net.core.netdev_max_backlog = 262144net.core.somaxconn = 262144net.ipv4.tcp_max_orphans = 3276800net.ipv4.tcp_max_syn_backlog = 262144net.ipv4.tcp_timestamps = 0net.ipv4.tcp_synack_retries = 1net.ipv4.tcp_syn_retries = 1net.ipv4.tcp_tw_recycle = 1net.ipv4.tcp_tw_reuse = 1net.ipv4.tcp_mem = 94500000 915000000 927000000net.ipv4.tcp_fin_timeout = 1net.ipv4.tcp_keepalive_time = 30net.ipv4.ip_local_port_range = 1024 65000net.ipv4.ip_conntrack_max = 655360net.ipv4.netfilter.ip_conntrack_max =655360net.ipv4.netfilter.ip_conntrack_tcp_timeout_established = 180 ' >/etc/sysctl.conf#生效sysctl -p#记录histtory日志echo '#history export HISTTIMEFORMAT="%F %T `whoami` "USER_IP=`who -u am i 2>/dev/null| awk '{print $NF}'|sed -e 's/[()]//g'`HISTDIR=/usr/local/bin/.history if [ -z $USER_IP ] then USER_IP=`hostname` fi if [ ! -d $HISTDIR ] then mkdir -p $HISTDIR chmod 777 $HISTDIR fi if [ ! -d $HISTDIR/${LOGNAME} ] then mkdir -p $HISTDIR/${LOGNAME} chmod 300 $HISTDIR/${LOGNAME} fi export HISTSIZE=4000 DT=`date +%Y%m%d_%H%M%S` export HISTFILE="$HISTDIR/${LOGNAME}/${USER_IP}.history.$DT"chmod 600 $HISTDIR/${LOGNAME}/*.history* 2>/dev/null '>>/etc/profile#安全登录/etc/hosts.allow## hosts.allow This file describes the names of the hosts which are# allowed to use the local INET services, as decided# by the '/usr/sbin/tcpd' server.###***sshd:111.1.1.1sshd:122.1.1.2##jumpsshd:10.0.1.1/etc/hosts.deny## hosts.deny This file describes the names of the hosts which are# *not* allowed to use the local INET services, as decided# by the '/usr/sbin/tcpd' server.## The portmap line is redundant, but it is left to remind you that# the new secure portmap uses hosts.deny and hosts.allow. In particular# you should know that NFS uses portmap!sshd:all#检查防火墙配置(开放指定用户地址登录|服务地址开放用户地址段)iptables-save#创建普通用户useradd liangxiujunecho -e 'xx123456'|passwd liangxiujun --stdin#禁止root登录权限sed -i 's/#PermitRootLogin yes/PermitRootLogin no/g' /etc/ssh/sshd_config#优化ssh链接慢问题sed -i 's/GSSAPIAuthentication yes/GSSAPIAuthentication no/' /etc/ssh/sshd_configsed -i '/#UseDNS yes/a\UseDNS no' /etc/ssh/sshd_config/etc/init.d/sshd restart
用户
登录
地址
普通
密码
开放
配置
安全
系统
参数
日志
时间
权限
版本
链接
长度
问题
防火墙
服务
检查
数据库的安全要保护哪些东西
数据库安全各自的含义是什么
生产安全数据库录入
数据库的安全性及管理
数据库安全策略包含哪些
海淀数据库安全审计系统
建立农村房屋安全信息数据库
易用的数据库客户端支持安全管理
连接数据库失败ssl安全错误
数据库的锁怎样保障安全
小米移动互联网科技园
互联网科技图片
互联网科技英文
艾特科技互联网
华中科技大学互联网
互联网 科技馆
科技与互联网的利与弊
深圳前海聚择互联网科技有限公司
北京大学互联网科技怎么样
速维有品互联网信息科技(苏州)有限公司
银川新华互联网科技学校联系电话
国大互联网教育科技有限公司工作
乌鲁木齐新华智原互联网科技学校
互联网科技如何创业
深圳互联网科技的发展
江苏苏星互联网科技有限公司
半导体是互联网高科技吗
风投北京互联网科技
西安左小互联网科技有限公司
互联网科技对化妆品行业
云信互联网科技有限公司
智能科技公司是互联网公司吗
没上市的科技互联网公司
善班互联网科技有限公司
互联网科技公司招聘
互联网和高科技公司
链环科技传统企业怎么转型互联网
每天都有哪些好的互联网科技
互联网与数字科技关系
如何强化互联网金融科技