View previous topic :: View next topic |
Author |
Message |
stenny Tux's lil' helper
![Tux's lil' helper Tux's lil' helper](/images/ranks/rank_rect_1.gif)
![](images/avatars/gallery/The Fifth Element/movie_the_fifth_element_playa.gif)
Joined: 06 Feb 2003 Posts: 100 Location: Germany
|
Posted: Mon Nov 07, 2005 11:10 pm Post subject: Console Application in Web Browser Window - HowTo? |
|
|
I want to connect to my private Web server (Apache2) from the internet and then start a predefined console application by a specific link (or URL typed in the browser's address box). In my case I want to start telnet to connect to a small computer running embedded Linux. ( http://www.axis.com - DevBoardLX)
Is there any information available on the net, describing how to achieve this goal?
stefan |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
drwook Veteran
![Veteran Veteran](/images/ranks/rank_rect_5_vet.gif)
Joined: 30 Mar 2005 Posts: 1324 Location: London
|
Posted: Tue Nov 08, 2005 12:39 pm Post subject: |
|
|
Umm.... Any reason not to use telnet/ssh/vnc/nx? |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
stenny Tux's lil' helper
![Tux's lil' helper Tux's lil' helper](/images/ranks/rank_rect_1.gif)
![](images/avatars/gallery/The Fifth Element/movie_the_fifth_element_playa.gif)
Joined: 06 Feb 2003 Posts: 100 Location: Germany
|
Posted: Tue Nov 08, 2005 9:51 pm Post subject: |
|
|
Yes
The client machine is sitting behind a firmly closed firewall. Internet connections can only be established by using a http-proxy, which only supports http(s).
And as I've never set up a configuration like this, I consider it a good exercise . If only I knew, where to start ...
stefan |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
drwook Veteran
![Veteran Veteran](/images/ranks/rank_rect_5_vet.gif)
Joined: 30 Mar 2005 Posts: 1324 Location: London
|
Posted: Wed Nov 09, 2005 9:42 am Post subject: |
|
|
Why not just run a telnet server on port 80? Don't see how a proxy could determine what it was, afaik most are simply port based. |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
stenny Tux's lil' helper
![Tux's lil' helper Tux's lil' helper](/images/ranks/rank_rect_1.gif)
![](images/avatars/gallery/The Fifth Element/movie_the_fifth_element_playa.gif)
Joined: 06 Feb 2003 Posts: 100 Location: Germany
|
Posted: Wed Nov 09, 2005 10:06 pm Post subject: |
|
|
running a telnet server on port 80 is no answer to this question for 2 reasons:
1) a http proxy server like squid is not only a port based filter (like e.g. a firewall). Towards the client, it behaves like a http server and towards the server it behaves like a browser. Whenever you request a http page from a server, the proxy checks if it already has the page in it's cache and serves the browser from there. Otherwise, it asks the real server. The proxy can also do some basic checks on http-requests. Telnet-like packages do not contain http-requests and are therefor blocked by the proxy.
2) The configuration I want to set up looks like this:
Client --- <Internet/http> --- Machine 1 --- <LAN/telnet> --- Machine 2
The Client runs a normal web browser, like Firefox, Opera or any other
Machine 1 runs an Apache HTTP server and connects to Machine 2 (a small embedded Linux device) via telnet
If redirected port 80 to Machine 2, I could not reach my web server on Machine 1 any longer.
These are the reasons, why I'd prefer a solution, which uses only http as communication protocol and Machine 1 as a http/telnet gateway.
Regards
stefan |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
dpc n00b
![n00b n00b](/images/ranks/rank_rect_0.gif)
Joined: 09 Nov 2005 Posts: 16 Location: Chicago
|
Posted: Wed Nov 09, 2005 10:21 pm Post subject: |
|
|
Not sure if this is what you're looking for, but could you set up the web server itself as a proxy? (ala mod_proxy perhaps or some sort of socks proxy?)
I haven't done this myself, but...kind of seems like what you might be looking for. If you set up mod_proxy with the AllowCONNECT directive, you could then probably use a telnet client that can use an HTTP proxy and specify the telnet command such as connect <host> <port> (I know putty does this).
Good luck! _________________ Former die-hard Debian user, now co-mingling my Debian boxes with Gentoo and posting on the Gentoo forums...what has the world come to? |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
think4urs11 Bodhisattva
![Bodhisattva Bodhisattva](/images/ranks/rank-bodhisattva.gif)
![](images/avatars/8534934054bad29b51e5fa.jpg)
Joined: 25 Jun 2003 Posts: 6659 Location: above the cloud
|
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
d11wtq Apprentice
![Apprentice Apprentice](/images/ranks/rank_rect_2.gif)
![](images/avatars/1790896682437f3ff79b696.gif)
Joined: 14 Jul 2005 Posts: 192 Location: Manchester, UK
|
Posted: Wed Nov 09, 2005 10:54 pm Post subject: |
|
|
Use PHP.
It;s dangerous in any situation to use shell commands over HTTP but in any case:
Code: |
<?php
//Use the system() command to execute shell commands
system('ls -al'); //Run the ls command
//Or use backticks to execute the command
`ls -al`;
?>
|
You can pass that output around too, and print things to screen (you can even collect output into an array). |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
tutaepaki Apprentice
![Apprentice Apprentice](/images/ranks/rank_rect_2.gif)
Joined: 11 Nov 2003 Posts: 279 Location: New Zealand
|
Posted: Wed Nov 09, 2005 11:07 pm Post subject: |
|
|
sounds like stunnel is what you are looking for.
[url]stunnel.org[/url] |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
wjholden l33t
![l33t l33t](/images/ranks/rank_rect_4.gif)
Joined: 01 Mar 2004 Posts: 826 Location: Augusta, GA
|
Posted: Thu Nov 10, 2005 3:46 am Post subject: |
|
|
Bah, a stateless protocol like HTTP is terrible for something as resource intensive and interactive as a terminal. But, we all understand the occasional need for this kind of thing, just don't expect to use a console text editor.
You should consider writing a form-based text editor in addition to your command-line interface.
An example of your command-line interface: Code: | #!/usr/bin/perl
#
sub getcgivars {
my $in = shift;
$in =~ s/\+/ /g ;
$in =~ s/%([0-9A-Fa-f]{2})/chr(hex($1))/ge ;
$in =~ s/%([0-9A-Fa-f]{2})/chr(hex($1))/ge ;
$in =~ s/\n/<br>/g;
return $in;
}
print "Content-type: text/html\n\n";
read(STDIN, $line, $ENV{'CONTENT_LENGTH'});
$line = ($line =~ s/&/ /ge);
$line = ($line =~ s/input=//);
$line = &getcgivars($line);
$returnvalue = `$line`;
$br = '<br>
';
$returnvalue = ($returnvalue =~ s/\n/$br/ge);
print '<html>
<title>Console</title>
<body>
<h3>Console</h3>
<p>
';
print $returnvalue;
print '</p><p>
<form action="http://example.com/cgi-bin/console.pl" method="post">
Enter a command: <input type="text" name="input">
<INPUT type="submit">
</form>
</p>
</body>
</html>'; | If that code doesn't work I'll be happy to read whatever errors it produces, but you won't see me running this on my webserver.
I should mention that WebMin has the features you're asking for, although you wouldn't be able to use it as a result of the firewalling issues you discussed earlier. |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
|