From 6dedddc545e2f1930bdc2256784eb1551bd4231d Mon Sep 17 00:00:00 2001 From: nsfisis Date: Sun, 1 Feb 2026 00:49:15 +0900 Subject: feat(nuldoc): rewrite nuldoc in Ruby --- .../index.html | 98 ++++++++++++---------- 1 file changed, 54 insertions(+), 44 deletions(-) (limited to 'services/nuldoc/public/blog/posts/2024-02-03/install-wireguard-on-personal-server/index.html') 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 94a327b6..d5517d25 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 @@ -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-g0d28