#author("2024-02-23T19:06:50+09:00","","")
*** 再び重篤な設定ミスが発覚(2024-02-20) [#k69d8dfa]
- サーバーのディスク ディレクトリ レイアウトの変更に伴って apache2 設定の DocumentRoot を変更
- しかし、&color(red){セキュリティ設定のディレクトリ指定が前のままだった}; ので、実際にはセキュリティ無し状態になっていた
- 今回は Google Crawler をブロックしていたので、検索に掛からず外部からのアクセスは(多くは)無かった

*** セキュリティ設定のディレクトリを修正し、正しくセキュリティ機構が起動することが確認された、が [#f665d54f]
- IP アドレスによる制御は正常
- クライアント証明書の判定はエラー(証明書でアクセスが許可されていない)⇒ 2024/02/22 再確認し、''クライアント証明書は有効に機能していた''
- ID/パスワード による BASIC 認証は正常に動作した
-- munakata のパスワードを更新した ⇒ frex7785KGB (20240221 更新)
- Google OTP の機能は無効化されている

*** Google OTP の有効化 ⇒ &color(red){''ハッシュ生成アルゴリズムに非推奨となった MD5 が使われていて(更新なし)ビルドできなので、一旦断念''};[#gea2aed7]
- [[Google code 時代の開発:https://code.google.com/archive/p/mod-authn-otp/]]
- [[Google の mod-auth-otp リポジトリ:https://github.com/archiecobbs/mod-authn-otp]]
-- /raid_vol/home/munakata/git/mod-authn-otp 配下にファイルを確認 ⇒ 現状が最新であることを確認
-- &ref(mod-authn-otp.png);

- apache2 設定ファイル内の記述
 Require not env force_drop
 AuthType Basic
 AuthName "OTP Authentication"
 AuthBasicProvider OTP
 Require valid-user
 OTPAuthUsersFile /var/www/html/otp/users
 OTPAuthMaxLinger 3600
 OTPAuthMaxOTPFailure 200
 OTPAuthLogoutOnIPChange On
 OTPAuthPINAuthProvider file

- mod-authn-otp のビルド ⇒ &color(red){''md5 が SSL3.0 で無効化されたという理由でビルドがエラーになる''};
 [KGB2] munakata:~/git/mod-authn-otp$ ./autogen.sh
 (complete without error)
 
 [KGB2] munakata:~/git/mod-authn-otp$ ./configure
 (complete without error)
 
 [KGB2] munakata:~/git/mod-authn-otp$ make
 make  all-am
 make[1]: ディレクトリ '/raid_vol/home/munakata/git/mod-authn-otp' に入ります
 gcc -DHAVE_CONFIG_H -I.     -O3 -Wall -Waggregate-return -Wcast-align -Wchar-subscripts -Wcomment -Wformat -Wimplicit -Wmissing-declarations -Wmissing- prototypes -Wnested-externs -Wno-long-long         -Wparentheses -Wpointer-arith -Wredundant-decls -Wreturn-type -Wswitch -Wtrigraphs         -Wuninitialized   
 -Wunused -Wwrite-strings -Wshadow -Wstrict-prototypes -Wcast-qual -MT otptool.o -MD -MP -MF .deps/otptool.Tpo -c -o otptool.o otptool.c
 mv -f .deps/otptool.Tpo .deps/otptool.Po
 gcc -DHAVE_CONFIG_H -I.     -O3 -Wall -Waggregate-return -Wcast-align -Wchar-subscripts -Wcomment -Wformat -Wimplicit -Wmissing-declarations -Wmissing- prototypes -Wnested-externs -Wno-long-long         -Wparentheses -Wpointer-arith -Wredundant-decls -Wreturn-type -Wswitch -Wtrigraphs         -Wuninitialized - Wunused -Wwrite-strings -Wshadow -Wstrict-prototypes -Wcast-qual -MT hotp.o -MD -MP -MF .deps/hotp.Tpo -c -o hotp.o hotp.c
 mv -f .deps/hotp.Tpo .deps/hotp.Po
 gcc -DHAVE_CONFIG_H -I.     -O3 -Wall -Waggregate-return -Wcast-align -Wchar-subscripts -Wcomment -Wformat -Wimplicit -Wmissing-declarations -Wmissing-prototypes -Wnested-externs -Wno-long-long         -Wparentheses -Wpointer-arith -Wredundant-decls -Wreturn-type -Wswitch -Wtrigraphs         -Wuninitialized -Wunused -Wwrite-strings -Wshadow -Wstrict-prototypes -Wcast-qual -MT motp.o -MD -MP -MF .deps/motp.Tpo -c -o motp.o motp.c
 motp.c: In function ‘motp’:
 motp.c:37:5: warning: ‘MD5’ is deprecated: Since OpenSSL 3.0 [-Wdeprecated-declarations]
    37 |     MD5((u_char *)hashbuf, strlen(hashbuf), hash);
       |     ^~~
 In file included from otptool.h:32,
                  from motp.c:20:
 /usr/include/openssl/md5.h:52:38: note: declared here
    52 | OSSL_DEPRECATEDIN_3_0 unsigned char *MD5(const unsigned char *d, size_t n,
       |                                      ^~~
 motp.c:36:48: warning: ‘__builtin___snprintf_chk’ output may be truncated before the last format character [-Wformat-truncation=]
    36 |     snprintf(hashbuf, sizeof(hashbuf), "%lu%s%s", counter, keybuf, pin);
       |                                                ^
 In file included from /usr/include/stdio.h:894,
                  from otptool.h:24,
                  from motp.c:20:
 /usr/include/x86_64-linux-gnu/bits/stdio2.h:71:10: note: ‘__builtin___snprintf_chk’ output 2 or more bytes (assuming 257) into a destination of size 256
    71 |   return __builtin___snprintf_chk (__s, __n, __USE_FORTIFY_LEVEL - 1,
       |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    72 |                                    __glibc_objsize (__s), __fmt,
       |                                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    73 |                                    __va_arg_pack ());
       |                                    ~~~~~~~~~~~~~~~~~
 mv -f .deps/motp.Tpo .deps/motp.Po
 gcc -DHAVE_CONFIG_H -I.     -O3 -Wall -Waggregate-return -Wcast-align -Wchar-subscripts -Wcomment -Wformat         -Wimplicit -Wmissing-declarations -Wmissing- prototypes -Wnested-externs -Wno-long-long         -Wparentheses -Wpointer-arith -Wredundant-decls -Wreturn-type -Wswitch -Wtrigraphs         -Wuninitialized -Wunused -Wwrite-strings -Wshadow -Wstrict-prototypes -Wcast-qual -MT phex.o -MD -MP -MF .deps/phex.Tpo -c -o phex.o phex.c
 mv -f .deps/phex.Tpo .deps/phex.Po
 gcc  -O3 -Wall -Waggregate-return -Wcast-align -Wchar-subscripts -Wcomment -Wformat         -Wimplicit -Wmissing-declarations -Wmissing-prototypes -Wnested-externs -Wno-long-long         -Wparentheses -Wpointer-arith -Wredundant-decls -Wreturn-type -Wswitch -Wtrigraphs         -Wuninitialized -Wunused -Wwrite-strings -Wshadow -Wstrict-prototypes -Wcast-qual   -o otptool otptool.o hotp.o motp.o phex.o  -lapr-1 -lcrypto
 gcc -DHAVE_CONFIG_H -I.     -O3 -Wall -Waggregate-return -Wcast-align -Wchar-subscripts -Wcomment -Wformat         -Wimplicit -Wmissing-declarations -Wmissing-prototypes -Wnested-externs -Wno-long-long         -Wparentheses -Wpointer-arith -Wredundant-decls -Wreturn-type -Wswitch -Wtrigraphs         -Wuninitialized -Wunused -Wwrite-strings -Wshadow -Wstrict-prototypes -Wcast-qual -MT otplock.o -MD -MP -MF .deps/otplock.Tpo -c -o otplock.o otplock.c
 otplock.c:22:10: fatal error: apr-1/apr_file_io.h: そのようなファイルやディレクトリはありません
    22 | #include <apr-1/apr_file_io.h>
       |          ^~~~~~~~~~~~~~~~~~~~~
 compilation terminated.
 make[1]: *** [Makefile:477: otplock.o] エラー 1
 make[1]: ディレクトリ '/raid_vol/home/munakata/git/mod-authn-otp' から出ます
 make: *** [Makefile:349: all] エラー 2


- [[OTP用のUserファイル作成:https://github.com/archiecobbs/mod-authn-otp/blob/master/users.sample]] ⇒ &color(red){''これもスクリプトが古く python3 ではエラーが出る''};

-- [[Apacheへのアクセスに二要素認証を適用する(2016年の記事):https://qiita.com/kz-takahashi/items/af8ea7d9894f26a65068]] のユーザー作成スクリプトを利用
-- &ref(otp_user.sh); ⇒ 但し、このスクリプトは python3 ではエラーになるので修正が必要だった
-- このエラーは print に括弧をつけるだけだが
-- &ref(script_error.png);
-- こちらはバイナリー型の扱いに変更する必要あり
-- &ref(script_error2.png);

- ''以前稼働していたユーザーファイル( &ref(users); )が残っていた'' ので、これを再利用することにする。(が、mod-authn-opt のインストールが出来ないので動かせない)
- &ref(users_muna.png);

*** クライアント証明書の再有効化(保留)⇒ 正常に動作していたので、最有効化は必要なかった [#tb4376f7]

トップ   編集 差分 履歴 添付 複製 名前変更 リロード   新規 一覧 検索 最終更新   ヘルプ   最終更新のRSS