1

Background

I am working on a project that involves 2 servers. Server A is a VPS running Ubuntu 14.04 with a public IP address. Server B is running a MJPG service on port 8080 and does not have a public IP address. I have created a reverse ssh tunnel between the two servers by running the following command on server B:

ssh <user>@serverA -N -R 8099:localhost:8080

Server A has apache running which serves a site with the following config (the default apache vhost)

<VirtualHost *:80>
    # The ServerName directive sets the request scheme, hostname and port that
    # the server uses to identify itself. This is used when creating
    # redirection URLs. In the context of virtual hosts, the ServerName
    # specifies what hostname must appear in the request's Host: header to
    # match this virtual host. For the default virtual host (this file) this
    # value is not decisive as it is used as a last resort host regardless.
    # However, you must set it for any further virtual host explicitly.
    #ServerName www.example.com

    ServerAdmin webmaster@localhost
    DocumentRoot /var/www/html

    # Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
    # error, crit, alert, emerg.
    # It is also possible to configure the loglevel for particular
    # modules, e.g.
    #LogLevel info ssl:warn

    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined

    # For most configuration files from conf-available/, which are
    # enabled or disabled at a global level, it is possible to
    # include a line for only one particular virtual host. For example the
    # following line enables the CGI configuration for this host only
    # after it has been globally disabled with "a2disconf".
    #Include conf-available/serve-cgi-bin.conf
</VirtualHost>

I have modified the file found at /var/www/html/index.html as follows:

<img width=640 height=480 src="http://localhost:8099/?action=stream"/>

The Problem

The above configuration is not working for me. The stream fails to load. I am able to execute the following command on server A and get a constant stream of data:

curl localhost:8099/?action=stream

But for some reason, apache will not serve the image.

If I edit /etc/ssh/sshd_conf and add the line GatewayPorts yes, I can get the stream to work by tweaking my image source to be http://<server_A_public_ip>:8099/?action=stream however, this exposes the stream to the public.

I have also tried changing the User and Group directives in /etc/apache2/apache2.conf to match <user> in the above ssh command so that apache is started as that user. But still no go.

I would like to be able to enable an ssh tunnel between serverA:8099 <=> serverB:8080, but have port 8099 only be accessible by server A itself. Nobody should be able to publicly access the stream via the url http://<server_A_public_ip>:8099

Is there anything obvious that I am missing out on here? Does anybody have any other ideas that could help me figure out what my problem is?

0

You must log in to answer this question.

Browse other questions tagged .