Skip to content

Commit 7785147

Browse files
add steps about sig_helper and potoken + depreciate gluetun guide (#581)
* add steps about sig_helper and potoken + depreciate gluetun guide * reorder token position Co-authored-by: TheFrenchGhosty <[email protected]> * add note about token validity for same ip range --------- Co-authored-by: TheFrenchGhosty <[email protected]>
1 parent 2d80d7b commit 7785147

File tree

3 files changed

+165
-65
lines changed

3 files changed

+165
-65
lines changed

docs/index.md

-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
- [NGINX reverse proxy setup](./nginx.md)
2323
- [Caddy reverse proxy setup](./caddy.md)
2424
- [Apache2 reverse proxy setup](./apache2.md)
25-
- [Make Invidious requests data from YouTube through a VPN using Gluetun (in case your IP is blocked)](./gluetun.md)
2625
- [Database maintenance](./db-maintenance.md)
2726
- [CAPTCHA bug on Debian and Ubuntu](./captcha-bug.md)
2827
- [Registering users manually](./register-user.md)

docs/installation.md

+165-63
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ Running Invidious requires at least 20GB disk space, 512MB of free RAM (so ~2G i
1212
Compiling Invidious requires at least 2.5GB of free RAM (We recommend to have at least 4GB installed).
1313
If you have less (e.g on a cheap VPS) you can setup a SWAP file or partition, so the combined amount is >= 4GB.
1414

15+
You need at least 1GB of RAM for the machine that will run the tool `youtube-trusted-session-generator` in the 1st step. Doesn't need to be the same machine as the one running Invidious, just a machine running on the same public IP address.
16+
1517
## Docker
1618

1719
**The Invidious docker image is only [available on Quay](https://quay.io/repository/invidious/invidious) because, unlike Docker Hub, [Quay is Free and Open Source Software](https://github.com/quay/quay/blob/master/LICENSE). This is reflected in the `docker-compose.yml` file used in this walk-through.**
@@ -24,71 +26,106 @@ Ensure [Docker Engine](https://docs.docker.com/engine/install) and [Docker Compo
2426

2527
Note: Currently the repository has to be cloned, this is because the `init-invidious-db.sh` file and the `config/sql` directory have to be mounted to the postgres container (See the volumes section in the docker-compose file below). This "problem" will be solved in the future.
2628

27-
```bash
28-
git clone https://github.com/iv-org/invidious.git
29-
cd invidious
30-
```
29+
??? warning "About po_token and visitor_data identities"
30+
31+
po_token known as Proof of Origin Token. This is an attestation token generated by a complex anti robot verification system created by Google named BotGuard/DroidGuard. It is used to confirm that the request is coming from a genuine device.
32+
33+
These identity tokens (po_token and visitor_data) generated in this tutorial will make your entire Invidious session more easily traceable by YouTube because it is tied to a unique identifier.
34+
35+
There is currently no official automatic tool to periodically change these tokens. This is working in progress but, for the time being, this is the solution the Invidious team is offering.
36+
37+
If you want to be less traceable, you can always script the process by changing the identities every X hour.
38+
39+
40+
1. Generate po_token and visitor_data identities for passing all verification checks on YouTube side:
41+
```
42+
docker run quay.io/invidious/youtube-trusted-session-generator
43+
```
44+
You have to run this command on the same public IP address as the one blocked by YouTube. Not necessarily the same machine, just the same public IP address.
45+
You will need to copy these two parameters in the third step.
46+
Subsequent usage of this same token will work on the same IP range or even the same ASN. The point is to generate this token on a blocked IP as "unblocked" IP addresses seems to not generate a token valid for passing the checks on a blocked IP.
47+
48+
3. Execute these commands:
49+
```bash
50+
git clone https://github.com/iv-org/invidious.git
51+
cd invidious
52+
```
53+
54+
4. Edit the docker-compose.yml with this content:
55+
56+
```docker
57+
version: "3"
58+
services:
59+
60+
invidious:
61+
image: quay.io/invidious/invidious:latest
62+
# image: quay.io/invidious/invidious:latest-arm64 # ARM64/AArch64 devices
63+
restart: unless-stopped
64+
ports:
65+
- "127.0.0.1:3000:3000"
66+
environment:
67+
# Please read the following file for a comprehensive list of all available
68+
# configuration options and their associated syntax:
69+
# https://github.com/iv-org/invidious/blob/master/config/config.example.yml
70+
INVIDIOUS_CONFIG: |
71+
db:
72+
dbname: invidious
73+
user: kemal
74+
password: kemal
75+
host: invidious-db
76+
port: 5432
77+
check_tables: true
78+
signature_server: inv_sig_helper:12999
79+
visitor_data: CHANGE_ME
80+
po_token: CHANGE_ME
81+
# external_port:
82+
# domain:
83+
# https_only: false
84+
# statistics_enabled: false
85+
hmac_key: "CHANGE_ME!!"
86+
healthcheck:
87+
test: wget -nv --tries=1 --spider http://127.0.0.1:3000/api/v1/trending || exit 1
88+
interval: 30s
89+
timeout: 5s
90+
retries: 2
91+
logging:
92+
options:
93+
max-size: "1G"
94+
max-file: "4"
95+
depends_on:
96+
- invidious-db
97+
98+
inv_sig_helper:
99+
image: quay.io/invidious/inv-sig-helper:latest
100+
command: ["--tcp", "0.0.0.0:12999"]
101+
environment:
102+
- RUST_LOG=info
103+
restart: unless-stopped
104+
cap_drop:
105+
- ALL
106+
read_only: true
107+
security_opt:
108+
- no-new-privileges:true
109+
110+
invidious-db:
111+
image: docker.io/library/postgres:14
112+
restart: unless-stopped
113+
volumes:
114+
- postgresdata:/var/lib/postgresql/data
115+
- ./config/sql:/config/sql
116+
- ./docker/init-invidious-db.sh:/docker-entrypoint-initdb.d/init-invidious-db.sh
117+
environment:
118+
POSTGRES_DB: invidious
119+
POSTGRES_USER: kemal
120+
POSTGRES_PASSWORD: kemal
121+
healthcheck:
122+
test: ["CMD-SHELL", "pg_isready -U $$POSTGRES_USER -d $$POSTGRES_DB"]
31123
32-
Edit the docker-compose.yml with this content:
33-
34-
```docker
35-
version: "3"
36-
services:
37-
38-
invidious:
39-
image: quay.io/invidious/invidious:latest
40-
# image: quay.io/invidious/invidious:latest-arm64 # ARM64/AArch64 devices
41-
restart: unless-stopped
42-
ports:
43-
- "127.0.0.1:3000:3000"
44-
environment:
45-
# Please read the following file for a comprehensive list of all available
46-
# configuration options and their associated syntax:
47-
# https://github.com/iv-org/invidious/blob/master/config/config.example.yml
48-
INVIDIOUS_CONFIG: |
49-
db:
50-
dbname: invidious
51-
user: kemal
52-
password: kemal
53-
host: invidious-db
54-
port: 5432
55-
check_tables: true
56-
# external_port:
57-
# domain:
58-
# https_only: false
59-
# statistics_enabled: false
60-
hmac_key: "CHANGE_ME!!"
61-
healthcheck:
62-
test: wget -nv --tries=1 --spider http://127.0.0.1:3000/api/v1/trending || exit 1
63-
interval: 30s
64-
timeout: 5s
65-
retries: 2
66-
logging:
67-
options:
68-
max-size: "1G"
69-
max-file: "4"
70-
depends_on:
71-
- invidious-db
72-
73-
invidious-db:
74-
image: docker.io/library/postgres:14
75-
restart: unless-stopped
76124
volumes:
77-
- postgresdata:/var/lib/postgresql/data
78-
- ./config/sql:/config/sql
79-
- ./docker/init-invidious-db.sh:/docker-entrypoint-initdb.d/init-invidious-db.sh
80-
environment:
81-
POSTGRES_DB: invidious
82-
POSTGRES_USER: kemal
83-
POSTGRES_PASSWORD: kemal
84-
healthcheck:
85-
test: ["CMD-SHELL", "pg_isready -U $$POSTGRES_USER -d $$POSTGRES_DB"]
86-
87-
volumes:
88-
postgresdata:
89-
```
125+
postgresdata:
126+
```
90127
91-
Note: This compose is made for a true "production" setup, where Invidious is behind a reverse proxy. If you prefer to directly access Invidious, replace `127.0.0.1:3000:3000` with `3000:3000` under the `ports:` section.
128+
Note: This compose is made for a true "production" setup, where Invidious is behind a reverse proxy. If you prefer to directly access Invidious, replace `127.0.0.1:3000:3000` with `3000:3000` under the `ports:` section.
92129
93130
94131
### Docker-compose method (development)
@@ -106,6 +143,35 @@ docker-compose up
106143

107144
### Linux
108145

146+
#### Generate po_token and visitor_data identities
147+
148+
[Follow these instructions here on the official tool `youtube-trusted-session-generator`](https://github.com/iv-org/youtube-trusted-session-generator?tab=readme-ov-file#tutorial-without-docker)
149+
150+
These two parameters will be required for passing all verification checks on YouTube side and you will have to configure them in Invidious.
151+
152+
You have to run this command on the same public IP address as the one blocked by YouTube. Not necessarily the same machine, just the same public IP address.
153+
You will need to copy these two parameters in the `config.yaml` file.
154+
Subsequent usage of this same token will work on the same IP range or even the same ASN. The point is to generate this token on a blocked IP as "unblocked" IP addresses seems to not generate a token valid for passing the checks on a blocked IP.
155+
156+
??? warning "About po_token and visitor_data identities"
157+
158+
po_token known as Proof of Origin Token. This is an attestation token generated by a complex anti robot verification system created by Google named BotGuard/DroidGuard. It is used to confirm that the request is coming from a genuine device.
159+
160+
These identity tokens (po_token and visitor_data) generated in this tutorial will make your entire Invidious session more easily traceable by YouTube because it is tied to a unique identifier.
161+
162+
There is currently no official automatic tool to periodically change these tokens. This is working in progress but, for the time being, this is the solution the Invidious team is offering.
163+
164+
If you want to be less traceable, you can always script the process by changing the identities every X hour.
165+
166+
167+
#### Run inv_sig_helper in background
168+
169+
[Follow these instructions here on the official tool `inv_sig_helper`](https://github.com/iv-org/inv_sig_helper?tab=readme-ov-file#building-and-running-without-docker) and run it in the background with systemd for example.
170+
171+
inv_sig_helper handle the "deciphering" of the video stream fetched from YouTube servers. As it is running untrusted code from Google themselves, make sure to isolate it by for example running it inside a LXC or locked down through systemd.
172+
173+
Call for action: A systemd service example is welcome, [if you want to contribute to one](https://github.com/iv-org/documentation/edit/master/docs/installation.md#linux).
174+
109175
#### Install Crystal
110176

111177
Follow the instructions for your distribution here: https://crystal-lang.org/install/
@@ -160,6 +226,10 @@ make
160226
# Configure config/config.yml as you like
161227
cp config/config.example.yml config/config.yml
162228

229+
# edit config.yaml to include po_token and visitor_data previously generated
230+
231+
edit config/config.yaml
232+
163233
# Deploy the database
164234
./invidious --migrate
165235

@@ -175,6 +245,34 @@ systemctl enable --now invidious.service
175245

176246
### MacOS
177247

248+
#### Generate po_token and visitor_data identities
249+
250+
[Follow these instructions here on the official tool `youtube-trusted-session-generator`](https://github.com/iv-org/youtube-trusted-session-generator?tab=readme-ov-file#tutorial-without-docker)
251+
252+
These two parameters will be required for passing all verification checks on YouTube side and you will have to configure them in Invidious.
253+
254+
You have to run this command on the same public IP address as the one blocked by YouTube. Not necessarily the same machine, just the same public IP address.
255+
You will need to copy these two parameters in the `config.yaml` file.
256+
Subsequent usage of this same token will work on the same IP range or even the same ASN. The point is to generate this token on a blocked IP as "unblocked" IP addresses seems to not generate a token valid for passing the checks on a blocked IP.
257+
258+
??? warning "About po_token and visitor_data identities"
259+
260+
po_token known as Proof of Origin Token. This is an attestation token generated by a complex anti robot verification system created by Google named BotGuard/DroidGuard. It is used to confirm that the request is coming from a genuine device.
261+
262+
These identity tokens (po_token and visitor_data) generated in this tutorial will make your entire Invidious session more easily traceable by YouTube because it is tied to a unique identifier.
263+
264+
There is currently no official automatic tool to periodically change these tokens. This is working in progress but, for the time being, this is the solution the Invidious team is offering.
265+
266+
If you want to be less traceable, you can always script the process by changing the identities every X hour.
267+
268+
#### Run inv_sig_helper in background
269+
270+
[Follow these instructions here on the official tool `inv_sig_helper`](https://github.com/iv-org/inv_sig_helper?tab=readme-ov-file#building-and-running-without-docker)
271+
272+
inv_sig_helper handle the "deciphering" of the video stream fetched from YouTube servers. As it is running untrusted code from Google themselves, make sure to isolate it by for example running it inside Docker or a VM.
273+
274+
Call for action: An example here is welcome, [if you want to contribute to one](https://github.com/iv-org/documentation/edit/master/docs/installation.md#macos).
275+
178276
#### Install the dependencies
179277

180278
```bash
@@ -213,7 +311,11 @@ psql invidious kemal < config/sql/playlist_videos.sql
213311
make
214312

215313
# Configure config/config.yml as you like
216-
cp config/config.example.yml config/config.yml
314+
cp config/config.example.yml config/config.yml
315+
316+
# edit config.yaml to include po_token and visitor_data previously generated
317+
318+
edit config/config.yaml
217319
```
218320

219321
### Windows

mkdocs.yml

-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ nav:
2727
- 'nginx.md'
2828
- 'caddy.md'
2929
- 'apache2.md'
30-
- 'gluetun.md'
3130
- 'db-maintenance.md'
3231
- 'captcha-bug.md'
3332
- 'register-user.md'

0 commit comments

Comments
 (0)