2020-11-11 11:47:10 +01:00
---
title: Using YunoHost as a Tor Hidden Service
template: docs
taxonomy:
category: docs
2021-02-06 18:03:27 +01:00
routes:
default: '/torhiddenservice'
2020-11-11 11:47:10 +01:00
---
2024-03-01 23:14:44 +01:00
! This tuto is not finished ! Some data could leak with this setup like the main domain of your yunohost, so it's not a "Hidden Service". See https://www.torproject.org/docs/tor-hidden-service.html.en
2014-05-13 10:59:34 +02:00
2024-03-01 23:14:44 +01:00
### Installing Tor
2014-05-13 10:59:34 +02:00
```bash
2018-06-13 00:04:58 +02:00
apt install tor
2014-05-13 10:59:34 +02:00
```
2024-03-01 23:14:44 +01:00
### Configuring our hidden service
2016-01-07 17:36:02 +01:00
Edit `/etc/tor/torrc` , and add these lines:
2014-05-13 10:59:34 +02:00
2014-05-13 11:07:24 +02:00
```bash
2014-05-13 10:59:34 +02:00
HiddenServiceDir /var/lib/tor/hidden_service/
HiddenServicePort 80 127.0.0.1:80
HiddenServicePort 443 127.0.0.1:443
```
2024-03-01 23:14:44 +01:00
### Restart Tor
2014-05-13 10:59:34 +02:00
```bash
service tor restart
```
2016-01-07 17:36:02 +01:00
### Get your Tor Hidden Service hostname
2014-05-13 10:59:34 +02:00
```bash
2015-04-26 19:55:22 +02:00
cat /var/lib/tor/hidden_service/hostname
2014-05-13 10:59:34 +02:00
```
Your domain looks like *random123456789.onion*
2016-01-07 17:36:02 +01:00
### Add the .onion domain to YunoHost
2014-05-13 10:59:34 +02:00
```bash
yunohost domain add random123456789.onion
```
2014-05-13 11:07:24 +02:00
2016-01-07 17:36:02 +01:00
### Avoid SSO redirection (optional)
2014-05-13 17:25:11 +02:00
If you want to avoid being redirected to the SSO portal at login, you can deactivate SSOwat for this specific tor domain, by editing the file `/etc/nginx/conf.d/random123456789.onion.conf` and commenting the following line (two times):
2014-05-13 11:22:11 +02:00
```bash
#access_by_lua_file /usr/share/ssowat/access.lua;
```
2016-01-07 16:34:28 +01:00
2020-09-15 13:57:31 +02:00
### Restart NGINX
2016-01-07 16:34:28 +01:00
```bash
service nginx restart
2018-06-13 00:04:58 +02:00
```