在FreeBSD上使用mod_dosevasive对抗DDos攻击

小规模DDoS用Freebsd+IPFW搞定 曾经有一段时间不少用户反映有的服务器访问速度缓慢,甚至不能访问,检查后发现是受到了DDoS攻击(分布式拒绝服务攻击)。 立即下载

http://www.toplee.com/blog/278.html

      mod_dosevasive是一个Apache上的可选模块,它能应对一些基于HTTP的拒绝服务攻击,就是常说的Dos或者DDos攻击,这种攻击是让很多大小网站都头疼的攻击方式,mod_dosevasive从Apache1.3开始出现,虽然不能完全彻底的防止大规模的DDos攻击,但是对于普通的攻击来说,还是非常不错的选择。

  我的服务器(http://www.toplee.com/blog/)就曾经收到过类似的测试攻击(就是估计别人是为了练手,并非真的要针对我),搞得很头疼,我一些朋友的应用也遇到过类似的烦恼,基本上都通过安装mod_dosevasive得到了较好的解决。下面我就来以我在FreeBSD上安装基于Apache2.2.2的mod_dosevasive经过给大家分享一下经验,顺便进一步讲述一下mod_dosevasive的特性。

  mod_dosevasive通过对来访IP地址和访问URI建立内部动态哈希表来检测是否有攻击,如果有如下的行为将拒绝该IP的访问:

1. 每秒对同一页面的请求数超过平时(原文:Requesting the same page more than a few times per second)。
2. 每秒同一个子进程有超过50次的并发请求。
3. 临时被拒绝(在blacklist中)的时候还不断进行请求。

  mod_dosevasive可以非常方便的和防火墙、路由器等进行整合,进一步提高抗拒绝服务的能力。和别的防攻击工具一样,mod_dosevasive同样收到带宽、系统处理能力等因素的影响,所以要想应对大规模的攻击,最好的方式就是把mod_dosevasive和您的防火墙和路由器进行整合,而不是简单的安装成为独立的Apache模块。

mod_dosevasive在apache2.2.2上的安装方法:

一、使用源码安装:
1、下载

#cd /tmp (任何别的目录都行)
#wget http://www.zdziarski.com/projects/mod_evasive/mod_evasive_1.10.1.tar.gz

2、解压缩

#tar -zxvf mod_dosevasive_1.10.1.tar.gz
#cd mod_dosevasive

3、以动态模块方式编译

# apxs -i -a -c mod_dosevasive20.c

4. 修改/etc/httpd/conf/httpd.conf文件,加入对模块的支持:

LoadModule dosevasive20_module libexec/apache22/mod_dosevasive20.so

二、使用FreeBSD的port进行安装(强烈推荐此方式)

#cd /usr/ports/www/mod_dosevasive20
#make install clean

  至此,完成了mod_dosevasive的安装,重启apache服务后,它就开始工作了,这个时候您如果不作任何别的设置,它也可以使用默认配置为您提供良好的防攻击能力,当然,您也可以自己进行一些参数的定制配置,可选的参数如下:

在您的httpd.conf文件中,加入类似下面的部分
Apache 1.3.x

<IfModule mod_dosevasive.c>
DOSHashTableSize 3097
DOSPageCount 5
DOSSiteCount 100
DOSPageInterval 2
DOSSiteInterval 2
DOSBlockingPeriod 600
</IfModule>

Apache 2.x

<IfModule mod_dosevasive20.c>
DOSHashTableSize 3097
DOSPageCount 5
DOSSiteCount 100
DOSPageInterval 2
DOSSiteInterval 2
DOSBlockingPeriod 600
</IfModule>

参数简单说明:
DOSHashTableSize 3097 记录和存放黑名单的哈西表大小,如果服务器访问量很大,可以加大该值
DOSPageCount 5 同一个页面在同一时间内可以被统一个用户访问的次数,超过该数字就会被列为攻击,同一时间的数值可以在DosPageInterval参数中设置。
DOSSiteCount 50 同一个用户在同一个网站内可以同时打开的访问数,同一个时间的数值在DOSSiteInterval中设置。
DOSPageInterval 2 设置DOSPageCount中时间长度标准,默认值为1。
DOSSiteInterval 2 设置DOSSiteCount中时间长度标准。
DOSBlockingPeriod 10 被封时间间隔秒,这中间会收到 403 (Forbidden) 的返回。

其他可选参数:
DOSEmailNotify lee@toplee.com 设置受到攻击时接收攻击信息提示的邮箱地址。
DOSSystemCommand “su - someuser -c ‘/sbin/… %s …’” 受到攻击时Apache运行用户执行的系统命令
DOSLogDir “/var/lock/mod_dosevasive” 攻击日志存放目录,BSD上默认是 /tmp

下面是我的服务器上看到的一些日志情况:

#cd /tmp
#ll |wc -l
    2303
#ls
......
dos-218.64.69.71        dos-219.80.33.54        dos-222.214.156.211
dos-218.64.79.59        dos-219.82.143.127      dos-222.214.2.148
dos-218.64.81.162       dos-219.82.46.245       dos-222.214.206.162 
dos-218.65.102.178      dos-220.113.43.61       dos-222.214.207.191
......
#more dos-218.64.69.71
30611
可以看到,这个ip地址有30611次的访问攻击被记录!!!

参考资料:
原官方主页:http://www.nuclearelephant.com/projects/dosevasive/
新主页地址:http://www.zdziarski.com/projects/mod_evasive/
 

Fast-LIO2代码解析 古月居 FAST-LIO,FAST-LIO2与FASTER-LIO - 古月居FAST-LIO2代码解析(一) - 古月居FAST-LIO2代码解析(二) - 古月居FAST-LIO2代码解析(三) - 古月居FAST-LIO2代码解析(四) - 古月居FAST-LIO2代码解析(五) - 古月居FAST-LIO2代码解析(六) - 古月居 阅读详情

相关推荐

多目标跟踪中使用trackeval评估dancetrack运行结果

trackeval使用

qq_46144849的博客 1782

基于freebsd5.3下 PF synproxy的DDOS防范方案-

基于freebsd下 PF synproxy的DDOS防范方案[摘要]本文讲述了基于freebsd5.3 下PF synproxy的DDOS防范方案,对于中小型企业抵挡每秒3万个包的攻击不失为一种可用方案。疑惑3万。。。。。。。。。。。[环境]防火墙:台式机P4 2G,512内存。 FREEBSD5.3WEB服务器:笔记本PIII 700 256m, suse linux enterp

793

Syzkaller实战教程2:运行环境配置+实例运行

本文详细介绍了在linux系统上搭建Syzkaller内核模糊测试环境的完整流程。 1.环境配置:通过VMware创建Ubuntu20.04虚拟机A,配置QEMU/KVM虚拟化环境,安装Go语言工具链和Syzkaller; 2.内核编译:下载Linux内核源码并配置KCOV等调试选项,编译生成带覆盖率支持的bzImage内核镜像; 3.测试环境构建:使用debootstrap创建Debian虚拟机镜像,通过QEMU启动嵌套虚拟机B; 实例测试: 4.演示两种测试场景 - 提供完整上手教程

cuguanren的博客 1375

zz在FreeBSD上使用mod_dosevasive对抗DDos攻击

在FreeBSD上使用mod_dosevasive对抗DDos攻击 By Michael  mod_dosevasive是一个Apache上的可选模块,它能应对一些基于HTTP的拒绝服务攻击,就是常说的Dos或者DDos攻击,这种攻击是让很多大小网站都头疼的攻击方式,mod_dosevasive从Apache1.3开始出现,虽然不能完全彻底的防止大规模的DDos攻击,但是对于普通的攻击

aniwn的专栏 547

Geneformer实战指南:基于Hugging Face Transformers的基因序列分类模型解析

本文详细解析了基于Hugging Face Transformers的Geneformer模型在基因序列分类任务中的应用。通过介绍模型架构、数据处理流程和实战案例,帮助生物信息学研究者掌握这一前沿技术,实现高效的基因表达数据分析与分类。

weixin_28224217的博客 581

支付宝周期扣款实战:从签约到主动扣款的完整Java代码与避坑指南

本文详细介绍了支付宝周期扣款功能的完整Java实现流程,从协议签约到主动扣款的各个环节,包括业务模型设计、签约接口实现、异步通知处理、主动扣款技术等关键步骤。针对开发中常见的陷阱和问题,提供了实用的避坑指南和代码示例,帮助开发者高效实现连续支付功能,提升用户留存率。

weixin_27199085的博客 373

在FreeBSD上使用mod_dosevasive对抗DDoS攻击

mod_dosevasive是一个Apache上的可选模块,它能应对一些基于HTTP的拒绝服务攻击,就是常说的Dos或者DDos攻击,这种攻击是让很多大小网站都头疼的攻击方式,mod_dosevasive从Apache1.3开始出现,虽然不能完全彻底的防止大规模的DDos攻击,但是对于普通的攻击来说,还是非常不错的选择。   我的服务器(http://www.toplee.com/blog

phphot 1570

Kaggle时间序列竞赛金牌方案解析与实战指南

本文深度解析了Kaggle时间序列竞赛的金牌方案,揭示了其成功不仅依赖先进模型,更在于系统工程思维。文章系统阐述了从数据理解、特征工程到模型集成与后处理的全流程,并重点剖析了分层建模、自定义损失函数、时序交叉验证等核心技巧,为参赛者提供了从理论到实战的完整指南。

weixin_29196315的博客 355

[转]在FreeBSD上使用mod_dosevasive对抗DDoS攻击

mod_dosevasive是一个Apache上的可选模块,它能应对一些基于HTTP的拒绝服务攻击,就是常说的Dos或者DDos攻击,这种攻击是让很多大小网站都头疼的攻击方式,mod_dosevasive从Apache1.3开始出现,虽然不能完全彻底的防止大规模的DDos攻击,但是对于普通的攻击来说,还是非常不错的选择。   我的服务器(http://www.toplee.com/blog/)

heiyeluren的blog(黑夜路人的开源世界) 1884

小程序真机调试蓝牙可以使用,线上发布版本蓝牙无法使用

小程序提示请打开蓝牙,微信小程序蓝牙无法连接,小程序真机调试蓝牙可以使用,线上版本蓝牙无法使用,测试环境蓝牙正常,开发环境蓝牙正常,发布后蓝牙无法使用

renkai721的专栏 826

【BlueZ】编译产物详解:可执行文件/库文件/工具的生成路径与用途

BlueZ二次开发编译产物机制解析 摘要:在BlueZ蓝牙协议栈二次开发中,90%的报错源于对编译产物类型和路径的混淆。本文系统剖析BlueZ的三阶段编译机制:1)配置阶段生成Makefile;2)编译阶段在.libs目录下产生临时库和可执行文件(不可直接运行);3)安装阶段将产物部署到系统标准路径。重点解析守护进程、命令行工具、动态库的核心路径差异,并针对五大高频问题(如临时库运行崩溃、动态库不匹配、系统覆盖等)给出解决方案。

