From 929f3b8d44fe08ec492009dcbfd0e92c904cf72a Mon Sep 17 00:00:00 2001 From: Andy Piper Date: Mon, 11 Dec 2023 17:39:54 +0000 Subject: [PATCH] Incorporate #937 Signed-off-by: Andy Piper --- content/en/admin/optional/tor.md | 11 +++++++---- content/zh-cn/admin/optional/tor.md | 26 +++++++++++++------------- 2 files changed, 20 insertions(+), 17 deletions(-) diff --git a/content/en/admin/optional/tor.md b/content/en/admin/optional/tor.md index 5916b3e7..5c8451ae 100644 --- a/content/en/admin/optional/tor.md +++ b/content/en/admin/optional/tor.md @@ -85,9 +85,11 @@ server { ## Serve Tor over HTTP {#http} -While it may be tempting to serve your Tor version of Mastodon over HTTPS it is not a good idea for most people. See [this](https://blog.torproject.org/facebook-hidden-services-and-https-certs) blog post from the Tor Project about why HTTPS certificates do not add value. Since you cannot get an SSL cert for an onion domain, you will also experience certificate errors when trying to use your Mastodon instance. A Tor developer has more recently spelled out the reasons why serving a Tor service over HTTPS is not beneficial for most use cases [here](https://matt.traudt.xyz/posts/2017-12-02-dont-https-your-onions/). +This section assumes that you want to expose your instance on both Tor and the public Internet *simultaneously*. -The solution is to serve your Mastodon instance over HTTP, but only for Tor. This can be added by prepending an additional configuration to your Nginx configuration. +While it may be tempting to serve your Tor version of Mastodon over HTTPS, it isn't always ideal. This option is mostly useful for large companies that can produce their own certificates with their own company information. There is no Certificate Authority (CA) that provides them [for free](https://community.torproject.org/onion-services/advanced/https/), and there is also [a blog post from the Tor Project](https://blog.torproject.org/facebook-hidden-services-and-https-certs) that explains why HTTPS certificates are not really beneficial for security. On the other hand, Mastodon uses a lot of redirects to the HTTPS version of your site, where the presence of a validated certificate may make it easier for your users to use your instance on Tor without having to manually remove the `https://` prefix in URLs. + +In this section, we will go over how to serve your Mastodon instance over HTTP, but for Tor **only**. This can be added by prepending an additional configuration to your existing Nginx configuration. ```nginx server { @@ -138,6 +140,7 @@ service nginx restart ## Gotchas {#gotchas} -There are a few things you will need to understand. Certain redirects will push your users to HTTPS. They will have to manually replace the URL with HTTP to continue. +There are a few things you will need to understand. -Various resources, such as images, will still be offered through your regular non-Tor domain. How much of a problem this is will depend on your users' level of caution. +- As mentioned earlier, certain URLs in the Mastodon frontend will force your users to a HTTPS URL. They will have to manually replace the URL with HTTP to continue. +- Various resources, such as images, will **still** be offered through your regular clearnet domain. This could possibly be a problem, depending on how cautious your users want, try or need to be. diff --git a/content/zh-cn/admin/optional/tor.md b/content/zh-cn/admin/optional/tor.md index 2559447a..a05db983 100644 --- a/content/zh-cn/admin/optional/tor.md +++ b/content/zh-cn/admin/optional/tor.md @@ -1,13 +1,13 @@ --- title: 匿名服务 -description: 通过TOR的匿名服务来访问Mastodon。 +description: 通过Tor的匿名服务来访问Mastodon。 menu: docs: weight: 20 parent: admin-optional --- -可以通过TOR的匿名服务来访问Mastodon。这将给你一个只能通过 TOR 网络连接的 *.onion 地址。 +可以通过Tor的匿名服务来访问Mastodon。这将给你一个只能通过 Tor 网络连接的 \*.onion 地址。 ## 安装 Tor {#install} @@ -41,13 +41,13 @@ HiddenServiceVersion 3 HiddenServicePort 80 127.0.0.1:80 ``` -重启 tor。 +重启 Tor。 ```bash sudo service tor restart ``` -现在,你的tor域名可以在 `/var/lib/tor/hidden_service/hostname` 找到。 +现在,你的Tor域名可以在 `/var/lib/tor/onion_service/hostname` 找到。 ## 移动你的Mastodon配置 {#nginx} @@ -77,7 +77,7 @@ error_log /var/log/nginx/mastodon_error.log warn; ```text server { listen 80; - server_name mastodon.myhosting.com; + server_name mastodon.example.com; return 301 https://$server_name$request_uri; } @@ -89,11 +89,11 @@ map $http_upgrade $connection_upgrade { server { listen 443 ssl http2; list [::]:443 ssl http2; - server_name mastodon.myhosting.com; + server_name mastodon.example.com; include /etc/nginx/snippets/mastodon.conf; - ssl_certificate /etc/letsencrypt/live/mastodon.myhosting.com/fullchain.pem; - ssl_certificate_key /etc/letsencrypt/live/mastodon.myhosting.com/privkey.pem; + ssl_certificate /etc/letsencrypt/live/mastodon.example.com/fullchain.pem; + ssl_certificate_key /etc/letsencrypt/live/mastodon.example.com/privkey.pem; } ``` @@ -112,7 +112,7 @@ server { server { listen 80; - server_name mastodon.myhosting.com; + server_name mastodon.example.com; return 301 https://$server_name$request_uri; } @@ -124,11 +124,11 @@ map $http_upgrade $connection_upgrade { server { listen 443 ssl http2; list [::]:443 ssl http2; - server_name mastodon.myhosting.com; + server_name mastodon.example.com; include /etc/nginx/snippets/mastodon.conf; - ssl_certificate /etc/letsencrypt/live/mastodon.myhosting.com/fullchain.pem; - ssl_certificate_key /etc/letsencrypt/live/mastodon.myhosting.com/privkey.pem; + ssl_certificate /etc/letsencrypt/live/mastodon.example.com/fullchain.pem; + ssl_certificate_key /etc/letsencrypt/live/mastodon.example.com/privkey.pem; } ``` @@ -150,4 +150,4 @@ service nginx restart 许多的资源,诸如图片,将仍然从常规非Tor域名加载。问题的严重性很大程度上取决于用户的谨慎程度。 -{{< translation-status-zh-cn raw_title="Hidden services" raw_link="/admin/optional/tor/" last_tranlation_time="2020-05-04" raw_commit="ad1ef20f171c9f61439f32168987b0b4f9abd74b">}} +{{< translation-status-zh-cn raw_title="Onion services" raw_link="/admin/optional/tor/" last_tranlation_time="2020-05-04" raw_commit="ad1ef20f171c9f61439f32168987b0b4f9abd74b">}}