linux:softether_vpn:wireguard

差分

このページの2つのバージョン間の差分を表示します。

この比較画面へのリンク

両方とも前のリビジョン 前のリビジョン
次のリビジョン
前のリビジョン
linux:softether_vpn:wireguard [2022/06/21 15:07] – [クライアント公開鍵をサーバーに登録] ともやんlinux:softether_vpn:wireguard [2023/03/14 06:17] (現在) – [NDSS 2017: WireGuard: Next Generation Kernel Network Tunnel] ともやん
行 1: 行 1:
-====== WireGuard ======+====== WireGuard - SoftEther VPN ======
 {{:linux:logo_of_wireguard.svg?400|WireGuard Logo}}\\ {{:linux:logo_of_wireguard.svg?400|WireGuard Logo}}\\
 <WRAP minfont>[[https://commons.wikimedia.org/wiki/File:Logo_of_WireGuard.svg|File:Logo of WireGuard.svg - Wikimedia Commons]]</WRAP>\\ <WRAP minfont>[[https://commons.wikimedia.org/wiki/File:Logo_of_WireGuard.svg|File:Logo of WireGuard.svg - Wikimedia Commons]]</WRAP>\\
行 16: 行 16:
  
 SoftEther VPN の WireGuard サポートは **2021/03/01** に [[https://github.com/SoftEtherVPN/SoftEtherVPN|SoftEther VPN (開発版)]] に取り込まれました。\\ SoftEther VPN の WireGuard サポートは **2021/03/01** に [[https://github.com/SoftEtherVPN/SoftEtherVPN|SoftEther VPN (開発版)]] に取り込まれました。\\
-**2022/02/04 現在**も、SoftEther VPN の WireGuard サポートは Softether VPN (開発版) でのみの機能になります🤔\\+**2022/02/04 現在**も、SoftEther VPN の WireGuard サポートは <wrap em>__Softether VPN (開発版) でのみの機能__</wrap>になります🤔\\
 この機能を試すためには [[.:build|SoftEther VPN のビルド]] の手順で開発版の最新をビルドする必要がある😅\\ この機能を試すためには [[.:build|SoftEther VPN のビルド]] の手順で開発版の最新をビルドする必要がある😅\\
 {{:linux:softether_vpn_and_wireguard_001.png?800|Commits 2021/03/01 · SoftEtherVPN/SoftEtherVPN}}\\ {{:linux:softether_vpn_and_wireguard_001.png?800|Commits 2021/03/01 · SoftEtherVPN/SoftEtherVPN}}\\
行 24: 行 24:
 [[git>SoftEtherVPN/SoftEtherVPN/pull/1200|Implement support for WireGuard by davidebeatrici · Pull Request #1200 · SoftEtherVPN/SoftEtherVPN]]\\ [[git>SoftEtherVPN/SoftEtherVPN/pull/1200|Implement support for WireGuard by davidebeatrici · Pull Request #1200 · SoftEtherVPN/SoftEtherVPN]]\\
  
-参考: [[https://w.vmeta.jp/tdiary/20210327.html|SoftEtherVPNがWireGuardプロルに対応したで試しみた - meta‘s blog(2021-03-27)]]\\ +==== WireGuard Tools のインスル ==== 
-   [[https://ja.softether.org/5-download/history|バジョ更新履歴 (ChangeLog) - SoftEther VPN プロジェク]]\\+WireGuard Tools は **wg**、**wg-quick** が含まれていますが、公開鍵/秘密鍵を作成する場合は **wg** コマンドがクライアント、サーバー何れかにインストールされいれば作業できる🤔\\ 
 +作業するマシンにインストルされていれば問題ないので、両方にイールしておいても良い🤤\\
  
-==== WireGuard コマンドのインストール ==== +=== サーバー上 (Linux) で WireGuard コマンドを使う ===
- +
-=== サーバー上で WireGuard コマンドを使う ===+
 **wireguard-tools** をインストールする😉\\ **wireguard-tools** をインストールする😉\\
 <WRAP color_term> <WRAP color_term>
行 97: 行 96:
 **nonportable バケットの追加**\\ **nonportable バケットの追加**\\
 <WRAP color_term> <WRAP color_term>
-<WRAP color_command><code powershell+<WRAP color_command><html><pre
-$ scoop bucket add nonportable +<b class=GRN>$</b> <b class=HIY>scoop</b> bucket add nonportable 
-</code></WRAP>+</pre></html></WRAP>
 <WRAP color_result><html><pre> <WRAP color_result><html><pre>
 Checking repo... ok Checking repo... ok
行 108: 行 107:
 **wireguard-np のインストール**\\ **wireguard-np のインストール**\\
 <WRAP color_term> <WRAP color_term>
-<WRAP color_command><code powershell+<WRAP color_command><html><pre
-$ sudo scoop install wireguard-np +<b class=GRN>$</b> <b class=HIY>sudo</b> scoop install wireguard-np 
-</code></WRAP>+</pre></html></WRAP>
 <WRAP color_result><html><pre> <WRAP color_result><html><pre>
 Installing 'wireguard-np' (0.5.3) [64bit] Installing 'wireguard-np' (0.5.3) [64bit]
行 124: 行 123:
 ※ 再起動なしで最新 Path を PowerShell の $env:Path に反映させる。\\ ※ 再起動なしで最新 Path を PowerShell の $env:Path に反映させる。\\
 <WRAP color_term> <WRAP color_term>
-<WRAP color_command><code+<WRAP color_command><html><pre
-$ $env:Path = [Environment]::SetEnvironmentVariable("Path", $env:Path + ";" + $env:ProgramW6432 + "\WireGuard", "User"+<b class=GRN>$</b> $env:Path = [Environment]::SetEnvironmentVariable("Path", $env:Path + ";" + $env:ProgramW6432 + "\WireGuard", "User"
-</code></WRAP>+</pre></html></WRAP>
 または または
-<WRAP color_command><code+<WRAP color_command><html><pre
-$ $env:Path = [System.Environment]::GetEnvironmentVariable("Path", "Machine") + ";" + [System.Environment]::GetEnvironmentVariable("Path", "User"+<b class=GRN>$</b> $env:Path = [System.Environment]::GetEnvironmentVariable("Path", "Machine") + ";" + [System.Environment]::GetEnvironmentVariable("Path", "User"
-</code></WRAP>+</pre></html></WRAP>
 </WRAP> </WRAP>
  
 wg コマンドの動作確認。\\ wg コマンドの動作確認。\\
 <WRAP color_term> <WRAP color_term>
-<WRAP color_command><code+<WRAP color_command><html><pre
-$ wg --help +<b class=GRN>$</b> <b class=HIY>wg</b> <b class=HIK>--help</b> 
-</code></WRAP> +</pre></html></WRAP> 
-<WRAP color_result><code+<WRAP color_result><html><pre
-Usage: C:\Program Files\WireGuard\wg.exe <cmd[<args>]+Usage: C:\Program Files\WireGuard\wg.exe &lt;cmd&gt; [&lt;args&gt;]
  
 Available subcommands: Available subcommands:
行 152: 行 151:
   pubkey: Reads a private key from stdin and writes a public key to stdout   pubkey: Reads a private key from stdin and writes a public key to stdout
 You may pass `--help' to any of these subcommands to view usage. You may pass `--help' to any of these subcommands to view usage.
-</code></WRAP>+</pre></html></WRAP>
 </WRAP> </WRAP>
  
行 415: 行 414:
  
 ==== クライアント公開鍵・秘密鍵の生成 ==== ==== クライアント公開鍵・秘密鍵の生成 ====
-秘密鍵は表示せずに **wg_privkey** ファイルに保存し、公開鍵は表示しつつ **wg_pubkey** ファイルにも保存する。\\+秘密鍵は表示せずに **wgclient.key** ファイルに保存し、公開鍵は表示しつつ **wgclient.pub** ファイルにも保存する。\\
 <WRAP color_term> <WRAP color_term>
 <WRAP color_command><code> <WRAP color_command><code>
-$ wg genkey | tee wg_privkey | wg pubkey | tee wg_pubkey+$ wg genkey | tee wgclient.key | wg pubkey | tee wgclient.pub
 </code></WRAP> </code></WRAP>
 <WRAP color_result><html><pre> <WRAP color_result><html><pre>
行 432: 行 431:
 </pre></html></WRAP> </pre></html></WRAP>
  
-説明② - **tee wg_privkey** コマンドは標準出力に出力しつつ **wg_privkey** ファイルにも保存する。\\+説明② - **tee wgclient.key** コマンドは標準出力に出力しつつ **wgclient.key** ファイルにも保存する。\\
 <WRAP color_command><code> <WRAP color_command><code>
-$ wg genkey | tee wg_privkey+$ wg genkey | tee wgclient.key
 </code></WRAP> </code></WRAP>
 <WRAP color_result><html><pre> <WRAP color_result><html><pre>
行 442: 行 441:
 説明③ - **wg pubkey** コマンドはリダイレクト(秘密鍵は表示されない)で入力された秘密鍵から公開鍵を生成して標準出力に出力する。\\ 説明③ - **wg pubkey** コマンドはリダイレクト(秘密鍵は表示されない)で入力された秘密鍵から公開鍵を生成して標準出力に出力する。\\
 <WRAP color_command><code> <WRAP color_command><code>
-$ wg genkey | tee wg_privkey | wg pubkey+$ wg genkey | tee wgclient.key | wg pubkey
 </code></WRAP> </code></WRAP>
 <WRAP color_result><html><pre> <WRAP color_result><html><pre>
行 448: 行 447:
 </pre></html></WRAP> </pre></html></WRAP>
  
-説明④ - **tee wg_pubkey** コマンドは標準出力に公開鍵を表示しつつ **wg_pubkey** ファイルにも保存する。\\+説明④ - **tee wgclient.pub** コマンドは標準出力に公開鍵を表示しつつ **wgclient.pub** ファイルにも保存する。\\
 <WRAP color_command><code> <WRAP color_command><code>
-$ wg genkey | tee wg_privkey | wg pubkey | tee wg_pubkey+$ wg genkey | tee wgclient.key | wg pubkey | tee wgclient.pub
 </code></WRAP> </code></WRAP>
 <WRAP color_result><html><pre> <WRAP color_result><html><pre>
行 457: 行 456:
 </WRAP> </WRAP>
  
-==== クライアント公開鍵をサーバーに登録 ====+==== クライアント公開鍵をサーバーに登録(WgkAdd) ====
 <WRAP color_term> <WRAP color_term>
 <WRAP color_command><code> <WRAP color_command><code>
行 559: 行 558:
 </WRAP> </WRAP>
  
-==== クライアント公開鍵をサーバーから削除 ====+==== クライアント公開鍵一覧(WgkEnum) ==== 
 +<WRAP color_term> 
 +<WRAP color_command><code> 
 +$ vpncmd localhost:5555 /server /cmd WgkEnum --help 
 +</code></WRAP> 
 +<WRAP color_result><html><pre> 
 +vpncmd コマンド - SoftEther VPN Developer Edition コマンドライン管理ユーティリティ 
 +SoftEther VPN コマンドライン管理ユーティリティ (vpncmd コマンド) 
 +Developer Edition 
 +Version 5.02 Build 5180   (Japanese) 
 +Compiled 2022/06/20 20:24:15 by tomoyan at skv001.monsters-g.com 
 +Copyright (c) all contributors on SoftEther VPN project in GitHub. 
 +Copyright (c) Daiyuu Nobori, SoftEther Project at University of Tsukuba, and SoftEther Corporation. 
 +All rights reserved. 
 + 
 +パスワード: ******************** 
 + 
 +VPN Server "localhost" (ポート 5555) に接続しました。 
 + 
 +VPN Server 全体の管理権限があります。 
 + 
 +VPN Server>WgkEnum --help 
 +WgkEnum コマンド - Wireguard 公開鍵一覧の取得 
 +コマンド "WgkEnum" のヘルプ 
 + 
 +[目的] 
 +  Wireguard 公開鍵一覧の取得 
 + 
 +[説明] 
 +  現在サーバーに登録されている WireGuard 公開鍵の一覧を取得します。 
 +  WgkAdd コマンドで公開鍵の追加を、WgkDelete コマンドで公開鍵の削除を行うことができます。 
 +  このコマンドを実行するには、VPN Server の管理者権限が必要です。 
 + 
 +[使用方法] 
 +  WgkEnum 
 +</pre></html></WRAP> 
 +</WRAP> 
 + 
 +<WRAP color_term> 
 +<WRAP color_command><code> 
 +$ vpncmd localhost:5555 /server /cmd WgkEnum 
 +</code></WRAP> 
 +<WRAP color_result><html><pre> 
 +vpncmd コマンド - SoftEther VPN Developer Edition コマンドライン管理ユーティリティ 
 +SoftEther VPN コマンドライン管理ユーティリティ (vpncmd コマンド) 
 +Developer Edition 
 +Version 5.02 Build 5180   (Japanese) 
 +Compiled 2022/06/20 20:24:15 by tomoyan at skv001.monsters-g.com 
 +Copyright (c) all contributors on SoftEther VPN project in GitHub. 
 +Copyright (c) Daiyuu Nobori, SoftEther Project at University of Tsukuba, and SoftEther Corporation. 
 +All rights reserved. 
 + 
 +パスワード: ******************** 
 + 
 +VPN Server "localhost" (ポート 5555) に接続しました。 
 + 
 +VPN Server 全体の管理権限があります。 
 + 
 +VPN Server>WgkEnum 
 +WgkEnum コマンド - Wireguard 公開鍵一覧の取得 
 +公開鍵                                      |仮想 HUB 名|ユーザー名 
 +--------------------------------------------+-----------+---------- 
 +kOHhTudkiKHHG/6x57FQD5cjft8IjeE773rferdP2iE=|VPN        |tomoyan 
 +コマンドは正常に終了しました。 
 +</pre></html></WRAP> 
 +</WRAP> 
 + 
 +==== クライアント公開鍵をサーバーから削除(WgkDelete) ====
 <WRAP color_term> <WRAP color_term>
 <WRAP color_command><code> <WRAP color_command><code>
行 623: 行 689:
 WgkDelete コマンド - WireGuard 公開鍵の削除 WgkDelete コマンド - WireGuard 公開鍵の削除
 コマンドは正常に終了しました。 コマンドは正常に終了しました。
 +</pre></html></WRAP>
 +</WRAP>
 +
 +==== クライアントの接続に必要なサーバーの公開鍵・事前共通鍵 ====
 +サーバーの WireGuard の設定を調べる。\\
 +<WRAP color_term>
 +<WRAP color_command><code>
 +$ sudo grep -3 -P "PresharedKey" /usr/local/libexec/softether/vpnserver/vpn_server.config
 +</code></WRAP>
 +<WRAP color_result><html><pre>
 +   declare WireGuard
 +   {
 +    bool Enabled true
 +    string PresharedKey LejepJw9wyHqewP6UYIFJLeR+TMgvMKbMQ/THZ3i0gg=
 +    string <b class=RED>PrivateKey</b> <b class=DiYE>YK7GR6jznS7nVtOaEldrr6iAMjrREKzWOn6NBcprHmc=</b>
 +   }
 +  }
 +</pre></html></WRAP>
 +</WRAP>
 +
 +公開鍵は秘密鍵(PrivateKey)から **wg pubkey** コマンドで生成する。\\
 +<WRAP color_term>
 +<WRAP color_command><html><pre>
 +$ echo <b class=DiYE>YK7GR6jznS7nVtOaEldrr6iAMjrREKzWOn6NBcprHmc=</b> | wg pubkey
 +</pre></html></WRAP>
 +<WRAP color_result><html><pre>
 +BwXr25M3RARwvEWkFkzyHwd4hmhJ4qv7+w+YUrLV0XU=
 +</pre></html></WRAP>
 +</WRAP>
 +
 +事前共通鍵(PresharedKey)はサーバーの WireGuard の設定をそのまま利用する。\\
 +<WRAP color_term>
 +<WRAP color_result><html><pre>
 +LejepJw9wyHqewP6UYIFJLeR+TMgvMKbMQ/THZ3i0gg=
 </pre></html></WRAP> </pre></html></WRAP>
 </WRAP> </WRAP>
行 705: 行 805:
 </WRAP> </WRAP>
  
 +
 +===== WireGuard の技術資料 =====
 +
 +==== NDSS 2017: WireGuard: Next Generation Kernel Network Tunnel ====
 +[[https://www.ndss-symposium.org/ndss2017/ndss-2017-programme/wireguard-next-generation-kernel-network-tunnel/|WireGuard: Next Generation Kernel Network Tunnel – NDSS Symposium]]\\
 +訳: WireGuard:次世代カーネルネットワークトンネル - NDSSシンポジウム\\
 +
 +**Slide**\\
 +[[https://www.ndss-symposium.org/wp-content/uploads/2017/09/ndss2017-04a_3-donenfeld_slides.pdf|WireGuard - Fast, Modern, Secure VPN Tunnel - NDSS 2017 Presentation]](PDF)\\
 +
 +**Video**\\
 +<WRAP youtube><html>
 +  <iframe width="560" height="315" src="https://www.youtube.com/embed/hSKp4FBok_Q" frameborder="0" 
 +    allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
 +</html></WRAP>\\
  
 ===== 参考文献 ===== ===== 参考文献 =====
 +[[https://w.vmeta.jp/tdiary/20210327.html|SoftEtherVPNがWireGuardプロトコルに対応したので試してみた - meta‘s blog(2021-03-27)]]\\
 +[[https://ja.softether.org/5-download/history|バージョン更新履歴 (ChangeLog) - SoftEther VPN プロジェクト]]\\
 +[[https://tech-mmmm.blogspot.com/2021/11/wireguardvpn.html|WireGuardを使って自宅にVPN接続する方法]]\\
 [[so>questions/17794507/powershell-reload-the-path-in-powershell|console - Powershell: Reload the path in PowerShell - Stack Overflow]]\\ [[so>questions/17794507/powershell-reload-the-path-in-powershell|console - Powershell: Reload the path in PowerShell - Stack Overflow]]\\
 +[[https://zenn.dev/hiroe_orz17/articles/f8f35075dea4cf|WireGuard概要まとめ]]\\
  
  • linux/softether_vpn/wireguard.1655791664.txt.gz
  • 最終更新: 2022/06/21 15:07
  • by ともやん