Enterprise-Onion-Toolkit/README.md

313 wiersze
10 KiB
Markdown
Czysty Zwykły widok Historia

2017-02-01 08:19:33 +00:00
# The Enterprise Onion Toolkit
2017-02-01 08:38:03 +00:00
## eotk (c) 2017 Alec Muffett
2017-02-11 21:03:04 +00:00
## Status
2017-02-08 18:32:45 +00:00
2017-02-11 21:03:30 +00:00
**ALPHA** - see [project activity](https://github.com/alecmuffett/eotk/graphs/commit-activity) for information.
2017-02-01 11:56:52 +00:00
2017-02-11 21:03:04 +00:00
## Changes
* all of CSP, HSTS and HPKP are suppressed by default; onion networking mitigates much of this
* ["tunables"](/alecmuffett/eotk/blob/master/TUNEABLES.md) documentation for template content
* `troubleshooting` section at the bottom of this page*
## Introduction
The goal of EOTK is to provide a tool for prototyping, and deploying
at scale, HTTP and HTTPS onion sites to provide official presence for
2017-02-04 10:49:03 +00:00
popular websites.
2017-02-04 10:49:03 +00:00
The results are essentially a "man in the middle" proxy; set them up
only for your own sites or for sites which do not require login
credentials of any kind.
2017-02-01 13:02:24 +00:00
2017-02-04 10:49:03 +00:00
The resulting NGINX configs are probably both buggy and not terribly
well tuned; please consider this project to be very much "early days",
but I shall try not to modify the configuration file format.
2017-02-01 11:59:52 +00:00
2017-02-01 12:01:29 +00:00
The `softmap` support is untested, and needs some more work to make it
nice to launch and integrate with OnionBalance; please avoid it for
the moment.
2017-02-08 19:55:06 +00:00
## An Important Note About Anonymity
2017-02-10 16:41:09 +00:00
The presumed use-case of EOTK is that you have an already-public
website and that you wish to give it a corresponding Onion address.
2017-02-08 19:55:06 +00:00
2017-02-10 21:00:36 +00:00
A lot of people mistakenly believe that Tor Onion Networking is "all
about anonymity" - which is incorrect, since it also includes:
2017-02-08 19:55:06 +00:00
2017-02-10 16:41:09 +00:00
* extra privacy
2017-02-08 19:55:06 +00:00
* identity/surety of to whom you are connected
* freedom from oversight/network surveillance
2017-02-10 16:41:09 +00:00
* anti-blocking, and...
* enhanced integrity/tamperproofing
2017-02-08 19:55:06 +00:00
2017-02-10 16:41:09 +00:00
...none of which are the same as "anonymity", but all of which are
valuable qualities to add to communications.
2017-02-08 19:55:06 +00:00
2017-02-10 21:00:36 +00:00
Also: setting up an Onion address can provide less contention, more
speed & more bandwidth to people accessing your site than they would
get by using Tor "Exit Nodes".
2017-02-10 16:41:09 +00:00
2017-02-10 21:00:36 +00:00
If you set up EOTK in its intended mode then your resulting site is
almost certainly not going to be anonymous; for one thing your brand
name (etc) will likely be plastered all over it.
If you want to set up a server which includes anonymity **as well as**
all of the aforementioned qualities, you
2017-02-10 16:41:09 +00:00
[want to be reading an entirely different document, instead](https://github.com/alecmuffett/the-onion-diaries/blob/master/basic-production-onion-server.md).
2017-02-08 19:55:06 +00:00
2017-02-04 10:49:03 +00:00
## Usage Notes
2017-02-04 10:49:03 +00:00
When connecting to the resulting onions over HTTP/SSL, you will be
using wildcard self-signed SSL certificates - you *will* encounter
many "broken links" which are due to the SSL certificate not being
valid. This is *expected* and *proper* behaviour.
2017-02-04 10:49:03 +00:00
To help cope with this, for any domain (eg:
www.foofoofoofoofoof.onion) the EOTK provides a fixed url:
* `https://www.foofoofoofoofoof.onion/hello-onion/`
2017-02-04 10:49:47 +00:00
...which (`/hello-onion/`) is internally served by the NGINX proxy and
provides a stable, fixed URL for SSL certificate acceptance; inside
TorBrowser another effective solution is to open all the broken links,
images and resources "in a new Tab" and accept the certificate there.
In production, of course, one would expect to use an SSL EV
2017-02-04 10:49:03 +00:00
certificate to provide identity and assurance to an onion site,
rendering these issues moot.
# Requirements
2017-02-04 18:06:09 +00:00
* `tor` (latest stable)
* `nginx` (latest stable) with the following features & modules
* `headers_more`
* `ngx_http_substitutions_filter_module`
* `http_sub`
* `http_ssl`
On Linux, scripts are provided to compile these.
On OSX, these are available via Homebrew.
2017-02-05 16:49:10 +00:00
# Video Demonstrations
* [Basic Introduction to EOTK](https://www.youtube.com/watch?v=ti_VkVmE3J4)
2017-02-08 18:14:46 +00:00
* [Rough Edges: SSL Certificates & Strange Behaviour](https://www.youtube.com/watch?v=UieLTllLPlQ)
2017-02-05 16:49:10 +00:00
2017-02-08 17:58:27 +00:00
# Command List
2017-02-04 10:58:52 +00:00
Intuitively obvious to the most casual observer:
2017-02-04 10:49:03 +00:00
* `eotk config [filename]` # default `onions.conf`
2017-02-04 12:51:47 +00:00
* *synonyms:* `conf`, `configure`
2017-02-04 12:57:02 +00:00
* parses the config file and sets up and populates the projects
2017-02-04 12:51:47 +00:00
* `eotk status projectname ...` # or: `-a` for all
2017-02-04 12:57:02 +00:00
* process status
2017-02-04 12:51:47 +00:00
* `eotk maps projectname ...` # or: `-a` for all
2017-02-04 12:57:02 +00:00
* print which onions correspond to which dns domains
2017-02-04 10:49:03 +00:00
* `eotk start projectname ...` # or: `-a` for all
2017-02-04 12:57:02 +00:00
* start projects
2017-02-04 10:49:03 +00:00
* `eotk stop projectname ...` # or: `-a` for all
2017-02-04 12:57:02 +00:00
* stop projects
2017-02-04 10:49:03 +00:00
* `eotk bounce projectname ...` # or: `-a` for all
2017-02-04 12:51:47 +00:00
* *synonyms:* `restart`, `reload`
2017-02-04 12:57:02 +00:00
* stop, and restart, projects
2017-02-04 10:49:03 +00:00
* `eotk debugon projectname ...` # or: `-a` for all
2017-02-04 12:57:02 +00:00
* enable verbose tor logs
2017-02-04 10:49:03 +00:00
* `eotk debugoff projectname ...` # or: `-a` for all
2017-02-04 12:57:02 +00:00
* disable verbose tor logs
2017-02-04 10:49:03 +00:00
* `eotk harvest projectname ...` # or: `-a` for all
2017-02-04 12:51:47 +00:00
* *synonyms:* `onions`
2017-02-04 12:57:02 +00:00
* print list of onions used by projects
2017-02-04 16:36:17 +00:00
* `eotk ps`
* do a stupid grep for possibly orphaned processes
2017-02-05 13:39:11 +00:00
* `eotk genkey`
* *synonyms:* `gen`
* generate an onion key and stash it in `secrets.d`
2017-02-04 10:49:03 +00:00
# Installation
## OSX
Currently works on OSX with Homebrew:
* install homebrew - http://brew.sh/
* `git clone https://github.com/alecmuffett/eotk.git`
* `cd eotk`
2017-02-08 18:14:46 +00:00
* `sh ./000-setup-osx.sh` # installs required software; if you're
worried, check it first
## Raspbian
2017-02-04 16:41:12 +00:00
2017-02-04 18:20:45 +00:00
* `git clone https://github.com/alecmuffett/eotk.git`
* `cd eotk`
* **Read** [000-setup-raspbian.md](000-setup-raspbian.md) and follow the instructions.
2017-02-04 16:41:12 +00:00
## Debian and Ubuntu
Try the same instructions as for Raspbian, it seems to work okay
although you *may* need to install a compiler first. The installation
2017-02-08 18:14:46 +00:00
involves a lot of compilation and may take 20..30 minutes on a slow
machine.
2017-02-01 13:02:24 +00:00
# I don't own a site, but I want to experiment!
2017-02-04 10:58:52 +00:00
If you want to experiment with some prefabricated projects, try this:
2017-02-08 18:14:46 +00:00
* `sh ./001-configure-demo.sh` # creates a working config file,
`demo.conf`
* `eotk config demo.conf` # creates tor & nginx config files; lists
onion sites
2017-02-04 10:58:52 +00:00
* `eotk start default`
* Now you can...
2017-02-08 18:14:46 +00:00
* Connect to one of the onions cited on screen for the `default`
project
2017-02-04 10:58:52 +00:00
* Play SSL-Certificate-Acceptance-Whackamole
* Browse a little...
* `eotk stop default`
2017-02-04 10:49:03 +00:00
## This is really complex, do you have something similar I can play with?
There's [another document I wrote](https://github.com/alecmuffett/the-onion-diaries/blob/master/building-proof-of-concept.md), showing how to do something very similar to `eotk` by using a tool called `mitmproxy`; if you can use a Linux commandline it will give you something relevant to play with, and you won't have to setup anything permanent.
2017-02-01 13:02:24 +00:00
# I want to create a new project / my own configuration!
You can either add a new project to the demo config file, or you can
2017-02-04 10:58:52 +00:00
create a new config for yourself. If you want an onion for `foo.com`,
the simplest configuration file probably looks like this:
2017-02-01 13:02:24 +00:00
```
set project myproject
hardmap secrets.d/xxxxxxxxxxxxxxxx.key foo.com
```
2017-02-04 10:06:42 +00:00
...and if you create a file called `project.conf` containing those
2017-02-01 13:09:53 +00:00
lines, then you should be able to do:
2017-02-01 13:02:24 +00:00
```
2017-02-04 10:58:52 +00:00
eotk configure project.conf
eotk start myproject
2017-02-01 13:02:24 +00:00
```
## But how do I create my own "secrets.d/xxxxxxxxxxxxxxxx.key"?
2017-02-05 13:14:47 +00:00
* Do `eotk genkey` - it will print the name of the onion it generates
* Do this as many times as you wish/need.
2017-02-04 18:28:37 +00:00
* Alternately get a tool like `scallion` or `shallot` and use that to
2017-02-05 13:14:47 +00:00
"mine" a desirable onion address.
* Be sure to store your mined private keys in `secrets.d` with a
filename like `xxxxxxxxxxxxxxxx.key` where `xxxxxxxxxxxxxxxx` is the
corresponding onion address.
2017-02-04 18:16:56 +00:00
2017-02-04 18:17:35 +00:00
## But I not only have `www.foo.com`, I have `www.dev.foo.com`!
2017-02-04 18:16:56 +00:00
2017-02-05 13:14:47 +00:00
Subdomains are supported like this:
2017-02-04 18:16:56 +00:00
```
set project myproject
hardmap secrets.d/xxxxxxxxxxxxxxxx.key foo.com dev
```
...and if you have multiple subdomains:
```
hardmap secrets.d/xxxxxxxxxxxxxxxx.key foo.com dev blogs dev.blogs [...]
```
2017-02-05 16:20:26 +00:00
2017-02-08 18:32:45 +00:00
# Troubleshooting
Firstly, the logs for any given project will reside in `projects.d/<PROJECTNAME>.d/logs.d/`
If something is problematic, first try:
* `git pull` and...
* `eotk config <filename>.conf` again, and then...
* `eotk bounce -a`
## Lots of broken images, missing images, missing CSS
This is probably an SSL/HTTPS thing.
Because of the nature of SSL self-signed certificates, you have to
manually accept the certificate of each and every site for which a
certificate has been created. See the second of the YouTube videos for
some mention of this.
In short: this is normal and expected behaviour. You can temporarily
fix this by:
* right-clicking on the image for `Open In New Tab`, and accepting the
certificate
* or using `Inspect Element > Network` to find broken resources, and
doing the same
* or - if you know the list of domains in advance - visiting the
`/hello-onion/` URL for each of them, in advance, to accept
certificates.
If you get an
[official SSL certificate for your onion site](https://blog.digicert.com/ordering-a-onion-certificate-from-digicert/)
then the problem will vanish. Until then, I am afraid that you will be
stuck playing certificate "whack-a-mole".
2017-02-11 21:03:04 +00:00
## NGINX: Bad Gateway
2017-02-08 18:32:45 +00:00
2017-02-11 21:03:04 +00:00
Generally this means that NGINX cannot connect to the remote website,
2017-02-08 18:32:45 +00:00
which generally happens because:
* the site name in the config file, is wrong
* the nginx daemon tries to do a DNS resolution, which fails
2017-02-11 21:03:04 +00:00
Check the NGINX logfiles in the directory cited above, for
2017-02-08 18:32:45 +00:00
confirmation. If DNS resolution is failing, *PROBABLY* the cause is
not running a DNS server locally; therefore in your config file you
should add a line like this - to use Google DNS as an example:
```
set nginx_resolver 8.8.8.8
```
...and then do:
```
eotk stop -a
eotk config filename.conf
eotk start -a
```
I will look into hardcoding the Google DNS server as a default.
## I can't connect, it's just hanging
If your onion project has just started, it can take up to a few
minutes to connect for the first time; also sometimes TorBrowser
caches stale descriptors for older onions. Try restarting TorBrowser
(or use the `New Identity` menu item) and have a cup of tea. If it
persists, check the logfiles.
## Help I'm Stuck!
Ping @alecmuffett on Twitter, or log an `Issue`, above.
2017-02-05 16:20:26 +00:00
# Acknowledgements
2017-02-08 18:14:46 +00:00
EOTK stands largely on the experience of work I led at Facebook to
create `www.facebookcorewwwi.onion`, but it owes a *huge* debt to
[Mike Tigas](https://github.com/mtigas)'s work at ProPublica to put
2017-02-11 21:03:04 +00:00
their site into Onionspace through using NGINX as a rewriting proxy --
2017-02-08 18:14:46 +00:00
and that
[he wrote the whole experience up in great detail](https://www.propublica.org/nerds/item/a-more-secure-and-anonymous-propublica-using-tor-hidden-services)
including
[sample config files](https://gist.github.com/mtigas/9a7425dfdacda15790b2).
2017-02-05 16:20:26 +00:00
2017-02-11 21:03:04 +00:00
Reading this prodded me to learn about NGINX and then aim to shrink &
2017-02-08 18:14:46 +00:00
genericise the solution; so thanks, Mike!
2017-02-05 16:29:31 +00:00
2017-02-11 21:03:04 +00:00
Also, thanks go to Christopher Weatherhead for acting as a local NGINX
2017-02-08 18:14:46 +00:00
*sounding board* :-)
2017-02-05 16:29:31 +00:00
2017-02-08 18:14:46 +00:00
And back in history: Michal Nánási, Matt Jones, Trevor Pottinger and
the rest of the FB-over-Tor team. Hugs.