最后的话
最近很多小伙伴找我要Linux学习资料,于是我翻箱倒柜,整理了一些优质资源,涵盖视频、电子书、PPT等共享给大家!
资料预览
给大家整理的视频资料:
给大家整理的电子书资料:
如果本文对你有帮助,欢迎点赞、收藏、转发给朋友,让我有持续创作的动力!
网上学习资料一大堆,但如果学到的知识不成体系,遇到问题时只是浅尝辄止,不再深入研究,那么很难做到真正的技术提升。
一个人可以走的很快,但一群人才能走的更远!不论你是正从事IT行业的老鸟或是对IT行业感兴趣的新人,都欢迎加入我们的的圈子(技术交流、学习资源、职场吐槽、大厂内推、面试辅导),让我们一起学习成长!
5.ProFTP
你可以通过修改proftpd.conf来禁止root登陆
方法:
修改/etc/proftpd.conf
Add RootLogin off
重启
proftpd /sbin/service proftpd stop
/sbin/service proftpd start
6.TCP wrappers
编辑hosts.allow和hosts.deny可以限制或允许访问inet服务
方法:
限制访问inet服务
修改/etc/hosts.allow
建议格式:
#Approved IP addresses
ALL:192.168.0.1
ALL:192.168.5.2
#CSV uploader machine
proftpd:10.0.0.5
#pop3 from antwhere
ipop3:ALL
修改/etc/hosts.deny
ALL:ALL EXCEPT localhostENY
7.创建SU用户组
因为我们在SSH禁止了root用户访问并且禁用了telnet,所有我们应该
分配给一些用户su权限来获取root特权
方法:
vi /etc/group
添加一行 wheel❌10:root,user1,user2
chgrp wheel /bin/su
chmod o-rwx /bin/su
8.root通知
当一个具有root权限的用户登录的时候发mail
方法:
编辑/root下的.bashrc ,当有root权限的用户登录时发生email通知
echo ‘ALERT – Root Shell Access (Server Name) on:’ date
who
| mail -s “Alert: Root Access from who | cut -d”(” -f2 | cut -d”)” -f1
” your@email.com
9.history安全
这是一个避免删除.bash_history或重定向到/dev/null的好主意
因此他不能清除或删除他最后执行的命令
方法:
chattr +a .bash_history
chattr +i .bash_history
获取用户的人会知道他的历史命令锁定并且要同意才可以使用服务
10.使用欢迎信息
你必须提供一些信息让***者知道该系统不对公众开放。
在国外有类似案件,***者***一个系统并且系统没有这些信息,
这种情况下法院不能做任何裁决,因为系统说welcome
方法:
删除/etc/redhat-release
编辑/etc/issue /etc/motd并显示警告信息
11.禁用所有特殊账户
你应该从系统中删除所有默认用户和组
例如news,lp,sync,shutdown,uucp,games,halt 等
方法:
删除账户userdel name
删除组 groupdel name
锁定特定账户:
/usr/sbin/usermod -L -s /bin/false user
12.chmod危险文件
这可能是限制不具有root权限的用户执行下面这些命令的好主意
方法:
chmod 700 /bin/ping
chmod 700 /usr/bin/finger
chmod 700 /usr/bin/who
chmod 700 /usr/bin/w
chmod 700 /usr/bin/locate
chmod 700 /usr/bin/whereis
chmod 700 /sbin/ifconfig
chmod 700 /usr/bin/pico
chmod 700 /usr/bin/vi
chmod 700 /usr/bin/which
chmod 700 /usr/bin/gcc
chmod 700 /usr/bin/make
chmod 700 /bin/rpm
13.指定允许root登陆的TTY设备
/etc/securetty文件允许你指定root可以从哪个TTY设备登录
方法:
vi /etc/securetty
只留2个连接
tty1
tty2
14.选择一个安全的密码
在/etc/login.defs文件中定义了shadow密码的具体配置
默认密码长度最短为5字符,你应该至少设置为8
方法:
vi /etc/login.defs
PASS_MIN_LEN 8
15.检测Rootkit
用chkrootkit或rkhunter,以chkrootkit为例
方法:
wget ftp://ftp.pangeia.com.br/pub/seg/pac/chkrootkit.tar.gz
wget ftp://ftp.pangeia.com.br/pub/seg/pac/chkrootkit.md5
首先检查md5校验值: md5sum chkrootkit.tar.gz
然后解压安装
tar -zxvf chkrootkit.tar.gz
cd chkrootkit
./configure
make sense
然后运行./chkrootkit
我们可以将其添加到contrab使其每天自动扫描:
vi /etc/cron.daily/chkrootkit.sh
#!/bin/bash
输入chkrootkit的安装目录
cd /root/chkrootkit/
输入你想收到检测报告的email
./chkrootkit | mail -s “Daily chkrootkit from Server Name” your@email.com
16.安装补丁
你要经常检查更新以修复某些缺陷或系统稳定性的改进
否则你存在漏洞的系统将会不时的遭受新的***
方法:
列出可用更新:up2date -l
安装未排除的更新:up2date -u
安装包括排除的更新up2date -uf
17.隐藏Apache信息
你应该隐藏Apache的banner信息使***者不知道Apache的版本,从而使他们难以利用漏洞
方法:
修改/etc/httpd/conf/httpd.conf
改变服务器签名:
ServerSignature Off
重启Apache /sbin/service httpd restart
18.隐藏php信息
你应该隐藏php的banner信息,原因同上
方法:
修改php.ini
改变
expose_php=Off
重启Apache
19.关闭不用的服务
你应该把任何未使用的服务关闭,可以在/etc/xinetd.d文件夹里找到
方法:
cd /etc/xinetd.d
grep disable *
这将显示所有服务开启或关闭的状态,然后根据需要来开启或关闭服务
20.检测监听的端口
检测是否有必要开放端口是非常重要的
方法:
netstat -tulp或
lsof -i -n | egrep ‘COMMAND|LISTEN|UDP’或
nmap!
21.关闭端口和服务
重点是关闭在系统启动时打开的不需要的端口
方法:
对于正在运行的服务,可以执行chkconfig -list | grep on
禁用服务可以执行chkconfig servicename off
然后停止正在运行的服务:/etc/init.d/service stop
22.删除不用的rpm包
首先应该清楚你的系统的作用,它是web,mail,file服务器或其他
然后觉得哪些包是必要的,之后删除不需要的软件包
方法:
首先列出安装列表rpm -qa
更详细的信息rpm -qi rpmname
还可以检测删除包可能出现的冲突rpm -e –test rpmname
23.禁用危险的php函数
你应该禁用php的危险函数防止在网站上执行系统命令
方法:
whereis php.ini
vi /usr/local/lib/php.ini
编辑
disable_functions = “symlink,shell_exec,exec,proc_close,proc_open,popen,
system,dl,passthru,escapeshellarg, escapeshellcmd”
24.安装配置防火墙
高级策略防火墙(APF)是一种IP表(网络过滤),它是基于当今互联网部署服务器防火墙系统的基本需要和客户部署LINUX安装的唯一需要而设计的。 它是最好的开源防
火墙之一。
配置APF防火墙方法:
下载APF:wget http://www.r-fx.ca/downloads/apf-current.tar.gz
解压安装:
tar -zxvf apf-current.tar.gz
cd apf-0.9.7-1
./install.sh
然后我们配置它vi /etc/apf/conf.apf
一般配置:
启用防火墙使用DShield.org块列表
USE_DS=”1″
然后我将列出常规的配置和CPanel配置方式,因为CPanel是应该最广泛的虚拟主机管理软件
1.常规配置(DNS,Mail,Web,FTP)
Common ingress (inbound)
Common ingress (inbound) TCP ports -3000_3500 = passive port range for Pure FTPD IG_TCP_CPORTS=”21,22,25,53,80,110,143,443,995″
Common ingress (inbound) UDP ports IG_UDP_CPORTS=”53″
Egress filtering [0 = Disabled / 1 = Enabled]
EGF=”1″
Common egress (outbound) TCP ports
EG_TCP_CPORTS=”21,25,80,443,43″
Common egress (outbound) UDP ports
EG_UDP_CPORTS=”20,21,53″
2.CPanel配置
Common ingress (inbound) ports
Common ingress (inbound) TCP ports -3000_3500 = passive port range for Pure FTPD IG_TCP_CPORTS=”21,22,25,53,80,110,143,443,2082,2083, 2086,2087,
2095, 2096,3000_3500″
Common ingress (inbound) UDP ports
IG_UDP_CPORTS=”53″
Common egress (outbound) ports
Egress filtering [0 = Disabled / 1 = Enabled]
EGF=”1″
Common egress (outbound) TCP ports
EG_TCP_CPORTS=”21,25,80,443,43,2089″
Common egress (outbound) UDP ports
EG_UDP_CPORTS=”20,21,53″
之后启动防火墙 /etc/apf/apf -s
如果运行良好我在回去修改配置文件,使DEVM=”0″
然后我们配置APF的AntiDos: vi /etc/apf/ad/conf.antidos
找到下面的内容并替换成你的资料
Organization name to display on outgoing alert emails
CONAME=”Your Company”
Send out user defined attack alerts [0=off,1=on]
USR_ALERT=”0″
User for alerts to be mailed to
USR=you@yourco.com
你应把USR_ALERT改为1
保存后重启APF:/etc/apf/apf –r
To make the firewall start with the Operating System: chkconfig –level 2345 apf on
APF开机自启动:chkconfig –level 2345 apf on
禁止一个IP用/etc/apf/apf -d ip或vi /etc/apf/deny_hosts.rules
允许一个IP用/etc/apf/apf -a ip或vi /etc/apf/deny_hosts.rules
25.安装配置BFD(暴力破解检测)
BFD是一个用于分析应用日志和检测验证失败的模块化shell脚本
而且安装配置和用法都是非常容易的。使用BFD的原因很简单。
其实在LINUX领域几乎没有结合防火墙或实时设备来监控不验证和
暴力***审计的程序。在用BFD之前你必须安装APF防火墙。
方法:
wget http://www.r-fx.ca/downloads/bfd-current.tar.gz
tar -zxvf bfd-current.tar.gz
cd bfd-0.9
然后我们来配置它 vi /usr/local/bfd/conf.bfd
把以下内容改为你的资料
Enable/disable user alerts [0 = off; 1 = on]
ALERT_USR=”1″
User alert email address
EMAIL_USR=”your@mail.com”
User alert email; subject
SUBJ_USR=”Brute Force Warning for $HOSTNAME”
然后vi /usr/local/bfd/ignore.hosts
把你的IP设置成允许主机,避免意外的锁定自己。
之后重启BFD /usr/local/sbin/bfd -s
26.内核加固(sysctl.conf)
sysctl.conf用来加固内核,目的是避免DOS和欺骗***
方法:
到/proc/sys目录或sysctl -a命令了解下当前配置的大概情况
然后vi /etc/sysctl.conf
添加如下内容:
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 forwarding
net.ipv4.ip_forward = 0
Controls source route verification
net.ipv4.conf.default.rp_filter = 1
Controls the System Request debugging functionality of the kernel
kernel.sysrq = 0
Controls whether core dumps will append the PID to the core filename.
Useful for debugging multi-threaded applications.
kernel.core_uses_pid = 1
#Prevent SYN attack
net.ipv4.tcp_syncookies = 1
net.ipv4.tcp_max_syn_backlog = 2048
net.ipv4.tcp_synack_retries = 2
Disables packet forwarding
net.ipv4.ip_forward=0
Disables IP source routing
net.ipv4.conf.all.accept_source_route = 0
net.ipv4.conf.lo.accept_source_route = 0
net.ipv4.conf.eth0.accept_source_route = 0
net.ipv4.conf.default.accept_source_route = 0
Enable IP spoofing protection, turn on source route verification
net.ipv4.conf.all.rp_filter = 1
net.ipv4.conf.lo.rp_filter = 1
net.ipv4.conf.eth0.rp_filter = 1
net.ipv4.conf.default.rp_filter = 1
Disable ICMP Redirect Acceptance
net.ipv4.conf.all.accept_redirects = 0
net.ipv4.conf.lo.accept_redirects = 0
net.ipv4.conf.eth0.accept_redirects = 0
net.ipv4.conf.default.accept_redirects = 0
Enable Log Spoofed Packets, Source Routed Packets, Redirect Packets
net.ipv4.conf.all.log_martians = 1
net.ipv4.conf.lo.log_martians = 1
net.ipv4.conf.eth0.log_martians = 1
Disables IP source routing
net.ipv4.conf.all.accept_source_route = 0
net.ipv4.conf.lo.accept_source_route = 0
net.ipv4.conf.eth0.accept_source_route = 0
net.ipv4.conf.default.accept_source_route = 0
Enable IP spoofing protection, turn on source route verification
net.ipv4.conf.all.rp_filter = 1
net.ipv4.conf.lo.rp_filter = 1
net.ipv4.conf.eth0.rp_filter = 1
14
net.ipv4.conf.default.rp_filter = 1
Disable ICMP Redirect Acceptance
net.ipv4.conf.all.accept_redirects = 0
net.ipv4.conf.lo.accept_redirects = 0
net.ipv4.conf.eth0.accept_redirects = 0
net.ipv4.conf.default.accept_redirects = 0
Disables the magic-sysrq key
kernel.sysrq = 0
Modify system limits for Ensim WEBppliance
fs.file-max = 65000
Decrease the time default value for tcp_fin_timeout connection
net.ipv4.tcp_fin_timeout = 15
Decrease the time default value for tcp_keepalive_time connection
net.ipv4.tcp_keepalive_time = 1800
Turn off the tcp_window_scaling
net.ipv4.tcp_window_scaling = 0
Turn off the tcp_sack
net.ipv4.tcp_sack = 0
Turn off the tcp_timestamps
net.ipv4.tcp_timestamps = 0
Enable TCP SYN Cookie Protection
net.ipv4.tcp_syncookies = 1
Enable ignoring broadcasts request
net.ipv4.icmp_echo_ignore_broadcasts = 1
Enable bad error message Protection
net.ipv4.icmp_ignore_bogus_error_responses = 1
Log Spoofed Packets, Source Routed Packets, Redirect Packets
net.ipv4.conf.all.log_martians = 1
Set maximum amount of memory allocated to shm to 256MB
kernel.shmmax = 268435456
Improve file system performance
vm.bdflush = 100 1200 128 512 15 5000 500 1884 2
Improve virtual memory performance
vm.buffermem = 90 10 60
Increases the size of the socket queue (effectively, q0).
net.ipv4.tcp_max_syn_backlog = 1024
Increase the maximum total TCP buffer-space allocatable
net.ipv4.tcp_mem = 57344 57344 65536
Increase the maximum TCP write-buffer-space allocatable
net.ipv4.tcp_wmem = 32768 65536 524288
最全的Linux教程,Linux从入门到精通
======================
-
linux从入门到精通(第2版)
-
Linux系统移植
-
Linux驱动开发入门与实战
-
LINUX 系统移植 第2版
-
Linux开源网络全栈详解 从DPDK到OpenFlow
第一份《Linux从入门到精通》466页
====================
内容简介
====
本书是获得了很多读者好评的Linux经典畅销书**《Linux从入门到精通》的第2版**。本书第1版出版后曾经多次印刷,并被51CTO读书频道评为“最受读者喜爱的原创IT技术图书奖”。本书第﹖版以最新的Ubuntu 12.04为版本,循序渐进地向读者介绍了Linux 的基础应用、系统管理、网络应用、娱乐和办公、程序开发、服务器配置、系统安全等。本书附带1张光盘,内容为本书配套多媒体教学视频。另外,本书还为读者提供了大量的Linux学习资料和Ubuntu安装镜像文件,供读者免费下载。
本书适合广大Linux初中级用户、开源软件爱好者和大专院校的学生阅读,同时也非常适合准备从事Linux平台开发的各类人员。
需要《Linux入门到精通》、《linux系统移植》、《Linux驱动开发入门实战》、《Linux开源网络全栈》电子书籍及教程的工程师朋友们劳烦您转发+评论
网上学习资料一大堆,但如果学到的知识不成体系,遇到问题时只是浅尝辄止,不再深入研究,那么很难做到真正的技术提升。
一个人可以走的很快,但一群人才能走的更远!不论你是正从事IT行业的老鸟或是对IT行业感兴趣的新人,都欢迎加入我们的的圈子(技术交流、学习资源、职场吐槽、大厂内推、面试辅导),让我们一起学习成长!
===
内容简介
====
本书是获得了很多读者好评的Linux经典畅销书**《Linux从入门到精通》的第2版**。本书第1版出版后曾经多次印刷,并被51CTO读书频道评为“最受读者喜爱的原创IT技术图书奖”。本书第﹖版以最新的Ubuntu 12.04为版本,循序渐进地向读者介绍了Linux 的基础应用、系统管理、网络应用、娱乐和办公、程序开发、服务器配置、系统安全等。本书附带1张光盘,内容为本书配套多媒体教学视频。另外,本书还为读者提供了大量的Linux学习资料和Ubuntu安装镜像文件,供读者免费下载。
本书适合广大Linux初中级用户、开源软件爱好者和大专院校的学生阅读,同时也非常适合准备从事Linux平台开发的各类人员。
需要《Linux入门到精通》、《linux系统移植》、《Linux驱动开发入门实战》、《Linux开源网络全栈》电子书籍及教程的工程师朋友们劳烦您转发+评论
网上学习资料一大堆,但如果学到的知识不成体系,遇到问题时只是浅尝辄止,不再深入研究,那么很难做到真正的技术提升。
一个人可以走的很快,但一群人才能走的更远!不论你是正从事IT行业的老鸟或是对IT行业感兴趣的新人,都欢迎加入我们的的圈子(技术交流、学习资源、职场吐槽、大厂内推、面试辅导),让我们一起学习成长!