[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[tor-talk] Decent guide to setting up an .onion site on a VPS?
- To: tor-talk@xxxxxxxxxxxxxxxxxxxx
- Subject: [tor-talk] Decent guide to setting up an .onion site on a VPS?
- From: Mirimir <mirimir@xxxxxxxxxx>
- Date: Sat, 11 May 2019 22:31:04 -0700
- Autocrypt: addr=mirimir@xxxxxxxxxx; prefer-encrypt=mutual; keydata= xsBNBFEN49cBCADWl1VZKYO8L+f/65G2nBWzh41VTAZDcJSxMWXrBSvpJzzLt6sJf0L0Rjmy W4VPxJMCm/32auRAp8Xx1iNmBpvYENSM1YJVWfk43tlSOY8CR3TVODMxWPhUu48Pb9OKSntz WHGwdZmOr14zF9vr4PaS9A6+Hyt9FPKuGcQFw7K8jK1Hpp5XgdY/DMHKeaJykJ8JH1HBTFTT OJdxIWu6cZ+spNaNfKdnNjk98hMPw69isVGzcm7b3lJUsjVnMSqnrtZ8CSIv1njyxJH7NB5n LzrE7EiXR37k+4Poc9/DeLSAKrq5N3ZMpX1EDOoXFa8lLVGWHBTwVN/tl7FLM0NmVuL5ABEB AAHNHG1pcmltaXIgPG1pcmltaXJAcmlzZXVwLm5ldD7CwIEEEwECACsCGyMGCwkIBwMCBhUI AgkKCwQWAgMBAh4BAheAAhkBBQJafNQ7BQkNMVdkAAoJEGINZVEXwuQ+5LoIAKyZQDkNqj+Y E26o1bdEQlmOLhhXev45euNCnaFrnbOyKLivHdF4vvXyWBTzJmCsoRxTJ0A3Zmwa3ZihbKaU FCAdRgspLfA+TGICVYOztB+faWV18k5OTCk7ZiBQ/mOMQA4p3RPOV+UCgdelvZRHrFdUgHro dho/FqZhRoPdsPPB08QBisDO7SfFMMe9U9EZ03n4f2TvMgaTjK/kZCopwgLj2nB11SnCYfWJ jxUFDs+VFObf/jSK8T0SX9O6p430NWZm30vutUVac9lfodMjBcJqTnFxmZrwQomlCYGvSqNw 4Xy5+/gBzv/flXHngQSU053smHRtrMlGK5OU1RSixDfOwE0EUQ3j1wEIAMDcexhcaIO5jpl+ SHM14zuBvF2QG61IpH4Lag6nQmSMTljizuJg2kLaLbfc69AxmjuL5obqYi5ywXn4kQKqiwfa OHvVlKn662/J5YgXuc8tRLyqvgb+hibtAnlhWAuusP0eoQQP6SAASRjtrb8RVapTzJXy2Snf PtkcdtkTLLLcyeGoDOkpPkspnnp8avvI9ayzhGFLg9qNWaIuBMudxT6oHK4rZH+Sv6km9viI /ziV6E8Z+PpvMsGdebeYBLQA7ueuTbyOGbDyProwvocrKynI/UM40VYS8bS1PjWtljUlj7Vx 8C/746hnfdge0m24jnaWfu5UDjwpsHzs/JXqklsAEQEAAcLAZQQYAQIADwIbDAUCWnzURgUJ DTFXbwAKCRBiDWVRF8LkPsCjCACNvnnmpcDwEbtXUFZD/+ewNlPfM9o0mIXgi7DIVR9MVCw/ u14+mJUlQny4jPRV+hv/erjbiqEcVPZ296J3I4kUvO4slI+ZyODsRQSzwMz6ihwC6nN1xove YSBzVKKQrV+FDHVk6dJVLtgPdewOR9ZAar7mEbCLTJZ/e5aVb+NrlC1jWx3V3mMGCKOsEHhu 97cu3AswlxhzqPjczTo3rjtcfxdjeGU6mIEEAlhUlVDdfbGLODIyCXrP39zYxYXFFpVcbGAu +cndl1AQkIXUiMoJuzTMU8TQ+zz8yLof9fB7Y8O8VbmZBPQqN2IiHPeGbfqZjk/uHjJQUayI +beL0kxL
- Delivered-to: archiver@xxxxxxxx
- Delivery-date: Sun, 12 May 2019 04:46:41 -0400
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/simple; d=riseup.net; s=squak; t=1557639067; bh=e7dShGC7WUss1YZIU0+yeOOrnTidyoeeu/lfoh7H1JI=; h=From:Subject:To:References:Date:In-Reply-To:From; b=aZZTfXbcJbpu9h/1Hs5iu5PzQq9KJtRgjCEunrbRTrOIk1GC4qtTwXjYroZE/0psB D6a6i5IlUVBa5vyKiMBgINjYzDZEy0Vl5xG0/tqi1UJ/l/x29U5QCuU6v8qjz5tnal lk4Ku8r/t5AO6tmqDO+d+EMgYTiFwGlh4XanqGLc=
- In-reply-to: <ade5a7a5d76d691ebee6474ed0e43d97.squirrel@danielas3rtn54uwmofdo3x2bsdifr47huasnmbgqzfrec5ubupvtpid.onion>
- List-archive: <http://lists.torproject.org/pipermail/tor-talk/>
- List-help: <mailto:tor-talk-request@lists.torproject.org?subject=help>
- List-id: "all discussion about theory, design, and development of Onion Routing" <tor-talk.lists.torproject.org>
- List-post: <mailto:tor-talk@lists.torproject.org>
- List-subscribe: <https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-talk>, <mailto:tor-talk-request@lists.torproject.org?subject=subscribe>
- List-unsubscribe: <https://lists.torproject.org/cgi-bin/mailman/options/tor-talk>, <mailto:tor-talk-request@lists.torproject.org?subject=unsubscribe>
- Openpgp: preference=signencrypt
- References: <b02e48ce5ccaabd2b6b7b72fe6d2c714.squirrel@danielas3rtn54uwmofdo3x2bsdifr47huasnmbgqzfrec5ubupvtpid.onion> <f3bbe4df-b2f5-23d7-428a-cba764869c9c@torproject.org> <ade5a7a5d76d691ebee6474ed0e43d97.squirrel@danielas3rtn54uwmofdo3x2bsdifr47huasnmbgqzfrec5ubupvtpid.onion>
- Reply-to: tor-talk@xxxxxxxxxxxxxxxxxxxx
- Sender: "tor-talk" <tor-talk-bounces@xxxxxxxxxxxxxxxxxxxx>
On 05/11/2019 02:33 PM, jiggytwiggy@xxxxxxxxxxxxx wrote:
>
>>
>> Have you read Configuring Onion Services for Tor [1]?
>>
>>
>> [1] https://2019.www.torproject.org/docs/tor-onion-service.html.en
>>
>>
>>
>> Cheers,
>> ~Vasilis
>
>
> I had seen this before but it assumes one runs the onion on one's own
> machine. My computer is not on 24/7. Isn't there an up-to-date guide for
> running hidden services on a VPS?
It's not fundamentally that different. And what's different is more
about VPS security than about Tor. I'm not up for writing a complete
guide right now. But I'll share some points, which you can fill in
through searching. They apply to Debian x64.
First, if you want your onion service to be ~anonymous, you must not
provide any real contact information, and you must do everything via
Tor. That basically means paying with well-mixed Bitcoin. To avoid leaks
locally, it's prudent to work in Whonix. You'll need to login to your
VPS via Tor, and that's safer using Whonix than just torsocks.
It's best to use VPS providers that don't require contact information.
CockBox is a good one, not too expensive, and quite Tor friendly.
BitHost (a DO reseller) is OK, but too expensive, and isn't so Tor
friendly.
I've also had good service from a few VPS providers that do require
contact information, but don't verify. Such as VPS.BG and HostSailor.
Second, once you have your VPS, you SSH to it via Tor. Before doing
anything else, change the root password, and create a user account. Then
configure SSH for key-based login as user. Because if someone steals
your private key, and logs in, at least they won't have root privileges.
There are many guides for that, so I won't make another here. I do note
that "ssh-keygen" by default creates 2048-bit RSA keys, and that many
swear by longer keys, and other algorithms (such as AES). Also, set
"PasswordAuthentication no" in "/etc/ssh/sshd_config". And if you decide
to SSH login as root, also set "PermitRootLogin prohibit-password". Then
restart SSH ('systemctl restart ssh") and test with another SSH login
before disconnecting the existing one.
Now install the latest Tor release, and upgrade the system. See
https://2019.www.torproject.org/docs/debian.html.en, and also install
"iptables-persistent". Then "apt-get -y dist-upgrade", and reboot.
Then setup Tor. The Tor Project guide for onion services is a little
confusing, because it covers Windows, MacOS and Linux. So also see
https://github.com/torproject/tor/blob/master/src/config/torrc.sample.in
for a sample torrc. In Linux, "@LOCALSTATEDIR@" is typically "/var".
By default, Tor now creates v3 onion services. If you want a v2 onion
service, you must specify that, as the guide shows (Step Four).
Now setup iptables, in iptables-persistent, to make sure that your onion
service doesn't leak in clearnet. Do "ip a" to get your interface name,
and use that instead of "eth0" in the rules below. Do "id -u debian-tor"
to get Tor's UID, and use that instead of "107" in the rules below.
Unless you have good reason not to, block all IPv6 traffic. For IPv4,
allow only SSH in, and only Tor. Plus related established connections.
# nano /etc/iptables/rules.v6
| *filter
|
| :INPUT DROP [0:0]
| :FORWARD DROP [0:0]
| :OUTPUT DROP [0:0]
|
| COMMIT
# ip6tables-restore < /etc/iptables/rules.v6
# nano /etc/iptables/test-rules.v4
| *filter
|
| :INPUT DROP [0:0]
| :FORWARD DROP [0:0]
| :OUTPUT DROP [0:0]
|
| -A INPUT -i lo -s 127.0.0.1/32 -d 127.0.0.1/32 -j ACCEPT
| -A INPUT -s 127.0.0.1/32 -d 127.0.0.1/32 -j ACCEPT
| -A INPUT -m conntrack --ctstate INVALID -j DROP
| -A INPUT -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT
| -A INPUT -i eth0 -p tcp -m tcp --dport 22 -j ACCEPT
| -A INPUT -j DROP
|
| -A FORWARD -j DROP
|
| -A OUTPUT -o lo -s 127.0.0.1/32 -d 127.0.0.1/32 -j ACCEPT
| -A OUTPUT -s 127.0.0.1/32 -d 127.0.0.1/32 -j ACCEPT
| -A OUTPUT -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT
| -A OUTPUT -o eth0 -m owner --uid-owner 107 -j ACCEPT
| -A OUTPUT -j DROP
|
| COMMIT
# iptables-restore < /etc/iptables/test-rules.v4
Now verify that you can still SSH in, from a new local terminal. If you
can, rename /etc/iptables/test-rules.v4 as /etc/iptables/rules.v4
# mv /etc/iptables/rules.v4 /etc/iptables/open-rules.v4
# mv /etc/iptables/test-rules.v4 /etc/iptables/rules.v4
You could also create an SSH onion service, and login using that,
instead of Tor exit to clearnet SSH port. That increases login
anonymity. But blocking clearnet SSH entirely in iptables is risky.
Because if something goes wrong with Tor setup in the VPS, you'll be
unable to login. And so you'll need to redo the VPS from scratch.
Anyway, then install nginx (not apache) and change the listen address
from 0.0.0.0 to 127.0.0.1
# nano /etc/nginx/sites-enabled/default
| ...
|
| # Default server configuration
| #
| server {
| listen 127.0.0.1:80 default_server;
| ...
That should about do it. In creating your site, don't use any
third-party resources, and keep it simple. Static sites are most secure,
and load much faster. Scripts and databases provide more features, but
are risky unless you know what you're doing.
--
tor-talk mailing list - tor-talk@xxxxxxxxxxxxxxxxxxxx
To unsubscribe or change other settings go to
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-talk