So this weekend i have been working on migrating my apache2
server to a docker
container which i have no issues with.
I currently have a windows server with SSTP
and Exchange 2016 both using port 443
for traffic.
The idea is to have incoming 443
traffic to be forwarded to my ubuntu server and apache will decide based on the aliases i gave the virtual hosts, where the user will be redirected to. This i have working BUT what if a user is trying to connect to the VPN that also uses port 443? How would i be able to redirect that traffic to my server?
What i had thought was to create a rule for IPTABLES
to have the destination be vpn.domain.com
and forward it to the server but since all subdomains/CNames are just aliases leading to the same host (my external IP), therefore all requests on port 443
will just be sent to the windows server bypassing my webhost which is not what i want.
What i also actually tried was to use apache to forward any incoming connections on 443
via ServerAlias vpn.domain.com
to the windows server since its on 443
but that did not work.
Im not sure how i can go about this and im thinking i would just need to create a new VPN service on my ubuntu server afterall. If there is any way i can achieve what i need, that would save me the hassle.
Thanks
Try with
SSLH
Install SSLH
SSLH
is packaged for most Linux distributions, so you can install it using the default package managers.Configure Apache
As you already know, Apache will listen on all network interfaces (i.e 0.0.0.0:443) by default. We need to change this setting to tell the webserver to listen on the localhost interface only (i.e 127.0.0.1:443 or localhost:443).
To do so, edit the webserver (nginx or apache) configuration file and find the following line:
And, change it to:
If you’re using Virutalhosts in Apache, make sure you have changed that it too.
Save and close the config files. Do not restart the services.
Configure SSLH
Once you have made the webservers to listen on local interface only, edit SSLH config file:
Find the following line:
And, change it to:
Then, scroll a little bit down and modify the following line to allow SSLH to listen on port 443 on all available interfaces (Eg. 0.0.0.0:443).
Where,
Save and close the file.
Finally, enable and start
sslh
service to update the changes.Change ip, port and protocols to accomplish your needs.