nyxnor / onionjuggler

Manage your Onion Services via CLI or TUI on Unix-like operating system with a POSIX compliant shell.
MIT License
36 stars 2 forks source link

[QUESTION] Which use case needs two (or more) virtual ports on the same onion address? #61

Closed radio24 closed 2 years ago

radio24 commented 2 years ago

My doubt is / How can I:

Which use case needs two (or more) virtual ports on the same onion address and how was this practically implemented?

The question is relevant because not supporting two or more virtual ports would simplify programming.

nyxnor commented 2 years ago

Some server software use different ports for different purposes. Example is XMPP https://github.com/nyxnor/onioncomms/blob/main/xmpp/prosody/setup.sh#L48-L52 but others like Mumble VOIP only uses one port https://github.com/nyxnor/onioncomms/blob/2771800f97fa08cfe85384f0a007de93c6538234/voip/setup.sh#L32

A website will probably only use one port, the 80 https://github.com/nyxnor/onioncomms/blob/f5820b69ce483095d31c7e231ede868271b29585/tor/README.md#onion-service-example

nyxnor commented 2 years ago

How is it pratically implemented?

The server allows some specific ports https://github.com/nyxnor/onioncomms/blob/19ee1256f6c6efc18f8e7a0051e1d7c76c5d723f/xmpp/prosody/virtualhost.cfg.lua#L24-L27

The XMPP clients expect http to be on port 5280 and https to be on port 5281, as well as bosh to be on another port.

The client knows the protocol and it uses the same domain but with a different port, user doesnt need to manually edit the ports on their client, only if it is non default one not specified by the protocol.

Lets take for example an http website, http protocol specifies port 80. HTTP servers (nginx) start listening on port 80. HTTP clients (browser) send GET to port 80.

For solely websites, I don't see reasons to use different ports, I think I would stick with port 80 and then if some change is needed, use a differt subfolder or subdomain.