Commit Graph

11 Commits

Author SHA1 Message Date
Sergey Ponomarev
94de72970e tor-hs: put torrc_generated into in-memory folder /var/run/
On each tor-hs service restart it generates a config file /etc/tor/torrc_generated.
The /etc/ is stored on a disk and kills it and slow.

Instead create a dedicated tor service Runtime Dir in the temp /var/run/.
It will be accessible only to the tor user.

Signed-off-by: Sergey Ponomarev <stokito@gmail.com>
2025-05-20 13:20:46 +02:00
Sergey Ponomarev
2f505ed7d8 tor-hs: create hs folder only if not exists
Previously the chown/chmod was performed each time even if the folder already existed.

Signed-off-by: Sergey Ponomarev <stokito@gmail.com>
2025-05-20 13:20:46 +02:00
Sergey Ponomarev
07f37d9dcc tor-hs: add validation
Signed-off-by: Sergey Ponomarev <stokito@gmail.com>
2025-05-20 13:20:46 +02:00
Sergey Ponomarev
4f3c7711af tor-hs: Use config_get_bool for enable_hs
Signed-off-by: Sergey Ponomarev <stokito@gmail.com>
2025-05-20 13:20:46 +02:00
Sergey Ponomarev
a97989f0c2 tor-hs: reformat and cleanup
Remove unused description.
Quote variables.
Use hostname_file variable.
Remove unnecessary quotes around "common".
Use echo -n to truncate a TORRC_FILE.

Signed-off-by: Sergey Ponomarev <stokito@gmail.com>
2025-05-20 13:20:46 +02:00
Sergey Ponomarev
783b92d5b3 tor-hs: cleanup tor-hs.conf
Replace boolean "true"/"false" with more frequently used 1/0.
This may avoid configuration mistakes which is critical for Tor.
The Luci app anyway will set it as 1/0.

Make sections named. This is not required but again safes from mistakes when executing uci command.

Uncomment sections but disable them by default.
Then in a Luci app a user can quickly figure out what to change.
Ideally a user may just enable the config and start using it.

In the nextcloud config use a single 80 instead of 80;80.
This simpler configuration is now supported.

Instead of "Hidden service" the Tor team now uses "Onion service".

Signed-off-by: Sergey Ponomarev <stokito@gmail.com>
2025-05-20 13:20:46 +02:00
Sergey Ponomarev
eee8f9e1e7 tor-hs: tor-hs.init skip onion service when Name empty
The Name is used as a HS folder name and can't be empty.

Signed-off-by: Sergey Ponomarev <stokito@gmail.com>
2025-05-20 13:20:46 +02:00
Sergey Ponomarev
1f591bcc1c tor-hs: tor-hs.init remove unused clean_hs()
Signed-off-by: Sergey Ponomarev <stokito@gmail.com>
2025-05-20 13:20:46 +02:00
Sergey Ponomarev
c709e7a09f tor-hs: tor-hs.init handle_hs_ports_conf split ports
Using substring instead of awk.
It changes behaviour when only one port is specified.
Previously:
value="80" => public="80" local=""
Now:
value="80" => public="80" local="80"

It simplifies configuration of one-to-one ports.

Signed-off-by: Sergey Ponomarev <stokito@gmail.com>
2025-05-20 13:20:46 +02:00
Sergey Ponomarev
910041d39f tor-hs: tor-hs.init handle_hs_ports_conf: remove unused name var
Signed-off-by: Sergey Ponomarev <stokito@gmail.com>
2025-05-20 13:20:46 +02:00
Jan Pavlinec
5906bfecd5 tor-hs: add new package
Signed-off-by: Jan Pavlinec <jan.pavlinec@nic.cz>
2020-04-17 13:57:00 +02:00