プロジェクト

全般

プロフィール

Apache mod autoindex » 履歴 » バージョン 1

sylow castle, 2019/11/13 00:03

1 1 sylow castle
# Apache memo
2
3
## 概要
4
5
あったことを適当に書いてく
6
7
## クライアント認証とOption Index
8
9
### やりたい事
10
11
- 特定ディレクトリにクライアント認証をかけたい
12
- https://example.com/でアクセスしたときにapacheのインデックスページを出したい
13
14
### 設定状況
15
16
こんなディレクトリを持っていたとする:
17
18
- DocumentRoot
19
  - ClientVerifyDir
20
  - FooDir
21
  - BarDir
22
23
こんな設定だったりする:
24
25
- ディレクトリClientVerifyDirにクライアント認証をかけている
26
- ディレクトリDocumentRootにはクライアント認証をかけていない
27
- DocumentRootにOption +Indexがついている
28
- index.htmlとかはない
29
30
### 何が起きた
31
32
https://example.com/でアクセスしたときにSSLのネゴシエーションに失敗する
33
34
エラーログはこんな感じ
35
36
```
37
SSL Library Error: error:140890C7:SSL routines:ssl3_get_client_certificate:peer did not return a certificate -- No CAs known to server for verification?
38
AH02261: Re-negotiation handshake failed
39
```
40
41
結構悩んだのでメモしとく
42
43
### 原因(推測)
44
45
- https://example.com/にアクセス
46
- インデックスページを生成しようとする
47
- DocumentRootのエントリ「ClientVerifyDir」を読もうとする
48
- 一方ClientVerifyDirを読むにはクライアント認証が必要
49
   アクセスしているDocumentRootはクライアント認証の提示をブラウザに要求していない
50
- クライアント認証は失敗する
51
52
って感じなんだろうか。うーん、ディレクトリのread権限がなくて403 Forbidden的なしょぼいエラーと似ている気がする
53
54
### 対処
55
56
まず、ディレクトリ構造を変更
57
58
- DocumentRoot
59
  - SecretsDir
60
      - ClientVerifyDir
61
  - FooDir
62
  - BarDir
63
64
クライアント認証かけるディレクトリをSecretsDirより下のものたちに。
65
66
```
67
<Directory "DocumentRoot/SecretDir/*">
68
    SSLVerifyClient require
69
</Directory>
70
```