Link to home
Start Free TrialLog in
Avatar of Paer Toernell
Paer ToernellFlag for Thailand

asked on

HTTPS access trough a SSH tunne. How?

Trying to set up https access trough a SSH tunnel. I have a Web-server i want to protect access to a web server.

So what i have:

(1) a AWS Ubuntuserver with only port 22 open in firewall.
(2) Putty setup with tunnel L444 127.0.0.1:443
(3) Enter into Chrome https://sub.domain.com:444

But i get a timeout error, but https://sub.domain.com:443 does work...
Avatar of Steve
Steve
Flag of United Kingdom of Great Britain and Northern Ireland image

May be worth exploring what you're trying to achieve as you're asking for something very specific here, but you may have missed a few steps.

Take a look at this guide:
https://www.digitalocean.com/community/tutorials/how-to-route-web-traffic-securely-without-a-vpn-using-a-socks-tunnel

Take a specific look at the first step of configuring the tunnel on the web server
and also the 3rd step where you configure your browser to direct traffic down the tunnel.
Tip: If you have a Webserver running on your AWS instance, the easy way to handle this is to open port 80 + port 443 on your AWS instance.

The simple ways you protect access to your server include...

1) Use a CMS like WordPress + make all content protected. The requires a login to access content.

2) Use iptables to deny all access, then whitelist your single IP.

3) Use a hashed directory for access. So for example, if you have many assets to download (audios, videos, pdfs, data), then place them in a directory like...

http://yoursite.com/private-aPj2zMRsEajLZt40 then ensure no public links ever reference your /private-aPj2zMRsEajLZt40 so this directory is never seen by any Index Bot.

Summary: There are many ways to accomplish what you're asking besides setting up an ssh tunnel, which is the most difficult to setup + maintain.

You can take the socks approach Steve provides above.

You can also use https://help.ubuntu.com/community/SSH/OpenSSH/PortForwarding which seems more like what you're asking.

Or far easier, use one of my 3x suggestions above.

Consideration: Might be good for you to open a new question describing what assets you're trying to protect on your Website, then ask for assistance designing an access pattern/mechanism for you to achieve your end goal.
Avatar of Paer Toernell

ASKER

Problem was me. Didn't understand what i already know. That i must use my own local IP as adress in chrome....
This question needs an answer!
Become an EE member today
7 DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform.
View membership options
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.