byte轻骑兵的技术小窝 1万+

bsd比linux节省内存,Freebsd还是Linux?作为BGP路由器超过100mbps

多年来,我们已经为关键基​​础设施做到了这一点.我们通过Quagga的bgpd获取三个完整的上游BGP源,它使用高达658MB的RAM来运行整个系统.为此,Debian在我们的经验中比其他操作系统更加可靠(并且它还需要较少的安全更新,其最小安装占用空间,导致比我们尝试的其他两个操作系统更少的重新启动).我们使用Ksplice,因此我们只启动关键包更新.不要担心与ISP的其他供应商的兼容性…RIPE...

weixin_30014265的博客 373

使用R语言读取和处理CSV数据集

查看数据集的结构str(data)# 查看数据集的摘要统计信息str()函数将显示数据集的结构信息,包括变量名称、类型和前几行的值。summary()函数将提供数据集的摘要统计信息,如均值、中位数、最小值、最大值等。

CyberGenius的博客 3855

使用Freebsd+IPFW 防小规模DDOS攻击

2019独角兽企业重金招聘Python工程师标准>>> ...

weixin_34266504的博客 195

深度学习工具包 DeepLearningToolbox

深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain's apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012",}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath('DeepLearnToolbox'));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand('state',0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W'); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand('state',0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = 'sigm';%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.10, 'Too big error');```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand('state',0)sae = saesetup([784 100]);sae.ae{1}.activation_function = 'sigm';sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)')% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = 'sigm';nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.16, 'Too big error');```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x',28,28,60000))/255;test_x = double(reshape(test_x',28,28,10000))/255;train_y = double(train_y');test_y = double(test_y');%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you'll get around 1.2% errorrand('state',0)cnn.layers = { struct('type', 'i') %input layer struct('type', 'c', 'outputmaps', 6, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %sub sampling layer struct('type', 'c', 'outputmaps', 12, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er<0.12, 'Too big error');```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand('state',0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.08, 'Too big error');%% ex2 neural net with L2 weight decayrand('state',0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex3 neural net with dropoutrand('state',0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex4 neural net with sigmoid activation functionrand('state',0)nn = nnsetup([784 100 10]);nn.activation_function = 'sigm'; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex5 plotting functionalityrand('state',0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = 'softmax'; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand('state',0)nn = nnsetup([784 20 10]); nn.output = 'softmax'; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

