Tuesday, November 16, 2021

[SOLVED] time telnet apache 2.4.33 centOS7

Issue

When I am trying to time telnet XX.XX.XX.XX 80 my apache 2.4.6 server on centOS7 the result is 51 sec.

I manage to lower it with reqtimeout_module using

RequestReadTimeout header=1
RequestReadTimeout body=1

but its never less than 32 sec. Found info, about this, is a known bug on 2.4.6 (if I understand it correctly) and 30sec is hardcoded and can't be changed.

so I update it to 2.4.33 but nothing changed. Is there any way to make this time lower?


Solution

You can set AcceptFilter http none inside /etc/httpd/conf/httpd.conf.

By default, on Linux AcceptFilter is using the TCP_DEFER_ACCEPT socket option (from manpages):

TCP_DEFER_ACCEPT (since Linux 2.4)
  Allow a listener to be awakened only when data arrives on the
  socket.  Takes an integer value (seconds), this can bound the
  maximum number of attempts TCP will make to complete the
  connection.  This option should not be used in code intended
  to be portable.

The default value for that option on centos7 seems to be 30 (see this answer).

Another way to do that is by using apache-module-sockopts:

LoadModule sockopts_module libexec/mod_sockopts.so
AddModule mod_sockopts.c

<IfModule mod_sockopts.c>
    # TCP_DEFER_ACCEPT
    SoTcpDeferAccept 20
</IfModule>


Answered By - Nikolay Konovalov