Skip to content

Commit ff0833e

Browse files
committed
Update docs
1 parent f47dbf3 commit ff0833e

File tree

6 files changed

+141
-99
lines changed

6 files changed

+141
-99
lines changed

README.txt

+124-74
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,3 @@
1-
Jan 2019 note: The extension saw a massive overhaul that is now getting commit
2-
to this repository:
3-
- Self-auth names now look like [56char]onion.foo.com as opposed to
4-
[56char].onion.foo.com
5-
- Support for verifying self-auth names in alt-svc's
6-
- Support for verifying onion address in alt-svc's
7-
- No longer require a Firefox patch
8-
- Relax some verification requirements to make adoption more likely to happen
9-
(for example, requiring the self-auth name to be in the TLS certificate)
10-
111
Contents
122
--------
133

@@ -107,47 +97,127 @@ work.
10797
check that there's a "Trusted SAT mappings lists" section with one list in it
10898
with 2 domain mappings.
10999

110-
Setting Up Server Side (Non-Alt-Svc Version)
111-
--------------------------------------------
100+
Setting Up Server Side
101+
----------------------
112102

113-
--- Add your eventual self-auth domain to a TLS cert
103+
Assumptions:
104+
- Your tor souce code directory is /home/satis/src/tor.
105+
- Your traditional domain is example.com.
106+
- Tor will generate the onion address
107+
rbxel6kjp4o7hz6fmy7af4nv5vyg37fnwddfxnzxqzss2h7lrkzs4rid.onion for you
108+
- Your TLS certificate chain will be located at
109+
/etc/letsencrypt/live/example.com/fullchain.pem
110+
- Your TLS fingerprint will be
111+
1F897271B61AFF9F581CEFE869E191C1C549C2F552757F96A75215187FA2767B
114112

115-
Jump ahead far enough to have compiled Tor. Comment out the
116-
HiddenSerivceSatisSig torrc options since you won't know all of them yet. Run
117-
Tor so that you have a v3 onion service.
113+
--- Get and build my branch of Tor
118114

119-
If your domain is example.com and if data/hs/hostname contains
120-
zfob4nth675763zthpij33iq4pz5q4qthr3gydih4qbdiwtypr2e3bqd.onion, then you will
121-
want the following domains in your TLS cert.
115+
See tor/ or tor.*.tar.xz for the code. I include a build.sh script.
122116

123-
- example.com
124-
- hllvtjcjomneltczwespyle2ihuaq5hypqaavn3is6a7t2dojuaa6rydonion.example.com
117+
Don't run Tor yet.
125118

126-
Note the lack of a '.' before the word onion.
119+
--- Configure Tor (first time)
127120