jdk-8u144-linux-x64.tar.gz.

该资源为搭建Linux系统Java环境用,资源的后缀为tar.gz格式的压缩包

FreeBSD安全配置小结

刚刚装好FreeBSD,接下来将对其进行简单的安全配置。 1. 彻底关闭sendmail 添加 sendmail_enable="NONE" 到 /etc/rc.conf 2. 让syslogd仅记录本机 添加 syslogd_flags="-ss" 到 /etc/rc.conf 3. 修改/etc/ttys 将 console 该行末尾 secure 改为 insec

bzjing的专栏 1347

TMS_WebGMaps_1.9.8.0_Full_Source

TMS_WebGMaps_1.9.8.0_Full_Source 全源码 delphi cbuilder

Apache Flink 零基础

低代码、易开发、易维护、可读性强,适配实时数仓分层、指标统计、数据清洗、多源数据关联等绝大多数业务场景,支持Kafka、Doris、MySQL、Hive等主流组件读写,是企业实时开发主流方案。:接收客户端提交的实时/离线任务、解析任务逻辑、生成DAG执行流程图、分配集群资源、调度任务运行、管理Checkpoint/Savepoint、处理任务故障重启、协调集群节点状态。手动触发的状态快照,主要用于任务升级、代码迭代、版本更新、集群迁移、任务重启等运维操作,保证业务无感知、数据不错乱、任务无缝恢复。

