LoginSignup
37
30

More than 5 years have passed since last update.

オレオレ証明書を一撃で作るワンライナー

Posted at

なんかテストとかでオレオレ証明書がたくさん欲しいとき、いちいちインタラクティブに作成するのは面倒。

sudo openssl req -batch -new -x509 -newkey rsa:2048 -nodes -sha256 \
  -subj /CN=example.com/O=oreore -days 3650 \
  -keyout /etc/httpd/ssl.key/example.key \
  -out /etc/httpd/ssl.crt/example.crt

こんな感じでたくさん作れます。

for x in {0..9}; do
  sudo openssl req -batch -new -x509 -newkey rsa:2048 -nodes -sha256 \
    -subj /CN=$x.example.com/O=oreore -days 3650 \
    -keyout /etc/httpd/ssl.key/$x.key \
    -out /etc/httpd/ssl.crt/$x.crt
done
37
30
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
37
30