Self-Hosting on the Dark Web
david.alvarezrosa.com
david.alvarezrosa.com
- Making assets embedded as base64 (img src the header logo as base64, all CSS should be inline, etc.).
- Leveraging CSS as much as possible (if you use animations and transitions, use CSS as much as possible for these, avoid JS for them).
- Make sure your website is mostly rendered on the backend. If you're to have JS, your website should work without it.
- Security becomes REALLY fun, as in, avoid XSS, CSRF, SQL Injection attacks and any other injections as much as possible.
As someone summarizes in another comment[0], keep the chattiness as minimal as possible. By chattiness I understand they mean, pack as much data as you can in the same Keep-Alive connection. Avoid making new HTTP requests as much as possible, as each one might get assigned to a new Onion route making things slow.
If you can ship your website to the browser in a single connection, you've won.
I've always been impressed by performance of these big Onion sites, they really push the limits of software engineering creativity, given these constraints and nature of Tor.
--
[0]: https://news.ycombinator.com/item?id=49872320
EDIT: Formatting of bullet points.
Relyinging the least possible on js, and using CSS for animations sounds like good engineering to me
There's also a problem of site fronting. Anyone could run a proxy pretending to be you, for arbitrary reasons (not even necessarily the obvious forging and credential stealing). Every site, even a personal blog, has dozens of parasitic fronts, either actively malicious or dormant. You need off-site ways to tell users what is the real address, and provide a smoke test for them (often a part of the address as a picture, for example in a captcha).
>avoid JS for them
Using any JS defies the point and makes your site instantly suspicious.
This can of course still be defeated if the proxy URL receives very few requests and just have a human in the middle to solve the CAPTCHAs. But it does make the attack non-automated.
How can you do this without relying on the normal web? Let’s say you use a normal website to show the onion link, if the website gets taken down, you lost your user-trusted mean to do that.
How can you trust anything you haven't experienced personally? By using chains of trust, of course. There are directories that list onion sites, and also sites that link to their peers. That way you can be sure you're still in the same bubble at least, and convert the problem into trusting the entire bubble. It's not automated and pretty ad hoc, if that's what you're wondering. Automation in Tor has a history of being circumvented or exploited with novel scams, this is an adversarial environment.
https://community.torproject.org/onion-services/advanced/oni...
This way you advertise the onion domain through an established chain of trust and visitors can decide to use that the next time.
I thought the whole point of Tor is that I (and only I) am able to serve traffic at a .onion URL that I have generated. How could someone else get in front of that?
That's why you need to very carefully choose a trusted entry point into the Torosphere and revise your choice from time to time; always remember your initial entry point because if there's any suspicious drama around it or if you notice a mismatching link on different sites, you might have been duped to enter an impersonator-controlled bubble.
Many things can be done about it: claiming your spot in the directories, smoke test captchas, chains of trust, or you can brute force your .onion to find a valid one that starts with a memorable string (the longer the better, but also the harder). Vanity addresses like this deter non-targeted adversaries by requiring proof of work to forge the lookalike URL. None of that is bulletproof, of course.
I wrote about it in 2600 almost ten years ago (already?!). A copy of my article can be found here: https://pablorauzy.fr/outreach/2600/how-to-run-a-tor-hidden-...
If you have an Onion copy of your website, don't forget the Onion-Location http header which will automatically redirect Tor Browser users to the onion version of the website even if they visit it at the clear web address.
If it interests people, I also have a follow up article about I2P: https://pablorauzy.fr/outreach/2600/how-to-run-an-i2p-hidden...
http://pablo2httpff4vogufavlmbxw4jkgb3amnywex2xdnchpztkdu2lu...
And for the OP's site
onion-location:
http://dhevt6e4rtgbtr3jh53xrpwmgtilkah6nyjujocsspssrsexc7omx...
Question: Can the .onion sites withstand HN front page traffic
I really believe the single threaded BusyBox httpd running on a low end mini PC in my bedroom will stand hosting my static web site without any trouble.
NB. The question poses a hypothetical. No one is suggesting that HN allows stories (submissions) with .onion URLs or that .onion URLs would receive the same amount of traffic as "clearnet" ones
For example, a NYT article using an .onion URL rather than a "clearnet" URL
> HiddenServicePort 80 127.13.37.1:8080
> listen 127.13.37.1:8080;
This way, strangers won't be able to connect to a service bound to 127.0.0.1, should you ever decide to re-use the port and forget to disable the hidden service.
You'll also need to use separate ports and/or bind addresses if you host multiple hidden services and don't want people to correlate them - if nginx doesn't match the Host header, it will serve whichever site comes first alphabetically.
You can monkey-patch scripts around Tor service activation, but I haven't been able to get my Tor+nginx setup to work reliably after updates/service restarts when using unix sockets.
1. If you want to improve page load speed you need to buy a HTTPS certificate so you are not limited to HTTP/1.1. Multiplexing in HTTP/2 is important for getting sites to load fast.
2. You can set the HiddenServiceExportCircuitID configuration to pass the circuit id to your web server for telemetry or anti abuse purposes. Otherwise your logs will say that all users are coming from the same IP.
Which raises the question: why not just trust self-signed certificates on onion services? From my brief look it seems to be because the Tor project views the primary purposes of HTTPS on onion services to be other things rather than just http/2 support: http/2 isn't even mentioned on their page about https for onion services (https://community.torproject.org/onion-services/advanced/htt...). Unfortunate.
Trying to push hidden services to stay on HTTP is going against what the rest of the web is doing and as a minority of web traffic it really should be aligned to the rest of the web and also require HTTPS. Yes, it's technically wasteful, but reduces both work and security risk by keeping security models aligned with the rest of the web.
To make sure once in the .onion, you never leave the .onion
These companies also attempt to create "walled gardens" to enable behavioral surveillance and ad targeting on pools of "logged in" users
Many of these websites are hidden behind "CDNs" that try to force visitors to use surveillance and advertising-friendly web browsers, allegedly to protect them from those developers hell bent on scraping/crawling (who they refer to as "bots")
The end result is that in _some cases_ it can actually be more difficult for me to do information retrieval from popular websites than from so-called "darknet" sites
I prefer textmode to graphics (e.g., X11, etc.) and I'm not a fan of the so-called "modern" browser. As such, .onion sites are more user-friendly for me
I like the design of using public keys, or portions thereof, as hostnames. No ICANN registrar "domain name business" and extortion from trademark holders
The point is that regardless of what might be offered over the "darknet", its design actually makes it more accessible to me
It supports commerce but there's no surveillance or ads so it's quick and efficient
IMHO, this is what the "clearnet" www should be like, but isn't
I keep encountering more and more sites complaining about it. And of course any visitor not using a popular browser running Javascript will suffer as they are likely to be mistaken for a "bot"
It's so bad I'm even seeing software mirrors complaining about it
For example, one has disabled indexing ("index of" listing)
Know this: the "dark web" is not for people who just want to own your domain name. It's for SECURITY and that use case is going to drive all their decisions. And if it wipes out every community in the entire tor dark web? So be it. And they'll do it again. Don't build your communities on the sand that is the dark web. You won't like the result.
v2 onions being deprecated was announced long in advance so many sites managed their transfer by announced the new URL well in advance. I don't think anyone was really bothered.
Yeah, some sites told their users about their new v3 domain. But the web was entirely destroyed.
One might even see it as positive, because it forces maintenance. Anyone still linking to v2 addresses clearly is letting things rot. Nobody should ever assume that content available under a certain URL will be there forever, after all, even if the domain stays valid and existant.
I eventually moved the blog to Cloudflare Pages primarily because I wanted to use Cloudflare Workers to handle the comments, though I have still considered dual-publishing it just to still say I've done it.
This, in turn, handicaps me searching for information. If they could fix this problem then I would be more likely to make use of TOR. We really need to think long-term about a future web that isn't ruined by Google etc... while also not being locked down such as via age-gating.
Tor amplifies the problems caused by badly written websites that do a billion HTTP calls (unless you have HTTPS enabled on Tor) which does make it noticeably slower in a few edge cases, but I don't think it's as bad as its reputation suggests. For this particular blog, the Tor version loads maybe a couple hundred milliseconds slower, mostly because of images coming in slower (content is ready almost immediately).
Lots of hidden services seem to be under constant DDoS attack, though.
There are still plenty of issues with TOR (my main gripe is the "domain names" being practically impossible to recognize/trust or tell anyone about in the real world), but I don't think speed is the biggest factor anymore.
some single parties called government agencies pretty much can. it’s just much harder to do, so you’re safe from random people
If I were a government and had just spent a pretty penny on implementing the necessary infrastructure to defeat an encrypted routing scheme, I would probably not use that capability to bust internet drug dealers and other petty criminals, resulting in everyone scattering to a new scheme or to seek security through obscurity in some hand-rolled solution. I'd save it for national security level threats. High value targets.
Though thinking about it further, it would still be workable to gather compromising information on low-value targets without necessarily acting on it.
That would require many individuals to keep a juicy secret for a hypothetical future collective reward.
Kinda funny, I wondered what it would be like from that perspective but the first website about editing the config file strongly discourages doing that (specifically by instruction of random websites) then they throw you into an abyss of config file madness.
Just the first task is already asking a lot from our proverbial botanist.
Onionshare runs on basically every device out there (for obscure devices like Linux ARM phones you may need to compile it manually). Install the app, point it at a directory with an index.html file inside, and you're done.
(There are solutions for CGNAT - https://david.alvarezrosa.com/posts/self-hosting-behind-cgna...)
If people need to tell you your services are down, you end up eating a huge amount of downtime.