<div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div>Hey All; </div><div><br></div><div>I just got Alt-Svc to mostly-work for my blog at <a href="https://dropsafe.crypticide.com/">https://dropsafe.crypticide.com/</a></div><div><br></div><div>Here's what I did, and why:</div><div><br></div><div>I set up a dummy interface on my blogserver (for rationale/instructions, see link below)</div><div><br></div><div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><font face="monospace, monospace">$ grep osite0 /etc/hosts<br></font><font face="monospace, monospace">169.254.255.253 <b>osite0.onion</b></font><font face="monospace, monospace"><br></font><font face="monospace, monospace">$ ifconfig dummy0<br></font><font face="monospace, monospace">dummy0: flags=195<UP,BROADCAST,RUNNING,NOARP>  mtu 1500<br></font><font face="monospace, monospace">        inet 169.254.255.253  netmask 255.255.255.252  broadcast 169.254.255.255</font><font face="monospace, monospace"><br></font><font face="monospace, monospace">$ ping -c 1 <b>osite0.onion</b><br></font><font face="monospace, monospace">PING osite0.onion (169.254.255.253) 56(84) bytes of data.<br></font><font face="monospace, monospace">64 bytes from osite0.onion (169.254.255.253): icmp_seq=1 ttl=64 time=0.167 ms</font></blockquote><div> </div></div><div>Set up an onion service, pointing at the dummy interface (rather than localhost or the machine's physical network interface):</div><div><br></div><div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><font face="monospace, monospace">HiddenServiceDir /path/to/wherever<br></font><font face="monospace, monospace">HiddenServicePort 80 <b>osite0.onion</b>:80<br></font><font face="monospace, monospace">HiddenServicePort 443 <b>osite0.onion</b>:443<br></font><font face="monospace, monospace">HiddenServiceVersion 3<br></font><font face="monospace, monospace">HiddenServiceNumIntroductionPoints 3</font></blockquote></div><div><br></div><div>Configured Apache:</div><div><br></div><div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><font face="monospace, monospace"># Set ALT_SVC_PORT explicitly because SERVER_PORT fails curiously<br></font><font face="monospace, monospace">SetEnv ALT_SVC_PORT <b>443</b><br></font><font face="monospace, monospace">SetEnv ALT_SVC_ONION <b>kfq56...<i>trimmed</i>...o6uqd.onion</b><br></font><font face="monospace, monospace">SetEnv ALT_SVC_MAXAGE 600</font><font face="monospace, monospace"><br></font><font face="monospace, monospace"># Set the Alt-Svc header if the request has not arrived via EOTK;<br></font><font face="monospace, monospace"># You almost certainly do not need to do this, it's specific to EOTK development.</font></blockquote><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><font face="monospace, monospace"># EOTK sets "<b>X-From-Onion</b>: 1" so if that value is empty, set the flag to true:<br></font><font face="monospace, monospace">RewriteCond %{HTTP:<b>X-From-Onion</b>} ^$<br></font><font face="monospace, monospace">RewriteRule ^ - [ENV=<b>USE_ALT_SVC</b>:true]</font><font face="monospace, monospace"><br></font><font face="monospace, monospace"># ...maybe put other tests here, and then eventually we do:<br></font><font face="monospace, monospace">Header set '<b>Alt-Svc</b>' '<b>h2="%{ALT_SVC_ONION}e:%{ALT_SVC_PORT}e"; ma=%{ALT_SVC_MAXAGE}e; persist=1</b>' env=<b>USE_ALT_SVC</b></font></blockquote></div><div><br></div><div>Enabled HTTP/2 on my Apache server (it's not enabled by default):</div><br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><font face="monospace, monospace"># <b>a2enmod http2</b> # ...after adding "<b>Protocols h2 http/1.1</b>" to the vhost config<br></font><font face="monospace, monospace"># <b>systemctl restart apache2</b></font></blockquote></div><div dir="ltr"><br></div><div>...then I found this error message in /var/log/apache2/error.log: </div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><i>The mpm module (prefork.c) is not supported by mod_http2. The mpm determines how things are processed in your server. HTTP/2 has more demands in this regard and the currently selected mpm will just not do. This is an advisory warning. Your server will continue to work, but the HTTP/2 protocol will be inactive.</i></blockquote><div dir="ltr"><br></div><div>Bother.  I found <b>mpm_prefork</b> really was enabled by default, and was a hard dependency for php7.0 operation (necessary for Wordpress):</div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><font face="monospace, monospace"># apache2ctl -M | grep mpm</font></blockquote><div dir="ltr"><br></div><div>Then I found this answer: <b><a href="https://serverfault.com/a/904115">https://serverfault.com/a/904115</a></b> ...which told me how to fix this by swapping over to <b>mpm_event</b> and <b>php_fpm</b>. I followed the instructions (needed to tweak the cited path for the <b>ProxyPassMatch </b>line) and tested that the header was being generated and looks sane, via my TorBrowser's tor daemon:</div><div dir="ltr"><div><br></div><div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><font face="monospace, monospace">$ curl --http1.1 -x socks5h://<a href="http://127.0.0.1:9150/">127.0.0.1:9150/</a> -I <a href="https://dropsafe.crypticide.com/">https://dropsafe.crypticide.com/</a> | grep -i Alt-Svc<br></font><font face="monospace, monospace">Alt-Svc: h2="<b>kfq56...<i>trimmed</i>...o6uqd.onion</b>:<b>443</b>"; ma=600; persist=1</font></blockquote></div><div><br></div><div><font face="arial, helvetica, sans-serif">The test required the <b>--http1.1</b> option for curl, otherwise if the curl client negotiated a h2 connection, I wouldn't apparently see any of the options in a greppable manner.<br></font></div><div><br></div><div>Re: the dummy interface, as described elsewhere:</div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><font face="monospace, monospace"><a href="https://github.com/alecmuffett/the-onion-diaries/blob/master/basic-production-onion-server.md">https://github.com/alecmuffett/the-onion-diaries/blob/master/basic-production-onion-server.md</a></font></blockquote><div><br></div><div>...the joy of using a dummy interface in this fashion is that all connections from the Tor daemon to a webserver on the same machine will be logged as coming "from" the IP address of the dummy interface. This means that you can track accesses that arrive via the Alt-Svc onion connection, separately from all the others:</div><div><br></div><div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><font face="monospace, monospace">$ grep 169.254 www-dropsafe-access.log<br><b>169.254.255.253</b> - - [22/Sep/2018:23:05:48 +0000] "GET / HTTP/1.1" 200 231583 "-" "curl/7.54.0"<br></font></blockquote></div><div><br></div><div>...which provides the otherwise-missing information of <b>whether the Alt-Svc Onion Link is actually being used</b>.</div><div><br></div><div><font face="arial, helvetica, sans-serif">Setting up a dummy interface on Ubuntu is fairly easy, but on Raspbian was a pain because <b>dhcpcd</b> gets in the way; eventually I just disabled dhcpcd and went back to /etc/network/interfaces, which was okay because my blog server only has static addresses. </font>I'm still not entirely convinced that everything is working as expected/desired, but I'll update again when I am more certain.</div><div><br></div><div>The blog is also available via EOTK at <a href="https://dropsafe.dropsafezeahmyho.onion/">https://dropsafe.dropsafezeahmyho.onion/</a> - requires SSL acceptance.</div><div><br></div><div>Best of luck.</div><div><br></div><div>    - alec</div><div><br></div>-- <br><div dir="ltr" class="gmail_signature"><a href="http://dropsafe.crypticide.com/aboutalecm" target="_blank">http://dropsafe.crypticide.com/aboutalecm</a><br></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div>