0

I'm trying to access a webpage hosted on a device from an AWS public URL. The catch is this device's IP is not public. I am able to issue a command to the device locally (ssh -i path/to/Cert -R 19999:localhost:80 ubuntu@my.amazonaws.com) to reverse SSH from the device to AWS. From there I can curl/reach the page in AWS via 127.0.0.1:19999. Now I'm trying to figure out how can I make a http request to AWS and forward to the already forwarded device. I've tried setting some IP Forwarding rules like:

iptables -t nat -I PREROUTING --dst 127.0.0.1 ip tcp --dport 80 -j REDIRECT --to-ports 19999

I'v also tried running lighttpd to reverse proxy with:

$HTTP["url"] =~ "^/admin" {
  $HTTP["host"] =~ ".*" {
    url.redirect = ( "^/(.*)" => "127.0.0.1:19999" )
    url.redirect-code = 302
  }
}

However, neither seem to work. I'm not sure if there is something else I need in my SSH .conf to allow the forwarding further or what else I can/should do to get this working. Thanks.

Nimjox
  • 111

1 Answers1

0

Added GatewayPorts yes to /etc/ssh/sshd_config and can now access it over http.

Admin can close as duplicate sorry.

Forwarding Specific Ports through SSH Reverse Tunnels

Nimjox
  • 111