0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

WPA2/3-Enterprise EPA-TLS方式のための自己署名証明書作成のメモ書き

Last updated at Posted at 2025-06-27

claude-v3.7-sonnetに下書きしてもらって実働確認した手順。

RADISU Server設定まで

事前準備

/usr/ssl/openssl.cnfを書き換える。

  • copy_extensions = copyを探してコメントアウトを外す
  • req_extensions = v3_reqを探してコメントアウトを外す

Root CA証明書の作成

# Root CA用のディレクトリを作成
mkdir -p ca/root
cd ca

# Root CA用の秘密鍵を生成(RSA 3072ビット)
openssl genrsa -out root/ca.key 3072

# Root CA証明書を作成(有効期限10年)
openssl req -x509 -new -nodes -key root/ca.key -sha256 -days 3650 -out root/ca.crt -subj "/C=JP/ST=Tokyo/L=Tokyo/O=Your Organization/OU=Your Unit/CN=Your Root CA"

git bash/MSYS2で作るときは次のように引数変換を殺す必要があります。

MSYS2_ARG_CONV_EXCL="*" openssl req -x509 -new -nodes -key root/ca.key -sha256 -days 3650 -out root/ca.crt -subj "/C=JP/ST=Tokyo/L=Tokyo/O=Your Organization/OU=Your Unit/CN=Your Root CA"

サーバー証明書の作成

# サーバー証明書用のディレクトリを作成
mkdir -p server
cd server

# サーバー用の秘密鍵を生成
openssl genrsa -out server.key 2048

# 証明書署名要求(CSR)を作成
openssl req -new -key server.key -out server.csr -subj "/C=JP/ST=Tokyo/L=Tokyo/O=Your Organization/OU=Your Unit/CN=freeradius.example.work"

# SANを含める設定ファイルを作成
cat > server_ext.cnf << EOF
authorityKeyIdentifier=keyid,issuer
basicConstraints=CA:FALSE
keyUsage = digitalSignature, nonRepudiation, keyEncipherment, dataEncipherment
subjectAltName = @alt_names

[alt_names]
DNS.1 = freeradius.example.work
EOF

## Root CAでサーバー証明書に署名(SHA384アルゴリズム使用)
openssl x509 -req -in server.csr -CA ../root/ca.crt -CAkey ../root/ca.key -CAcreateserial -out server.crt -days 365 -sha384 -extfile server_ext.cnf

PKCS#12ファイルの作成

サーバー証明書、その秘密鍵、Root CA証明書を含むPKCS#12ファイルを作成する。

# PKCS#12ファイルの作成
openssl pkcs12 -export -out freeradius.p12 -inkey server.key -in server.crt -certfile ../root/ca.crt -name "FreeRADIUS Server Certificate"
# 確認
openssl pkcs12 -info -in freeradius.p12

こうしてできたfreeradius.p12を RADIUSサーバーに登録する。

クライアント証明書発行

# クライアント証明書用のディレクトリを作成
mkdir -p ca/client
cd ca

# クライアント用の秘密鍵を生成
openssl genrsa -out client/client.key 2048

# クライアント証明書署名要求(CSR)を作成
# ここではクライアント名を "user1" としていますが、必要に応じて変更してください
openssl req -new -key client/client.key -out client/client.csr -subj "/C=JP/ST=Tokyo/L=Tokyo/O=Your Organization/OU=Your Unit/CN=user1"

# クライアント証明書用の拡張設定ファイルを作成
cat > client/client_ext.cnf << EOF
authorityKeyIdentifier=keyid,issuer
basicConstraints=CA:FALSE
keyUsage = digitalSignature, nonRepudiation, keyEncipherment, dataEncipherment
extendedKeyUsage = clientAuth
EOF

# Root CAでクライアント証明書に署名
openssl x509 -req -in client/client.csr -CA root/ca.crt -CAkey root/ca.key -CAcreateserial -out client/client.crt -days 365 -sha256 -extfile client/client_ext.cnf

クライアント用PKCS#12ファイルの作成

# クライアント用PKCS#12ファイルの作成
openssl pkcs12 -export -out client/client.p12 \
  -inkey client/client.key \
  -in client/client.crt \
  -certfile root/ca.crt \
  -name "WPA3-Enterprise Client Certificate" \
  -legacy -keypbe PBE-SHA1-3DES -certpbe PBE-SHA1-3DES
openssl pkcs12 -info -in client/client.p12

実働確認した限り、Android/iOSでは-legacy -keypbe PBE-SHA1-3DES -certpbe PBE-SHA1-3DESがないと読み込めなかった、なんで?

複数人分クライアント証明書を作る場合はclient/client_ext.cnfは使いまわして良くて、他のコマンドを人数分叩く。

0
0
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
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?