How can I have multiple tor onions pointing to the same listening port - tor

So I am running a program which runs on a certain port.
I have a .onion domain pointing to that port the program is listening on.
I'm wanting to generate more .onion domains through tor but point them all to the same listening port my program is running on so I can enter any of the .onion domains and it will run my program like normal.
Is this possible?
I've seen that you can add multiple .onion domains but they seem to be pointing to different ports.
I just need multiple .onion domains pointing to the same port.

It is possible to create multiple onion services that point to the same port/application. To do this, create multiple HiddenService configurations with different data directories pointing to the same port:
torrc
# Hidden service instance 1
HiddenServiceDir /var/lib/tor/hs-1/
HiddenServiceVersion 3
HiddenServicePort 80 127.0.0.1:8080
# Hidden service instance 2
HiddenServiceDir /var/lib/tor/hs-2/
HiddenServiceVersion 3
HiddenServicePort 80 127.0.0.1:8080
For each HiddenServiceDir/HiddenServicePort combination you create that points to the same port, you will get a different onion address which ultimately point to the same service.

Related

NodeJS host two application on Single server using two IP addresses and same port 443

I have two different nodejs + expressjs applications with different SSL certificates. I got another IP address for my second app. I have only one port enabled i.e 443. When I run first application it runs successfully, but when I try to run second one it trows port already in use error.
Please note I am running both application on different IP addresses.
This has nothing to do with the number of interfaces/IP addresses you use. A port on a machine can only be used once. In this case, your first application already listens exclusively to it.
The best way is to use a web server or reverse proxy (e.g. HAProxy, nginx, Apache) listening on all interfaces to handle incoming requests on port 443 and forward the traffic to your applications based on the IP address – or even better (sub)domain name – of the request. Then you can run both applications on a separate port > 1024 that doesn't require root rights to bind (which is also a security issue):
Example:
Request to IP 10.1.10.1 → +---------------------+ → Forwarded to app 1:80441
| Reverse Proxy:443 |
Request to IP 10.1.10.2 → +---------------------+ → Forwarded to app 2:80442

Docker: Multiple container on port 80 without NGinx

I want to run multiple web server on the same VM. Each web server is dockerized.
Is it possible to run multiple dockerized web servers on port 80, with different domains, using docker functionalities?
I found many solution based on NGinx proxy like here , but I don't find any user defined network usage that solves this problem.
Is there any solution to this problem without running a reverse proxy?
No.
There is only one "real" port 80 on the host server (for each network address), so you need something that listens there and forwards to the different backend servers.
This is not a docker-specific problem. You cannot run multiple (non-Docker) web servers (one for each domain) on a single port either.
That something does not have to be nginx.
As far as I am aware, no it can not work to have multiple containers listening on port 80 or the same port in general.
You could open up different ports on your VM and have the applications listening to each one of those ports specifically.
For instance you could have your first application listen to port 80. Then your second one on port 81, etc.
First of all it is possible to run multiple domains on the same port, but the requirement is that:
you host sites on the same web server (Apache HTTPD or Nginx)
you are using virtual hosts
The one server can be containerized, if needed.
Here is the example of running two domains on exactly one Nginx web server.
So depending on your requirements, that can be solution.

Glassfih and Apache configuration with two NIC cards

