Fastly¶
Fastly is a CDN we use, and a CDN is a "Content delivery network", "a geographically distributed network of proxy servers and their data centers. The goal is to provide high availability and performance by distributing the service spatially relative to end users." -- (Wikipedia)
Tor operates its own CDN in the form of the static-component system, but also uses external providers for certain edge cases like domain fronting and Tor browser upgrades (but not installs), since they are delivered over Tor.
Tip
This page documents mostly the commercial provider, see the static-component page for our own CDN and static-sites for user documentation.
Domain fronting¶
The basic idea here is that you setup Fastly as a proxy for a service
that is being censored. Let's call that service
example.torproject.net for the purpose of this demonstration.
In the Fastly control panel (password in tor-passwords.git,
hosts-extra-info):
-
Press "Create a Delivery service"
-
Choose
example.torproject.netas the "Domain", so that requests with that domain in theHost:will route to this configuration, add name of the service and ticket reference number as a comment -
then add a "host" (a backend, really) named
example.torproject.net(yes, again), so that requests to this service will go to the backend (those are also called "origins" in Fastly) -
"Activate" the configuration, this will give you a URL the domain fronting client should be able to use (the "test domain link"), which should be something like
example.torproject.net.global.prod.fastly.net
Note that this does not support subpaths
(e.g. example.torproject.net/foo), make a new virtual host for the
service instead of using a subpath.
Also note that there might be other URLs you can use to reach the service in Fastly, see choosing the right hostname in Fastly's documentation.
Pager playbook¶
For problems with our own system, see the static-component playbook.
Disaster recovery¶
For problems with our own system, see the static-component disaster recovery.
Design and architecture¶
We have two main CDNs systems that are managed by TPA. The first and more elaborate one is the static-component system, and the other is a commercial CDN provider, Fastly.
We have both for privacy reasons: we do not want to send our users to an external provider, where we do not control what they do with the user data, specifically their logging (retention) policies, law enforcement collaboration policies and, generally, we want to retain control over that data.
We have two main exceptions: one is for Tor browser upgrades, which are performed over Tor so should not cause any security issues to end users, and the other is domain fronting, which is specifically designed to use commercial CDNs to work around censorship.
Most of the following documentation pertains to the commercial CDN provider, see the static-component documentation for the reference guide on the other CDN.
TODO: make a small architecture diagram of how Fastly works for TB upgrades and another for domain fronting
Checklist¶
Those must be filled in, or the service is not properly supported:
- Backups: none needed
- Monitoring and metrics: none, see also tpo/tpa/team#21303
- Maintainer: originally weasel through debian.org contacts, now anarcat and TPA
- Users: used by the anti-censorship and applications teams, public
- Upstream*: Fastly.com, deal negotiated through Debian,
Message-Id<CANeg4+d1St_bwU0JNbihhRMzniZnAhakX2O9Ha5b7b13D1pcvQ@mail.gmail.com> - Logs: TODO: document
- Tests: unclear, TODO: document how to test if Fastly works for TB and domain fronting.
- Authentication: shared account in
tor-passwords.git - Implementation: proprietary, uses Varnish (as of 2020)
- Issues: ~Fastly label
Details¶
- SLA: none, see also static-component SLA
- Services: HTTPS
- Storage: N/A
- Queues: N/A
- Interfaces: API, cdn-config-fastly.git, https://manage.fastly.com/
- Related services: TLS, DNS, static-component
- Other documentation: https://docs.fastly.com/
- Known issues:
Installation¶
For static site components, see the static-component installation documentation.
TODO: document how a site gets added into Fastly's CDN.
Upgrades¶
Not relevant for external CDNs.
Security and risk assessment¶
There hasn't been a official security review done of the Fastly hosting service or its privacy policy, but it is rumoured that Fastly's privacy policies are relatively innocuous.
In principle, Varnish doesn't keep logs which, out of the box, should expose our users less, but Varnish is probably severely modified from the upstream. They do provide dashboards and statistics which show they inject some VCL in their configuration to at least add those analytics.
TODO: explicitly review the Fastly privacy policies and terms of service
Billing¶
We have 20k$/mth credits. Effectively, we are billed bandwidth at 0$ per month so it's hard to estimate how much of that we currently use, but according to the latest invoice (in April 2021), we were using about 186,000GB (so ~180TB) per month through 1300 requests (!?). According to their calculator that would be ~15000$/mth. So, back in April 2021, we had about 5k$/mth extra.
One risk would be that Fastly starts charging us for that service or simply stops hosting us. If we really are using "only" 180TB/month, that ends up being about 500 megabit/sec on average over the month, and we might be able to spin up more virtual machines to cover for the costs.
Technical debt and next steps¶
The CDN service is stable in the sense that it doesn't see much change.
Its main challenge at this point is the duality between Fastly and our bespoke static-component system, with a lot of technical debt in the latter.
There is also no automation done for domain fronting, the cdn-config-fastly.git framework covering only the static-component parts.
Architecture decision records¶
None for now.
Other alternatives¶
None for now.