Created
July 23, 2012 00:45
-
-
Save shimizukawa/3161518 to your computer and use it in GitHub Desktop.
FreeBSDでSSLサーバー鍵生成(俺俺証明書)したときの手順メモ
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
まず鍵を置くディレクトリを作成 | |
porsche# cd /usr/local/etc/apache2 | |
porsche# mkdir ssl.key ssl.crt | |
porsche# chmod 700 ssl.key ssl.crt | |
鍵の作成 | |
porsche# openssl genrsa -out ssl.key/server.key 1024 | |
Generating RSA private key, 1024 bit long modulus | |
...............................++++++ | |
...............................++++++ | |
e is 65537 (0x10001) | |
porsche# openssl req -new -days 365 -key ssl.key/server.key -out ssl.crt/server.csr | |
You are about to be asked to enter information that will be incorporated | |
into your certificate request. | |
What you are about to enter is what is called a Distinguished Name or a DN. | |
There are quite a few fields but you can leave some blank | |
For some fields there will be a default value, | |
If you enter '.', the field will be left blank. | |
----- | |
Country Name (2 letter code) [AU]:JP | |
State or Province Name (full name) [Some-State]:Tokyo | |
Locality Name (eg, city) []:Chofu | |
Organization Name (eg, company) [Internet Widgits Pty Ltd]:Shimizukawa Web | |
Organizational Unit Name (eg, section) []:Admin | |
Common Name (eg, YOUR name) []:www.freia.jp | |
Email Address []:[email protected] | |
Please enter the following 'extra' attributes | |
to be sent with your certificate request | |
A challenge password []: | |
An optional company name []: | |
認証鍵の作成 | |
porsch# openssl x509 -in ssl.crt/server.csr -out ssl.crt/server.crt -req -signkey ssl.key/server.key -days 365 | |
Signature ok | |
subject=/C=JP/ST=Tokyo/L=Chofu/O=Shimizukawa Web/OU=Admin/CN=www.freia.jp | |
Getting Private key | |
/etc/rc.confにSSLの起動設定。 | |
apache2_enable="YES" | |
apache2ssl_enable="YES" | |
ssl.confを修正 | |
# General setup for the virtual host | |
DocumentRoot "/usr/local/www/data" | |
ServerName www.freia.jp:443 | |
ServerAdmin [email protected] | |
ErrorLog /var/log/httpd/httpd-error.log | |
TransferLog /var/log/httpd/httpd-access.log | |
apache再起動 | |
porsche# /usr/local/etc/rc.d/apache2.sh restart | |
Performing sanity check on apache2 configuration: | |
Syntax OK | |
Stopping apache2. | |
Waiting for PIDS: 34477. | |
Starting apache2. | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment