From 4681e861efcdf9b0b73e3803e70712bc55162863 Mon Sep 17 00:00:00 2001 From: nsfisis Date: Sat, 8 Aug 2026 10:38:18 +0900 Subject: feat(slides): improve slide controller --- .../index.html | 100 +++++++++++---------- 1 file changed, 55 insertions(+), 45 deletions(-) (limited to 'services/nuldoc/public/blog/posts/2024-02-03') diff --git a/services/nuldoc/public/blog/posts/2024-02-03/install-wireguard-on-personal-server/index.html b/services/nuldoc/public/blog/posts/2024-02-03/install-wireguard-on-personal-server/index.html index 7b4db912..f05bfda3 100644 --- a/services/nuldoc/public/blog/posts/2024-02-03/install-wireguard-on-personal-server/index.html +++ b/services/nuldoc/public/blog/posts/2024-02-03/install-wireguard-on-personal-server/index.html @@ -15,7 +15,7 @@ 【備忘録】 個人用サーバに WireGuard を導入する|REPL: Rest-Eat-Program Loop - +
@@ -119,14 +119,16 @@ まずは個人用サービスをホストしている Ubuntu のサーバに WireGuard をインストールする。

-
$ sudo apt install wireguard
+
$ sudo apt install wireguard
+

次に、WireGuard で使用する鍵を生成する。

-
$ wg genkey | sudo tee /etc/wireguard/server.key | wg pubkey | sudo tee /etc/wireguard/server.pub -
$ sudo chmod 600 /etc/wireguard/server.{key,pub}
+
$ wg genkey | sudo tee /etc/wireguard/server.key | wg pubkey | sudo tee /etc/wireguard/server.pub
+$ sudo chmod 600 /etc/wireguard/server.{key,pub}
+
@@ -135,26 +137,28 @@ 公式サイトから各 OS 向けのクライアントソフトウェアを入手し、インストールする。次に、設定をおこなう。

-
# クライアント 1 の場合 -
[Interface] -
Address = 10.10.1.2/32 -
PrivateKey = <クライアント 1 の秘密鍵> -
-
[Peer] -
PublicKey = <サーバの公開鍵> -
AllowedIPs = <サーバの外部 IP アドレス>/32 -
Endpoint = <サーバの外部 IP アドレス>:51820
+
# クライアント 1 の場合
+[Interface]
+Address = 10.10.1.2/32
+PrivateKey = <クライアント 1 の秘密鍵>
+
+[Peer]
+PublicKey = <サーバの公開鍵>
+AllowedIPs = <サーバの外部 IP アドレス>/32
+Endpoint = <サーバの外部 IP アドレス>:51820
+
-
# クライアント 2 の場合 -
[Interface] -
Address = 10.10.1.3/32 -
PrivateKey = <クライアント 2 の秘密鍵> -
-
[Peer] -
PublicKey = <サーバの公開鍵> -
AllowedIPs = <サーバの外部 IP アドレス>/32 -
Endpoint = <サーバの外部 IP アドレス>:51820
+
# クライアント 2 の場合
+[Interface]
+Address = 10.10.1.3/32
+PrivateKey = <クライアント 2 の秘密鍵>
+
+[Peer]
+PublicKey = <サーバの公開鍵>
+AllowedIPs = <サーバの外部 IP アドレス>/32
+Endpoint = <サーバの外部 IP アドレス>:51820
+

PrivateKeyPublicKey は鍵ファイルのパスではなく中身を書くことに注意。 @@ -166,29 +170,32 @@ 一度サーバへ戻り、WireGuard の設定ファイルを書く。

-
$ sudo vim /etc/wireguard/wg0.conf
+
$ sudo vim /etc/wireguard/wg0.conf
+
-
[Interface] -
Address = 10.10.1.1/32 -
SaveConfig = true -
PrivateKey = <サーバの秘密鍵> -
ListenPort = 51820 -
-
[Peer] -
PublicKey = <クライアント 1 の公開鍵> -
AllowedIPs = 10.10.1.2/32 -
-
[Peer] -
PublicKey = <クライアント 2 の公開鍵> -
AllowedIPs = 10.10.1.3/32
+
[Interface]
+Address = 10.10.1.1/32
+SaveConfig = true
+PrivateKey = <サーバの秘密鍵>
+ListenPort = 51820
+
+[Peer]
+PublicKey = <クライアント 1 の公開鍵>
+AllowedIPs = 10.10.1.2/32
+
+[Peer]
+PublicKey = <クライアント 2 の公開鍵>
+AllowedIPs = 10.10.1.3/32
+

次に、WireGuard のサービスを起動する。

-
$ sudo systemctl enable wg-quick@wg0 -
$ sudo systemctl start wg-quick@wg0
+
$ sudo systemctl enable wg-quick@wg0
+$ sudo systemctl start wg-quick@wg0
+
@@ -197,23 +204,26 @@ 続けてファイアウォールを設定する。まずは WireGuard が使用する UDP のポートを開き、wg0 を通る通信を許可する。

-
$ sudo ufw allow 51820/udp -
$ sudo ufw allow in on wg0 -
$ sudo ufw allow out on wg0
+
$ sudo ufw allow 51820/udp
+$ sudo ufw allow in on wg0
+$ sudo ufw allow out on wg0
+

次に、80 や 443 などの必要なポートについて、wg0 を経由してのアクセスのみ許可する。

-
$ sudo ufw allow in on wg0 to any port 80 proto tcp -
$ sudo ufw allow in on wg0 to any port 443 proto tcp
+
$ sudo ufw allow in on wg0 to any port 80 proto tcp
+$ sudo ufw allow in on wg0 to any port 443 proto tcp
+

最後に、ufw を有効にする。

-
$ sudo ufw status -
$ sudo ufw enable
+
$ sudo ufw status
+$ sudo ufw enable
+
-- cgit v1.3.1