I've an Ubuntu 16.04 server with two NIC cards. Both of them are configured with static IP and set to different hosts.
At this time, I've running Apache and glassfish through the same interface (only one of the cards), Apache listen on the port 80 and glassfish the 8080 (classic configuration).
Now I want to enable the second NIC in order to allow glassfish to listen the port 80. This way I'll have Apache listening port 80 of the first NIC and Glassfish the port 80 with the other card and different domain. However I can't accomplish that.
By the moment I've tried the following configurations but neither of them works:
Creating a new http-listener with port 80 and with address equal to the second nic IP address.
Creating a virtual server, set the host to the second nic IP address, and then the http-listener with port 80.
Create a new domain with --keytooloption CN=my.domain.name and with that domain make the two things upon (while creating this domain --instanceport 80 is not permitted, a message said that 80 port is in use, but from my point of view, port 80 is in use but by different interface...?).
Some different domain.xml adjustments like ports, hosts, etc.
I've been reading Glassfish documentation the last two or three days and didn't find the answer yet.
Both nic cards are on the same net, for example:
111.222.333.1 and the other 111.222.333.2
I didn't try with different sub nets maybe changing the second NIC IP to 111.222.444.2, however I don't have the necessary privileges to make those changes and before ask to the IT people on the company, and change other configurations, I'll like to know if someone of you have ever been on a similar scenario? does anyone have any idea? suggestions?
After several attempts I get with the right configuration.
Step 1
As the server have Apache and Glassfish servers, by default, apache configuration listen port 80 for all IPs, so is the first thing to change:
--/etc/apache2/ports.conf
change line "Listen 80" by "Listen ###.###.###.###:80" having ###... as the apache desired ip address
Then restart apache
/etc/init.d/apache2 restart
Step 2
Create http-listener for Glassfish on the port 80 for the second IP:
sudo ./asadmin create-http-listener --listeneraddress ###.###.###.### --listenerport 80 --acceptorthreads 16 --securityenabled=false --default-virtual-server server myListenerName
Step 3
If you already have Glassfish installed (like my case) it was already listening to the previous IP (apache one) but in 8080 port, in order to listen to the new IP, a new virtual server needs to be created:
./asadmin create-virtual-server --hosts my.domain.name --networklisteners myListenerName myservername
Step 4
At the time of http-listener "myListenerName" creation, it needed to be linked to a server, so the only available at that time was the default one: "server". So then manually update domain.xml in order to delete myListenerName from the network-listeners of server and add it to the virtual-server "myservername". At the end it looks like the above:
<virtual-server network-listeners="http-listener-1,http-listener-2" id="server"></virtual-server>
<virtual-server network-listeners="myListenerName" hosts="my.domain.nama" id="myservername"></virtual-server>
Step 5
Re start glassfish
./asadmin stop-domain domain1
./asadmin start-domain domain1
Step 6
Deploy any application to the new server
./asadmin deploy --virtualservers myservername /path/to/my.war
Step 7
Relax
I hope this info helps somebody!
If I may, I wrote a blog post on this at:
https://rsoftwareblog.wordpress.com/2014/11/12/glassfish-server-multi-nic-conundrum/
Hope this helps

Nodejs and Wordpress both port 80 virtualhost configuration on Mac

I am currently running my node.js web app on port 80 on my Mac with domain www.aaa.com,
But now I want to add a Wordpress(Apache) on 80 on this Mac machine too with domain www.bbb.com,
how do I configure the virtualhost? I tried many researches on the internet, but no luck , can anyone tell me how? Thanks!
If you can have multiple public IP addresses, you just need to:
map each of the domains to a different IP address
have node.js and Apache listen on one of the IP addresses each
If not (you only have a single IP address), you'll need to have one of the two servers take port 80 and forward/proxy the data to the other (listening on a separate port) for its requests. Or, alternatively, use a reverse proxy (such as pound) to do this job (you then have the reverse proxy on port 80, and both node.js and Apache on other ports).

How can I set a specific application to use a different port in IIS7?

I want to use a port other that port 80 for a specific application. (It's the speedtest.net mini app: http://www.speedtest.net/mini.php).
I want to use a port other that 80 for it, as we have a WAN optimisation tool on the network. As such, in order to get a "true" test (without the traffic having been cached or compressed) I need to add an exclusion rule in the WAN optimisation too for every host I want to run the test on. (If I stop optimising http traffic for all hosts it would defeat the point of the WAN optimisation tool!)
It would be much easier if I could run the test from some arbitrary port as I could then do a rule for all hosts on this port.
I can see how to edit the bindings for the Default Web Site, but not for a single application. (Or if I set another port up would this ripple to all applications, but wouldn't matter as they'd still be accessible on Port 80, too.)
End result is that I want to get to all my sites on port 80 except one:
http://myserver/speedtest:8765 (or some other port)
You have to go in Control Panel -> Windows Firewall -> Advace Settings -> and then Connecting Rules ( or something like that).
And it will load a list of all your program where you can change port and everything.

Resources