阻止Apache httpcore缓慢拒绝服务攻击

时间:2016-09-15 12:17:38

标签: java apache-httpcomponents ddos apache-httpasyncclient

我正在使用apache httpcore库来监听http请求,如下所示。

IOReactorConfig config = IOReactorConfig.custom() // Create instance of a custom Builder
                    .setTcpNoDelay(true) //
                    // Enable/disable SO_TIMEOUT with the specified timeout, in milliseconds. InputStream associated
                    // with this Socket will block for only this amount of time. If the timeout expires, a
                    // java.net.SocketTimeoutException
                    // is raised, though the Socket is still valid. The option must be enabled prior to entering the
                    // blocking operation to have effect. The timeout must be > 0. A timeout of zero is interpreted
                    // as an infinite timeout.
                    .setSoTimeout(PropertiesStorage.getCcsSocketTimeoutMilis()) //
                    .setSoReuseAddress(true) //
                    .setConnectTimeout(PropertiesStorage.getCcsConnectionTimeoutMilis()) //
                    // Determines the number of I/O dispatch threads to be used by the I/O reactor.
                    .setIoThreadCount(PropertiesStorage.getCcsDispatchThreadCount()) //
                    .build();

// Create instance of a server - reactor
private static ListeningIOReactor ioReactor = new  DefaultListeningIOReactor(config);

// Listening on specific port
ioReactor.listen(new InetSocketAddress(SERVER_IP, SERVER_PORT));

我想配置mod_reqtimeout,mod_qos和mod_security,以防止“缓慢拒绝服务”。但我不知道如何配置这些参数。 你能帮忙吗?

0 个答案:

没有答案