LoginSignup
3
3

More than 5 years have passed since last update.

【DOS対策】httpd-develをインストールしたのに、apxsコマンドがないと怒られた。(mod_dosdetector)

Last updated at Posted at 2017-07-29

はじめに

こちらの方の記事を参考に、DOS対策を行っていました。
順調に進んでいたのですが、makeコマンドを実行すると下記のように怒られました。。。

# make
/usr/sbin/apxs -c    mod_dosdetector.c
make: /usr/sbin/apxs: Command not found

httpd-develの確認

apxs コマンドは、httpd-develの中にあるということなので、インストールしているか確認します。

# rpm -qa | grep httpd
httpd24u-devel-2.4.27-1.ius.centos7.x86_64
httpd24u-tools-2.4.27-1.ius.centos7.x86_64
httpd24u-2.4.27-1.ius.centos7.x86_64
httpd24u-mod_ssl-2.4.27-1.ius.centos7.x86_64
httpd24u-filesystem-2.4.27-1.ius.centos7.noarch

あれ。
ちゃんとhttpd24u-devel-2.4.27-1.ius.centos7.x86_64はいらっしゃいますね。

原因(apxsのパスが違っていた!)

httpd-develはきちんとインストールされていました。
てことは、パスがきちんと通っていないのかな?確認しましょう!

まずは、apxsコマンドのパスの場所を確認。
# which apxs
/bin/apxs

これですね。
さっきのエラーを確認すると。。。。

# make
/usr/sbin/apxs -c    mod_dosdetector.c
make: /usr/sbin/apxs: Command not found
make: *** [mod_dosdetector.so] Error 127

実際のパスは/bin/apxs/なのに、/usr/sbin/apxsを実行しようとしています。。。

解決策(Makefile内のパスを/bin/apxsから、/usr/sbin/apxsに変更!)

さて、実行パスを/bin/apxsに変更しましょう。

makeコマンドで実行しているMakefileを開きます! ※該当箇所のみ記載
# vi /tmp/mod_dosdetector-0.2/Makefile
6行目らへんを変更
●変更前
APXS=/usr/sbin/apxs
●変更後
APXS=/bin/apxs

よし!早速make実行!

# make
/bin/apxs -c    mod_dosdetector.c
/usr/lib64/apr15u-1/build/libtool --silent --mode=compile gcc -std=gnu99 -prefer-pic -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic  -DLINUX -D_REENTRANT -D_GNU_SOURCE -pthread -I/usr/include/httpd  -I/usr/include/apr15u-1   -I/usr/include/apr15u-1   -c -o mod_dosdetector.lo mod_dosdetector.c && touch mod_dosdetector.slo
mod_dosdetector.c: In function 'create_shm':
mod_dosdetector.c:143:5: warning: format '%d' expects argument of type 'int', but argument 9 has type 'size_t' [-Wformat=]
     ap_log_error(APLOG_MARK, APLOG_STARTUP, 0, NULL,
     ^
mod_dosdetector.c: In function 'dosdetector_handler':
mod_dosdetector.c:260:5: warning: implicit declaration of function 'ap_default_type' [-Wimplicit-function-declaration]
     if (!content_type) content_type = ap_default_type(r);
     ^
mod_dosdetector.c:260:37: warning: assignment makes pointer from integer without a cast [enabled by default]
     if (!content_type) content_type = ap_default_type(r);
                                     ^
mod_dosdetector.c:262:25: error: 'conn_rec' has no member named 'remote_ip'
  address = r->connection->remote_ip;
                         ^
mod_dosdetector.c:275:22: error: 'conn_rec' has no member named 'remote_addr'
  addr = r->connection->remote_addr->sa.sin.sin_addr;
                      ^
mod_dosdetector.c:283:6: warning: unused variable 'last_count' [-Wunused-variable]
  int last_count = client->count;
      ^
mod_dosdetector.c: In function 'register_hooks':
mod_dosdetector.c:465:8: warning: ignoring return value of 'tmpnam', declared with attribute warn_unused_result [-Wunused-result]
  tmpnam(shm_name);
        ^
mod_dosdetector.c: In function 'create_shm':
mod_dosdetector.c:135:8: warning: ignoring return value of 'tmpnam', declared with attribute warn_unused_result [-Wunused-result]
  tmpnam(lock_name);
        ^
apxs:Error: Command failed with rc=65536
.
make: *** [mod_dosdetector.so] Error 1

・・・・・・なんか新しいエラーが2つほど出ましたね。。。

mod_dosdetector.c:262:25: error: 'conn_rec' has no member named 'remote_ip'
  address = r->connection->remote_ip;
                         ^
mod_dosdetector.c:275:22: error: 'conn_rec' has no member named 'remote_addr'
  addr = r->connection->remote_addr->sa.sin.sin_addr;

この問題解決は、こちらの記事へ!

3
3
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
3