From f3ca307e64202761ad303ab8d2515b2a310917f7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A2u=20Cao?= Date: Wed, 30 Nov 2022 12:06:25 +0100 Subject: [PATCH] Fix Tor access Configure alternate_domains for Rails app to re-enable Tor access (was throwing 403s without this config) --- environments/production.json | 5 +++++ site-cookbooks/kosmos-mastodon/attributes/default.rb | 1 + site-cookbooks/kosmos-mastodon/recipes/default.rb | 2 +- .../kosmos-mastodon/templates/default/env.production.erb | 1 + 4 files changed, 8 insertions(+), 1 deletion(-) diff --git a/environments/production.json b/environments/production.json index ac5f7e6..635c0f3 100644 --- a/environments/production.json +++ b/environments/production.json @@ -16,6 +16,11 @@ "use_ssl": "false" } } + }, + "kosmos-mastodon": { + "alternate_domains": [ + "mastodon.w7nooprauv6yrnhzh2ajpcnj3doinked2aaztlwfyt6u6pva2qdxqhid.onion" + ] } } } \ No newline at end of file diff --git a/site-cookbooks/kosmos-mastodon/attributes/default.rb b/site-cookbooks/kosmos-mastodon/attributes/default.rb index 890f74e..c3a5406 100644 --- a/site-cookbooks/kosmos-mastodon/attributes/default.rb +++ b/site-cookbooks/kosmos-mastodon/attributes/default.rb @@ -5,6 +5,7 @@ node.default["kosmos-mastodon"]["bind_ip"] = "127.0.0.1" node.default["kosmos-mastodon"]["app_port"] = 3000 node.default["kosmos-mastodon"]["streaming_port"] = 4000 node.default["kosmos-mastodon"]["server_name"] = "kosmos.social" +node.default["kosmos-mastodon"]["alternate_domains"] = [] node.default["kosmos-mastodon"]["redis_url"] = "redis://localhost:6379/0" node.default["kosmos-mastodon"]["sidekiq_threads"] = 25 node.default["kosmos-mastodon"]["onion_address"] = nil diff --git a/site-cookbooks/kosmos-mastodon/recipes/default.rb b/site-cookbooks/kosmos-mastodon/recipes/default.rb index 5a2c4b9..3798384 100644 --- a/site-cookbooks/kosmos-mastodon/recipes/default.rb +++ b/site-cookbooks/kosmos-mastodon/recipes/default.rb @@ -42,7 +42,6 @@ elasticsearch_service 'elasticsearch' postgresql_data_bag_item = data_bag_item('credentials', 'postgresql') mastodon_path = node["kosmos-mastodon"]["directory"] - mastodon_user = "mastodon" bind_ip = if node.chef_environment == "production" @@ -160,6 +159,7 @@ application mastodon_path do group mastodon_user variables redis_url: node["kosmos-mastodon"]["redis_url"], domain: node["kosmos-mastodon"]["server_name"], + alternate_domains: node["kosmos-mastodon"]["alternate_domains"], paperclip_secret: mastodon_credentials['paperclip_secret'], secret_key_base: mastodon_credentials['secret_key_base'], otp_secret: mastodon_credentials['otp_secret'], diff --git a/site-cookbooks/kosmos-mastodon/templates/default/env.production.erb b/site-cookbooks/kosmos-mastodon/templates/default/env.production.erb index ff190d3..5fb076b 100644 --- a/site-cookbooks/kosmos-mastodon/templates/default/env.production.erb +++ b/site-cookbooks/kosmos-mastodon/templates/default/env.production.erb @@ -58,3 +58,4 @@ ES_HOST=localhost ES_PORT=9200 ALLOW_ACCESS_TO_HIDDEN_SERVICE=true +ALTERNATE_DOMAINS='<%= @alternate_domains.join(" ") %>'