| | 49 | ==== マスタCA証明書と鍵を生成する ==== |
| | 50 | * http://freescitech.net/2/wiki/?OpenVPN%202%20HOWTO%20%E6%97%A5%E6%9C%AC%E8%AA%9E%E8%A8%B3#abd6e0dc に従って作成する |
| | 51 | |
| | 52 | * sudo cp -av /usr/share/doc/openvpn/examples/easy-rsa/2.0/ /etc/openvpn/easy-rsa |
| | 53 | * sudo vim /etc/openvpn/easy-rsa/vars |
| | 54 | * sudo su - |
| | 55 | * /etc/openvpn/easy-rsa# . ./vars |
| | 56 | * /etc/openvpn/easy-rsa# ./clean-all |
| | 57 | * /etc/openvpn/easy-rsa# ./build-ca |
| | 58 | {{{ |
| | 59 | Country Name (2 letter code) [JP]: |
| | 60 | State or Province Name (full name) [Ibaraki]: |
| | 61 | Locality Name (eg, city) [Tsukuba]: |
| | 62 | Organization Name (eg, company) [mitty.jp]:OpenVPN CA |
| | 63 | Organizational Unit Name (eg, section) []: |
| | 64 | Common Name (eg, your name or your server's hostname) [mitty.jp CA]:OpenVPN CA |
| | 65 | Email Address [root (X) mitty.jp]: |
| | 66 | }}} |
| | 67 | * /etc/openvpn/easy-rsa# ./build-key-server server |
| | 68 | {{{ |
| | 69 | Country Name (2 letter code) [JP]: |
| | 70 | State or Province Name (full name) [Ibaraki]: |
| | 71 | Locality Name (eg, city) [Tsukuba]: |
| | 72 | Organization Name (eg, company) [mitty.jp]: |
| | 73 | Organizational Unit Name (eg, section) []:OpenVPN Server |
| | 74 | Common Name (eg, your name or your server's hostname) [server]:server.mitty.jp |
| | 75 | Email Address [root (X) mitty.jp]: |
| | 76 | |
| | 77 | Please enter the following 'extra' attributes |
| | 78 | to be sent with your certificate request |
| | 79 | A challenge password []: |
| | 80 | An optional company name []: |
| | 81 | Using configuration from /etc/openvpn/easy-rsa/openssl.cnf |
| | 82 | Check that the request matches the signature |
| | 83 | Signature ok |
| | 84 | The Subject's Distinguished Name is as follows |
| | 85 | countryName :PRINTABLE:'JP' |
| | 86 | stateOrProvinceName :PRINTABLE:'Ibaraki' |
| | 87 | localityName :PRINTABLE:'Tsukuba' |
| | 88 | organizationName :PRINTABLE:'mitty.jp' |
| | 89 | organizationalUnitName:PRINTABLE:'OpenVPN Server' |
| | 90 | commonName :PRINTABLE:'server.mitty.jp' |
| | 91 | emailAddress :IA5STRING:'root (X) mitty.jp' |
| | 92 | Certificate is to be certified until Nov 13 13:43:33 2019 GMT (3650 days) |
| | 93 | Sign the certificate? [y/n]:y |
| | 94 | |
| | 95 | |
| | 96 | 1 out of 1 certificate requests certified, commit? [y/n]y |
| | 97 | Write out database with 1 new entries |
| | 98 | Data Base Updated |
| | 99 | }}} |
| | 100 | * /etc/openvpn/easy-rsa# ./build-key client |
| | 101 | {{{ |
| | 102 | Country Name (2 letter code) [JP]: |
| | 103 | State or Province Name (full name) [Ibaraki]: |
| | 104 | Locality Name (eg, city) [Tsukuba]: |
| | 105 | Organization Name (eg, company) [mitty.jp]: |
| | 106 | Organizational Unit Name (eg, section) []:OpenVPN Client |
| | 107 | Common Name (eg, your name or your server's hostname) [client]:client.mitty.jp |
| | 108 | Email Address [root (X) mitty.jp]: |
| | 109 | |
| | 110 | Please enter the following 'extra' attributes |
| | 111 | to be sent with your certificate request |
| | 112 | A challenge password []: |
| | 113 | An optional company name []: |
| | 114 | Using configuration from /etc/openvpn/easy-rsa/openssl.cnf |
| | 115 | Check that the request matches the signature |
| | 116 | Signature ok |
| | 117 | The Subject's Distinguished Name is as follows |
| | 118 | countryName :PRINTABLE:'JP' |
| | 119 | stateOrProvinceName :PRINTABLE:'Ibaraki' |
| | 120 | localityName :PRINTABLE:'Tsukuba' |
| | 121 | organizationName :PRINTABLE:'mitty.jp' |
| | 122 | organizationalUnitName:PRINTABLE:'OpenVPN Client' |
| | 123 | commonName :PRINTABLE:'client.mitty.jp' |
| | 124 | emailAddress :IA5STRING:'root (X) mitty.jp' |
| | 125 | Certificate is to be certified until Nov 13 13:44:25 2019 GMT (3650 days) |
| | 126 | Sign the certificate? [y/n]:y |
| | 127 | |
| | 128 | |
| | 129 | 1 out of 1 certificate requests certified, commit? [y/n]y |
| | 130 | Write out database with 1 new entries |
| | 131 | Data Base Updated |
| | 132 | }}} |
| | 133 | * /etc/openvpn/easy-rsa# ./build-dh |
| | 134 | |
| | 135 | * sudo ls -l /etc/openvpn/easy-rsa/keys/ |
| | 136 | {{{ |
| | 137 | -rw-r--r-- 1 root root 3928 2009-11-15 22:43 01.pem |
| | 138 | -rw-r--r-- 1 root root 3810 2009-11-15 22:44 02.pem |
| | 139 | -rw-r--r-- 1 root root 1208 2009-11-15 22:42 ca.crt |
| | 140 | -rw------- 1 root root 887 2009-11-15 22:42 ca.key |
| | 141 | -rw-r--r-- 1 root root 3810 2009-11-15 22:44 client.crt |
| | 142 | -rw-r--r-- 1 root root 712 2009-11-15 22:44 client.csr |
| | 143 | -rw------- 1 root root 887 2009-11-15 22:44 client.key |
| | 144 | -rw-r--r-- 1 root root 245 2009-11-15 22:45 dh1024.pem |
| | 145 | -rw-r--r-- 1 root root 260 2009-11-15 22:44 index.txt |
| | 146 | -rw-r--r-- 1 root root 20 2009-11-15 22:44 index.txt.attr |
| | 147 | -rw-r--r-- 1 root root 21 2009-11-15 22:43 index.txt.attr.old |
| | 148 | -rw-r--r-- 1 root root 130 2009-11-15 22:43 index.txt.old |
| | 149 | -rw-r--r-- 1 root root 3 2009-11-15 22:44 serial |
| | 150 | -rw-r--r-- 1 root root 3 2009-11-15 22:43 serial.old |
| | 151 | -rw-r--r-- 1 root root 3928 2009-11-15 22:43 server.crt |
| | 152 | -rw-r--r-- 1 root root 712 2009-11-15 22:43 server.csr |
| | 153 | -rw------- 1 root root 887 2009-11-15 22:43 server.key |
| | 154 | }}} |
| | 155 | |