「OpenVPN/チェックリストガイド」の版間の差分
表示
< OpenVPN
削除された内容 追加された内容
Kusanaginoturugi (トーク | 投稿記録) 英語版より転載 |
Kusanaginoturugi (トーク | 投稿記録) |
||
| (同じ利用者による、間の10版が非表示) | |||
| 1行目: | 1行目: | ||
[[Category: |
[[Category:仮想プライベートネットワーク]] |
||
[[en:OpenVPN |
[[en:OpenVPN/Checklist_guide]] |
||
この記事では、OpenVPN に必要なインストール手順をまとめています。チュートリアルについては、[[OpenVPN]] を参照してください。 |
|||
This article summarizes the install process required for OpenVPN. See [[OpenVPN]] instead for a walkthrough. |
|||
==インストール== |
|||
==Install== |
|||
{{Pkg|openvpn}} と {{Pkg|easy-rsa}} パッケージを[[インストール]]します。 |
|||
== データの準備 == |
|||
==Prepare data== |
|||
* |
* {{ic|/etc/easy-rsa}} を {{ic|/etc/openvpn/easy-rsa}} にコピーし、そこに移動します(cd) |
||
* ご希望の情報を入力して {{ic|vars}} ファイルを編集します。詳細は [[easy-rsa スクリプトを使用して公開キー基盤を作成する]] を参照してください。 |
|||
* Edit the {{ic|vars}} file with the information you want. Read [[Create a Public Key Infrastructure Using the easy-rsa Scripts]] for details. |
|||
* 以前のキーをクリーンアップします: |
|||
* Clean up any previous keys: |
|||
{{bc|# easyrsa clean-all}} |
{{bc|# easyrsa clean-all}} |
||
== 証明書の生成 == |
|||
==Generate the certificates== |
|||
* CA 作成のためのシードを作成します |
|||
* Create a seed for the CA creation |
|||
{{bc|1=# dd if=/dev/urandom of=pki/.rnd bs=256 count=1}} |
{{bc|1=# dd if=/dev/urandom of=pki/.rnd bs=256 count=1}} |
||
* |
* 「証明機関 (certificate authority)」のキーを作成します |
||
{{bc|# easyrsa build-ca nopass}} |
{{bc|# easyrsa build-ca nopass}} |
||
* サーバー用の証明書と秘密キーを作成します |
|||
* Create certificate and private key for the server |
|||
{{bc|# easyrsa build-server-full ''<server-name>'' nopass}} |
{{bc|# easyrsa build-server-full ''<server-name>'' nopass}} |
||
* |
* サーバー用の Diffie-Hellman pem ファイルを作成します。 |
||
{{bc|# easyrsa gen-dh}} |
{{bc|# easyrsa gen-dh}} |
||
* 各クライアント用の証明書を作成します。 |
|||
* Create a certificate for each client. |
|||
{{bc|# easyrsa build-client-full ''<client-name>'' nopass}} |
{{bc|# easyrsa build-client-full ''<client-name>'' nopass}} |
||
すべての証明書は {{ic|pki}} ディレクトリに格納されます。間違えた場合は、{{ic|easyrsa clean-all}} を実行して最初からやり直すことができます。 |
|||
All certificates are stored in {{ic|pki}} directory. If you mess up, you can start all over by doing a {{ic|easyrsa clean-all}} |
|||
各クライアントには {{ic|ca.crt}} とそのクライアント固有の crt と key ファイルをコピーします。 |
|||
Copy to each client the {{ic|ca.crt}}, and their respective crt and key files. |
|||
== サーバーの設定 == |
|||
| ⚫ | |||
==Setting up the server== |
|||
| ⚫ | |||
{{hc|/etc/openvpn/server/myvpnserver.conf| |
{{hc|/etc/openvpn/server/myvpnserver.conf| |
||
port ''<port>'' |
port ''<port>'' |
||
| 56行目: | 58行目: | ||
status /tmp/vpn.status 10 |
status /tmp/vpn.status 10 |
||
}} |
}} |
||
* Start and, optionally, enable for autostart on boot, the daemon. (In this example, is {{ic|openvpn-server@myvpnserver.service}}) |
|||
* サービスを開始します。起動時に開始する場合は、デーモンを有効化します。この例では、{{ic|openvpn-server@''myvpnserver''.service}} となります。 |
|||
Read [[Daemon]] for more information. |
|||
詳しくは[[デーモン]]をお読みください。 |
|||
==Setting up the clients== |
|||
* Create a .conf file for each client like this: |
|||
== クライアントの設定 == |
|||
| ⚫ | |||
各クライアント用に以下のような ''.conf'' ファイルを作成します: |
|||
| ⚫ | |||
client |
client |
||
remote ''<server>'' ''<port>'' |
remote ''<server>'' ''<port>'' |
||
| 77行目: | 82行目: | ||
comp-lzo |
comp-lzo |
||
}} |
}} |
||
* Start the connection with |
|||
| ⚫ | |||
Optionally, enable for autostart on boot the daemon. (In this example, is {{ic|openvpn-client@a-client-conf-file.service}}) |
|||
| ⚫ | |||
Read [[Daemon]] for more information. |
|||
オプションで、起動時のデーモン自動起動を有効にします。(この例では、{{ic|openvpn-client@a-client-conf-file.service}})。 |
|||
詳しくは[[デーモン]]をお読みください。 |
|||
2024年8月14日 (水) 23:08時点における最新版
この記事では、OpenVPN に必要なインストール手順をまとめています。チュートリアルについては、OpenVPN を参照してください。
インストール
openvpn と easy-rsa パッケージをインストールします。
データの準備
/etc/easy-rsaを/etc/openvpn/easy-rsaにコピーし、そこに移動します(cd)- ご希望の情報を入力して
varsファイルを編集します。詳細は easy-rsa スクリプトを使用して公開キー基盤を作成する を参照してください。 - 以前のキーをクリーンアップします:
# easyrsa clean-all
証明書の生成
- CA 作成のためのシードを作成します
# dd if=/dev/urandom of=pki/.rnd bs=256 count=1
- 「証明機関 (certificate authority)」のキーを作成します
# easyrsa build-ca nopass
- サーバー用の証明書と秘密キーを作成します
# easyrsa build-server-full <server-name> nopass
- サーバー用の Diffie-Hellman pem ファイルを作成します。
# easyrsa gen-dh
- 各クライアント用の証明書を作成します。
# easyrsa build-client-full <client-name> nopass
すべての証明書は pki ディレクトリに格納されます。間違えた場合は、easyrsa clean-all を実行して最初からやり直すことができます。
各クライアントには ca.crt とそのクライアント固有の crt と key ファイルをコピーします。
サーバーの設定
以下の内容で /etc/openvpn/server/myvpnserver.conf を作成します:
/etc/openvpn/server/myvpnserver.conf
port <port> proto tcp dev tun0 ca /etc/openvpn/easy-rsa/pki/ca.crt cert /etc/openvpn/easy-rsa/pki/issued/<server-name>.crt key /etc/openvpn/easy-rsa/pki/private/<server-name>.key dh /etc/openvpn/easy-rsa/pki/<your pem file> server <desired base ip> 255.255.255.0 ifconfig-pool-persist ipp.txt keepalive 10 120 comp-lzo user nobody group nobody persist-key persist-tun status /var/log/openvpn-status.log verb 3 log-append /var/log/openvpn status /tmp/vpn.status 10
- サービスを開始します。起動時に開始する場合は、デーモンを有効化します。この例では、
openvpn-server@myvpnserver.serviceとなります。
詳しくはデーモンをお読みください。
クライアントの設定
各クライアント用に以下のような .conf ファイルを作成します:
/etc/openvpn/client/a-client-conf-file.conf
client remote <server> <port> dev tun0 proto tcp resolv-retry infinite nobind persist-key persist-tun verb 2 ca ca.crt cert <client crt file with full path> key <client key file with full path> comp-lzo
# openvpn a-client-conf-file.conf &
で接続を開始する。
オプションで、起動時のデーモン自動起動を有効にします。(この例では、openvpn-client@a-client-conf-file.service)。
詳しくはデーモンをお読みください。