差分
このページの2つのバージョン間の差分を表示します。
両方とも前のリビジョン 前のリビジョン 次のリビジョン | 前のリビジョン | ||
linux:softether_vpn:wireguard [2022/06/21 15:32] – [クライアント公開鍵をサーバーから削除] ともやん | linux:softether_vpn:wireguard [2023/03/14 06:17] (現在) – [NDSS 2017: WireGuard: Next Generation Kernel Network Tunnel] ともやん | ||
---|---|---|---|
行 1: | 行 1: | ||
- | ====== WireGuard ====== | + | ====== WireGuard |
{{: | {{: | ||
<WRAP minfont> | <WRAP minfont> | ||
行 16: | 行 16: | ||
SoftEther VPN の WireGuard サポートは **2021/ | SoftEther VPN の WireGuard サポートは **2021/ | ||
- | **2022/ | + | **2022/ |
この機能を試すためには [[.: | この機能を試すためには [[.: | ||
{{: | {{: | ||
行 24: | 行 24: | ||
[[git> | [[git> | ||
- | ==== WireGuard | + | ==== WireGuard |
+ | WireGuard Tools には **wg**、**wg-quick** が含まれていますが、公開鍵/ | ||
+ | 作業するマシンにインストールされていれば問題ないので、両方にインストールしておいても良い🤤\\ | ||
- | === サーバー上で WireGuard コマンドを使う === | + | === サーバー上 |
**wireguard-tools** をインストールする😉\\ | **wireguard-tools** をインストールする😉\\ | ||
<WRAP color_term> | <WRAP color_term> | ||
行 94: | 行 96: | ||
**nonportable バケットの追加**\\ | **nonportable バケットの追加**\\ | ||
<WRAP color_term> | <WRAP color_term> | ||
- | <WRAP color_command>< | + | <WRAP color_command>< |
- | $ scoop bucket add nonportable | + | <b class=GRN> |
- | </code></ | + | </pre></ |
<WRAP color_result>< | <WRAP color_result>< | ||
Checking repo... ok | Checking repo... ok | ||
行 105: | 行 107: | ||
**wireguard-np のインストール**\\ | **wireguard-np のインストール**\\ | ||
<WRAP color_term> | <WRAP color_term> | ||
- | <WRAP color_command>< | + | <WRAP color_command>< |
- | $ sudo scoop install wireguard-np | + | <b class=GRN> |
- | </code></ | + | </pre></ |
<WRAP color_result>< | <WRAP color_result>< | ||
Installing ' | Installing ' | ||
行 121: | 行 123: | ||
※ 再起動なしで最新 Path を PowerShell の $env:Path に反映させる。\\ | ※ 再起動なしで最新 Path を PowerShell の $env:Path に反映させる。\\ | ||
<WRAP color_term> | <WRAP color_term> | ||
- | <WRAP color_command>< | + | <WRAP color_command>< |
- | $ $env:Path = [Environment]:: | + | <b class=GRN> |
- | </code></ | + | </pre></ |
または | または | ||
- | <WRAP color_command>< | + | <WRAP color_command>< |
- | $ $env:Path = [System.Environment]:: | + | <b class=GRN> |
- | </code></ | + | </pre></ |
</ | </ | ||
wg コマンドの動作確認。\\ | wg コマンドの動作確認。\\ | ||
<WRAP color_term> | <WRAP color_term> | ||
- | <WRAP color_command>< | + | <WRAP color_command>< |
- | $ wg --help | + | <b class=GRN> |
- | </code></ | + | </pre></ |
- | <WRAP color_result>< | + | <WRAP color_result>< |
- | Usage: C:\Program Files\WireGuard\wg.exe | + | Usage: C:\Program Files\WireGuard\wg.exe |
Available subcommands: | Available subcommands: | ||
行 149: | 行 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' | You may pass `--help' | ||
- | </code></ | + | </pre></ |
</ | </ | ||
行 412: | 行 414: | ||
==== クライアント公開鍵・秘密鍵の生成 ==== | ==== クライアント公開鍵・秘密鍵の生成 ==== | ||
- | 秘密鍵は表示せずに **wg_privkey** ファイルに保存し、公開鍵は表示しつつ **wg_pubkey** ファイルにも保存する。\\ | + | 秘密鍵は表示せずに **wgclient.key** ファイルに保存し、公開鍵は表示しつつ **wgclient.pub** ファイルにも保存する。\\ |
<WRAP color_term> | <WRAP color_term> | ||
<WRAP color_command>< | <WRAP color_command>< | ||
- | $ wg genkey | tee wg_privkey | + | $ wg genkey | tee wgclient.key |
</ | </ | ||
<WRAP color_result>< | <WRAP color_result>< | ||
行 429: | 行 431: | ||
</ | </ | ||
- | 説明② - **tee wg_privkey** コマンドは標準出力に出力しつつ **wg_privkey** ファイルにも保存する。\\ | + | 説明② - **tee wgclient.key** コマンドは標準出力に出力しつつ **wgclient.key** ファイルにも保存する。\\ |
<WRAP color_command>< | <WRAP color_command>< | ||
- | $ wg genkey | tee wg_privkey | + | $ wg genkey | tee wgclient.key |
</ | </ | ||
<WRAP color_result>< | <WRAP color_result>< | ||
行 439: | 行 441: | ||
説明③ - **wg pubkey** コマンドはリダイレクト(秘密鍵は表示されない)で入力された秘密鍵から公開鍵を生成して標準出力に出力する。\\ | 説明③ - **wg pubkey** コマンドはリダイレクト(秘密鍵は表示されない)で入力された秘密鍵から公開鍵を生成して標準出力に出力する。\\ | ||
<WRAP color_command>< | <WRAP color_command>< | ||
- | $ wg genkey | tee wg_privkey | + | $ wg genkey | tee wgclient.key |
</ | </ | ||
<WRAP color_result>< | <WRAP color_result>< | ||
行 445: | 行 447: | ||
</ | </ | ||
- | 説明④ - **tee wg_pubkey** コマンドは標準出力に公開鍵を表示しつつ **wg_pubkey** ファイルにも保存する。\\ | + | 説明④ - **tee wgclient.pub** コマンドは標準出力に公開鍵を表示しつつ **wgclient.pub** ファイルにも保存する。\\ |
<WRAP color_command>< | <WRAP color_command>< | ||
- | $ wg genkey | tee wg_privkey | + | $ wg genkey | tee wgclient.key |
</ | </ | ||
<WRAP color_result>< | <WRAP color_result>< | ||
行 454: | 行 456: | ||
</ | </ | ||
- | ==== クライアント公開鍵をサーバーに登録 ==== | + | ==== クライアント公開鍵をサーバーに登録(WgkAdd) |
<WRAP color_term> | <WRAP color_term> | ||
<WRAP color_command>< | <WRAP color_command>< | ||
行 556: | 行 558: | ||
</ | </ | ||
- | ==== クライアント公開鍵をサーバーから削除 ==== | + | ==== クライアント公開鍵一覧(WgkEnum) ==== |
+ | <WRAP color_term> | ||
+ | <WRAP color_command>< | ||
+ | $ vpncmd localhost: | ||
+ | </ | ||
+ | <WRAP color_result>< | ||
+ | vpncmd コマンド - SoftEther VPN Developer Edition コマンドライン管理ユーティリティ | ||
+ | SoftEther VPN コマンドライン管理ユーティリティ (vpncmd コマンド) | ||
+ | Developer Edition | ||
+ | Version 5.02 Build 5180 | ||
+ | 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 " | ||
+ | |||
+ | VPN Server 全体の管理権限があります。 | ||
+ | |||
+ | VPN Server> | ||
+ | WgkEnum コマンド - Wireguard 公開鍵一覧の取得 | ||
+ | コマンド " | ||
+ | |||
+ | [目的] | ||
+ | Wireguard 公開鍵一覧の取得 | ||
+ | |||
+ | [説明] | ||
+ | 現在サーバーに登録されている WireGuard 公開鍵の一覧を取得します。 | ||
+ | WgkAdd コマンドで公開鍵の追加を、WgkDelete コマンドで公開鍵の削除を行うことができます。 | ||
+ | このコマンドを実行するには、VPN Server の管理者権限が必要です。 | ||
+ | |||
+ | [使用方法] | ||
+ | WgkEnum | ||
+ | </ | ||
+ | </ | ||
+ | |||
+ | <WRAP color_term> | ||
+ | <WRAP color_command>< | ||
+ | $ vpncmd localhost: | ||
+ | </ | ||
+ | <WRAP color_result>< | ||
+ | vpncmd コマンド - SoftEther VPN Developer Edition コマンドライン管理ユーティリティ | ||
+ | SoftEther VPN コマンドライン管理ユーティリティ (vpncmd コマンド) | ||
+ | Developer Edition | ||
+ | Version 5.02 Build 5180 | ||
+ | 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 " | ||
+ | |||
+ | VPN Server 全体の管理権限があります。 | ||
+ | |||
+ | VPN Server> | ||
+ | WgkEnum コマンド - Wireguard 公開鍵一覧の取得 | ||
+ | 公開鍵 | ||
+ | --------------------------------------------+-----------+---------- | ||
+ | kOHhTudkiKHHG/ | ||
+ | コマンドは正常に終了しました。 | ||
+ | </ | ||
+ | </ | ||
+ | |||
+ | ==== クライアント公開鍵をサーバーから削除(WgkDelete) | ||
<WRAP color_term> | <WRAP color_term> | ||
<WRAP color_command>< | <WRAP color_command>< | ||
行 634: | 行 703: | ||
bool Enabled true | bool Enabled true | ||
string PresharedKey LejepJw9wyHqewP6UYIFJLeR+TMgvMKbMQ/ | string PresharedKey LejepJw9wyHqewP6UYIFJLeR+TMgvMKbMQ/ | ||
- | string PrivateKey YK7GR6jznS7nVtOaEldrr6iAMjrREKzWOn6NBcprHmc= | + | string |
} | } | ||
} | } | ||
行 642: | 行 711: | ||
公開鍵は秘密鍵(PrivateKey)から **wg pubkey** コマンドで生成する。\\ | 公開鍵は秘密鍵(PrivateKey)から **wg pubkey** コマンドで生成する。\\ | ||
<WRAP color_term> | <WRAP color_term> | ||
- | <WRAP color_command>< | + | <WRAP color_command>< |
- | $ echo YK7GR6jznS7nVtOaEldrr6iAMjrREKzWOn6NBcprHmc= | wg pubkey | + | $ echo <b class=DiYE> |
- | </code></ | + | </pre></ |
<WRAP color_result>< | <WRAP color_result>< | ||
BwXr25M3RARwvEWkFkzyHwd4hmhJ4qv7+w+YUrLV0XU= | BwXr25M3RARwvEWkFkzyHwd4hmhJ4qv7+w+YUrLV0XU= | ||
行 736: | 行 805: | ||
</ | </ | ||
+ | |||
+ | ===== WireGuard の技術資料 ===== | ||
+ | |||
+ | ==== NDSS 2017: WireGuard: Next Generation Kernel Network Tunnel ==== | ||
+ | [[https:// | ||
+ | 訳: WireGuard:次世代カーネルネットワークトンネル - NDSSシンポジウム\\ | ||
+ | |||
+ | **Slide**\\ | ||
+ | [[https:// | ||
+ | |||
+ | **Video**\\ | ||
+ | <WRAP youtube>< | ||
+ | <iframe width=" | ||
+ | allow=" | ||
+ | </ | ||
===== 参考文献 ===== | ===== 参考文献 ===== | ||
[[https:// | [[https:// | ||
[[https:// | [[https:// | ||
+ | [[https:// | ||
[[so> | [[so> | ||
+ | [[https:// | ||