128-
--- Get and build my branch of Tor
121+
Put the following in your torrc, located at /home/satis/src/tor/torrc
122+
123+
SocksPort 0
124+
DataDirectory data
125+
Log notice file data/notice.log
126+
Log notice stdout
127+
PidFile data/tor.pid
128+
HiddenServiceDir data/hs-example.com
129+
HiddenServicePort 443
130+
HiddenServiceVersion 3
131+
132+
Run Tor briefly:
133+
134+
./src/app/tor -f torrc
135+
136+
It should run in the foreground without errors, and ctrl-c will kill it.
137+
Don't ctrl-c until Tor has logged '[notice] Bootstrapped 100%: Done'
138+
139+
There will now be a hostname file at data/hs-example.com/hostname. This is
140+
the onion address Tor generated. Take note of it.
141+
142+
--- Generate a TLS certificate with your SAT domain in it
143+
144+
With the assumptions given at the beginning of this section, your traditional
145+
domain is example.com and your SAT domain is
146+
rbxel6kjp4o7hz6fmy7af4nv5vyg37fnwddfxnzxqzss2h7lrkzs4ridonion.example.com.
147+
(Note the lack of a dot before "onion")
148+
149+
Do whatever is necessary to obtain a TLS certificate with both of these names
150+
in it. This may mean adding the SAT domain to your example.com nginx config
151+
file, updating your DNS records, and using Let's Encrypt.
152+
153+
Note the location of your shiny new TLS certificate's fullchain.pem
154+
155+
--- Configure Tor (second/final time)
156+
157+
We now have everything necessary to reconfigure Tor and run it for real.
158+
159+
Replace your torrc (at /home/satis/src/tor/torrc) with the following.
160+
161+
SocksPort 0
162+
DataDirectory data
163+
Log notice file data/notice.log
164+
PidFile data/tor.pid
165+
%include example.com.torrc
166+
167+
(We removed logging to stdout and will now pull HiddenService* config options
168+
from the file example.com.torrc)
169+
170+
Find torrc.tmpl and update-torrc.sh in this repo (in the server-scripts
171+
directory). The former is the template for example.com.torrc, and the latter
172+
fills in the template to generate the actual example.com.torrc
173+
174+
Edit the variables at the top of update-torrc.sh to point to your actual
175+
certificate, domain, torrc template, etc.
176+
177+
Run the script. It should complain about not being able to reload Tor
178+
(because you haven't started Tor yet, right?). The error should be:
179+
'cat: ...: No such file or directory' followed by usage info for the 'kill'
180+
command. Anything else and there's probably something wrong.
181+
182+
Once the script has been run once with only the allowed error, you should
183+
find example.com.torrc now exists at /home/satis/src/tor/example.com.torrc.
184+
Verify it exists, it has your traditional domain (example.com), and it has
185+
your TLS fingerprint. For example, it should look like this
186+
(without comments)
129187

130-
See tor/ or tor.*.tar.xz for the code. I include an example torrc.
188+
HiddenServiceDir data/hs-example.com
189+
HiddenServicePort 443
190+
HiddenServiceVersion 3
191+
HiddenServiceSatisSig 1
192+
HiddenServiceSatisDomain example.com
193+
HiddenServiceSatisFingerprint 1F897271B61AFF9F581CEFE869E191C1C549C2F552757F96A75215187FA2767B
194+
HiddenServiceSatisSigInterval 86400
131195

132-
You will need to edit the torrc to have your domain and your TLS fingerprint.
133-
While there's more intelligent ways to figure out your TLS fingerprint,
134-
you can do it with Firefox: https://i.imgur.com/QiPwYqF.png
135-
$ echo "77:C7:6C:11:70:33:25:EE:F0:6C:3B:E3:0F:15:C2:CB:2A:73:7A:56:F3:40:FD:76:29:1E:06:CB:0D:45:48:2C" | tr -d ':'
196+
You should now run Tor continuously in the background. Ideally you wrap it up
197+
in a script that is run on boot with a cronjob. To just run it in the
198+
background now:
136199

137-
Tor outputs your v3 onion address to data/hs/hostname for convenience. It
138-
also writes data/hs/satis_sig*, which you will need later.
200+
./src/app/tor -f torrc --quiet &
201+
202+
After a few seconds, data/notice.log should state
203+
'[notice] Bootstrapped 100%: Done' followed by log lines stating it has wrote
204+
some satis sig files.
139205

140206
--- Tell your webserver aobut the signed data
141207

142208
Tor has generated its signature over the appropriate data in
143-
data/hs/satis_sig.
209+
data/hs-example.com/satis_sig. This file is just raw bytes, and we need to
210+
turn that into base64-encoded bytes in an HTTP header that our webserver
211+
sends to clients.
144212

145213
I use nginx and (at the time of writing) the included
146-
server-scripts/nginx.conf.tmpl and
147-
server-scripts/update-satis-sig-nginx-conf.sh to get this data into my nginx
148-
config. These are a little more complex than would be necessary for other
149-
people, especially if you don't want to use the purposefully bad signatures
150-
too.
214+
nginx.conf.tmpl and update-satis-sig-nginx-conf.sh (both in server-scripts/)
215+
to get this data into my nginx config. These are a little more complex than
216+
would be necessary for other people, especially if you don't want to use the
217+
purposefully bad signatures too.
218+
219+
I will now explain the script by walking you through how I would reimplement
220+
it to be simpler.
151221

152222
To encoded the file in base 64, do something like this:
153223

@@ -160,7 +230,7 @@ work.
160230
2. add the self-auth domain to the server_name line(s) so nginx will
161231
correctly respond to traffic on that name too.
162232

163-
3. plan on using the macor processor m4 to find and replace text in the
233+
3. plan on using the macro processor m4 to find and replace text in the
164234
template file ...
165235

166236
4. decide what text m4 will be looking for. For example M4_SATIS_SIG ...
@@ -182,40 +252,20 @@ work.
182252

183253
Now when people visit example.com, their browser should be getting an
184254
X-SAT-Sig header. Our extension will be expecting it if they visit
185-
hllvtjcjomneltczwespyle2ihuaq5hypqaavn3is6a7t2dojuaa6rydonion.example.com
186-
187-
--- Wrap this process up in a script and run it periodically
188-
189-
Daily is recommended.
190-
191-
If you have Tor run constantly in the background, then you just need to
192-
periodically run your script against the new data/hs/satis_sig file.
193-
194-
I recommend a daily cronjob.
195-
196-
Setting Up Server Side (Alt-Svc Version)
197-
----------------------------------------
198-
199-
I will outline this process as modifications to the previous process.
200-
201-
--- (SKIP) Add your eventual self-auth domain to a TLS cert
202-
203-
You don't need to do this. The extension supports Alt-Svc's as a way to ease
204-
adoption. In the name of easing adoption further, the extension doesn't require
205-
Alt-Svc domains to exist in the TLS certificate.
206-
207-
--- Get and build my branch of Tor
208-
209-
Unchanged from above process.
210-
211-
--- Tell your webserver aobut the signed data
212-
213-
Unchanged from above process, though you'll of course want Alt-Svc headers in
214-
your nginx config.
215-
216-
add_header Alt-Svc 'h2="hllvtjcjomneltczwespyle2ihuaq5hypqaavn3is6a7t2dojuaa6rydonion.example.com:443"; ma=600;';
217-
218-
219-
--- Wrap this process up in a script and run it periodically
220-
221-
Unchanged from above process.
255+
rbxel6kjp4o7hz6fmy7af4nv5vyg37fnwddfxnzxqzss2h7lrkzs4ridonion.example.com.
256+
257+
--- Wrap these processes up in scripts and run them periodically
258+
259+
If your TLS certificate is going to change regularly (for example, Let's
260+
Encrypt certificates expire every 90 days), you should automatically run the
261+
update-torrc.sh script every time you change your TLS certificate. I have
262+
mine run right after 'certbot renew' as a cronjob.
263+
264+
The signatures Tor creates expire every few days. If Tor is running
265+
constantly in the background, it will be updating its signature files every
266+
day by default. Thus you just need to run update-satis-sig-nginx-conf.sh (or
267+
your simplier script) daily to pick up the changes and put them in your nginx
268+
config. As long as your Tor is configured to generate these files much more
269+
often than they expire, it's not terribly important that the get updated in
270+
your nginx config immediately. Just make sure it gets done each day as a
271+
cronjob, for example.

server-scripts/nginx.conf.tmpl

+12-20
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,20 @@
11
server {
2-
server_name satis.system33.pw hllvtjcjomneltczwespyle2ihuaq5hypqaavn3is6a7t2dojuaa6ryd.onion.satis.system33.pw hllvtjcjomneltczwespyle2ihuaq5hypqaavn3is6a7t2dojuaa6rydonion.satis.system33.pw hllvtjcjomneltczwespyle2ihuaq5hypqaavn3is6a7t2dojuaa6ryd.onion;
2+
server_name satis.system33.pw;
3+
server_name hllvtjcjomneltczwespyle2ihuaq5hypqaavn3is6a7t2dojuaa6rydonion.satis.system33.pw;
34
root /var/www/satis.system33.pw;
45
index index.html index.htm;
56
location / {
67
try_files $uri $uri/ =404;
78
}
9+
listen [::]:443 ssl; # managed by Certbot
10+
listen 443 ssl; # managed by Certbot
11+
ssl_certificate /etc/letsencrypt/live/satis.system33.pw/fullchain.pem; # managed by Certbot
12+
ssl_certificate_key /etc/letsencrypt/live/satis.system33.pw/privkey.pem; # managed by Certbot
13+
include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
14+
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
15+
816
add_header X-SAT-Sig M4_SATIS_SIG;
917
add_header Alt-Svc 'h2="hllvtjcjomneltczwespyle2ihuaq5hypqaavn3is6a7t2dojuaa6rydonion.satis.system33.pw:443"; ma=600;';
10-
add_header Alt-Svc 'h2="hllvtjcjomneltczwespyle2ihuaq5hypqaavn3is6a7t2dojuaa6ryd.onion:443"; ma=600;';
11-
location /index.html {
12-
#add_header X-SAT-Sig M4_SATIS_SIG;
13-
}
14-
location /good.html {
15-
#add_header X-SAT-Sig M4_SATIS_SIG;
16-
}
1718
location /badtime.html {
1819
add_header X-SAT-Sig M4_SATIS_SIG_BAD_TIME;
1920
}
@@ -26,30 +27,21 @@ server {
2627
location /badsignature.html {
2728
add_header X-SAT-Sig M4_SATIS_SIG_BAD_SIG;
2829
}
29-
listen [::]:443 ssl; # managed by Certbot
30-
listen 443 ssl; # managed by Certbot
31-
ssl_certificate /etc/letsencrypt/live/satis.system33.pw/fullchain.pem; # managed by Certbot
32-
ssl_certificate_key /etc/letsencrypt/live/satis.system33.pw/privkey.pem; # managed by Certbot
33-
include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
34-
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
3530
}
31+
3632
server {
3733
if ($host = hllvtjcjomneltczwespyle2ihuaq5hypqaavn3is6a7t2dojuaa6rydonion.satis.system33.pw) {
3834
return 301 https://$host$request_uri;
3935
} # managed by Certbot
4036

41-
if ($host = hllvtjcjomneltczwespyle2ihuaq5hypqaavn3is6a7t2dojuaa6ryd.onion.satis.system33.pw) {
42-
return 301 https://$host$request_uri;
43-
} # managed by Certbot
44-
45-
4637
if ($host = satis.system33.pw) {
4738
return 301 https://$host$request_uri;
4839
} # managed by Certbot
4940

5041

5142
listen 80;
5243
listen [::]:80;
53-
server_name satis.system33.pw hllvtjcjomneltczwespyle2ihuaq5hypqaavn3is6a7t2dojuaa6ryd.onion.satis.system33.pw hllvtjcjomneltczwespyle2ihuaq5hypqaavn3is6a7t2dojuaa6rydonion.satis.system33.pw hllvtjcjomneltczwespyle2ihuaq5hypqaavn3is6a7t2dojuaa6ryd.onion;
44+
server_name satis.system33.pw;
45+
server_name hllvtjcjomneltczwespyle2ihuaq5hypqaavn3is6a7t2dojuaa6rydonion.satis.system33.pw;
5446
return 404; # managed by Certbot
5547
}

server-scripts/torrc.tmpl

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
# %include foo.com.torrc
99
# %include bar.com.torrc
1010
# # ... more torrc options you may have ...
11-
HiddenServiceDir data/hs
11+
HiddenServiceDir data/hs-M4_TRAD_DOMAIN
1212
HiddenServicePort 443
1313
HiddenServiceVersion 3
1414
HiddenServiceSatisSig 1

server-scripts/update-torrc.sh

+3-3
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@ set -e
33

44
# Variables
55
####################################
6-
cert_fname="/etc/letsencrypt/live/satis.system33.pw/fullchain.pem"
7-
traditional_domain_name="satis.system33.pw"
6+
cert_fname="/etc/letsencrypt/live/example.com/fullchain.pem"
7+
traditional_domain_name="example.com"
88
torrc_tmpl_fname="torrc.tmpl"
9-
torrc_out_fname="/home/satis/src/tor/satis.system33.pw.torrc"
9+
torrc_out_fname="/home/satis/src/tor/example.com.torrc"
1010
reload_tor_command="cat /home/satis/src/tor/data/tor.pid | xargs kill -HUP"
1111

1212
# Useful functions

tor

tor.selfauth-sig-0.3.5.7.tar.xz

-1.89 KB
Binary file not shown.

0 commit comments

Comments
 (0)