Apache mod autoindex » 履歴 » リビジョン 2
リビジョン 1 (sylow castle, 2019/11/13 00:03) → リビジョン 2/5 (sylow castle, 2019/11/13 00:04)
# Apache memo ## 概要 あったことを適当に書いてく ## クライアント認証とOption Index ### やりたい事 - 特定ディレクトリにクライアント認証をかけたい - https://example.com/でアクセスしたときにapacheのインデックスページを出したい ### 設定状況 こんなディレクトリを持っていたとする: - DocumentRoot - ClientVerifyDir - FooDir - BarDir こんな設定だったりする: - ディレクトリClientVerifyDirにクライアント認証をかけている - ディレクトリDocumentRootにはクライアント認証をかけていない - DocumentRootにOption +Indexがついている - index.htmlとかはない ### 何が起きた https://example.com/でアクセスしたときにSSLのネゴシエーションに失敗する エラーログはこんな感じ ``` SSL Library Error: error:140890C7:SSL routines:ssl3_get_client_certificate:peer did not return a certificate -- No CAs known to server for verification? AH02261: Re-negotiation handshake failed ``` 結構悩んだのでメモしとく ### 原因(推測) 1. - https://example.com/にアクセス 1. - インデックスページを生成しようとする 1. - DocumentRootのエントリ「ClientVerifyDir」を読もうとする 1. - 一方ClientVerifyDirを読むにはクライアント認証が必要 アクセスしているDocumentRootはクライアント認証の提示をブラウザに要求していない 1. - クライアント認証は失敗する って感じなんだろうか。うーん、ディレクトリのread権限がなくて403 Forbidden的なしょぼいエラーと似ている気がする ### 対処 まず、ディレクトリ構造を変更 - DocumentRoot - SecretsDir - ClientVerifyDir - FooDir - BarDir クライアント認証かけるディレクトリをSecretsDirより下のものたちに。 ``` <Directory "DocumentRoot/SecretDir/*"> SSLVerifyClient require </Directory> ```