2402_85354210的博客 314

深入 Apache Hudi Write Operations:一次 Upsert 到底经历了什么?

Apache Hudi Write Operations

喻师傅的学习笔记 663

每天认识一个组件:Apache Flink

Flink 的核心价值不只是“实时”,而是把持续数据流、事件时间、业务状态和一致恢复放入同一个分布式运行时中。对于实时指标、持续 ETL、CDC、欺诈检测和事件驱动应用,它提供了一套比“消息队列加手工状态管理”更完整的计算模型。

weixin_47983718的博客 622

每天认识一个组件:Apache StreamPark

StreamPark 解决的核心问题,不是如何执行流计算,而是如何让流处理应用以统一、可管理的方式进入生产环境,它把 Flink 应用开发与运维中的重复工作收拢到统一控制面。

weixin_47983718的博客 477

Apache Doris 与 SelectDB 是什么关系?从开源技术到面向 Agent 的极速分析数据库

Apache Doris 与 SelectDB 是什么关系?了解二者的开源技术渊源,以及 SelectDB Cloud、Enterprise、阿里云瑶池数据库 SelectDB、信创适配与面向 Agent 的极速分析数据库能力。

SelectDB 482
上一篇: Zend_Db_Table Relationships 翻译和注释
下一篇: crontab 的格式备忘
subnet
博客等级 码龄23年 9粉丝 15原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值