Home > Archive > Unix Programming > January 2008 > [Sockets] Help with a little pet project
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
[Sockets] Help with a little pet project
|
|
|
| I am trying to expose the file system on my machine which is behind a
LAN.
I have an account on the mail server and shell access on it. The mail
server is visible on the internet. The idea is to run an ftp server on
my local machine and expose the file list of the ftp using a simple
web-page. So, to the client (outside the LAN), it appears as an ftp
listing. Now, I need to allow downloads of files on my local machine.
It would look as follows
localhost >--------<Shell on Mail Server>---------(behind
LAN)------||| firewall |||------(internet)------< Client
The shell is quite small, but is big enough to store small files that
I wish to exchange. What I imagined was to use a small buffer to
relay this data to the client.
All that I need to know is how to go about doing this. I am aware of
simple socket programming and cgi programming. Is there a better way?
I was looking at XML-RPC too, but wasn't too sure.
Any kind of help will be much appreciated.
Thank you
Vogon
| |
| Logan Shaw 2008-01-19, 7:12 pm |
| b345t wrote:
> I am trying to expose the file system on my machine which is behind a
> LAN.
The words "behind a LAN" don't really make sense to me. Do you mean
that the machine is on a LAN and behind a firewall?
> I have an account on the mail server and shell access on it. The mail
> server is visible on the internet. The idea is to run an ftp server on
> my local machine and expose the file list of the ftp using a simple
> web-page. So, to the client (outside the LAN), it appears as an ftp
> listing. Now, I need to allow downloads of files on my local machine.
>
> It would look as follows
>
> localhost >--------<Shell on Mail Server>---------(behind
> LAN)------||| firewall |||------(internet)------< Client
I think you're saying that the mail server is reachable from the
internet. Is that right?
> The shell is quite small,
That doesn't make sense either. A shell is a program. I think you
mean some resource is limited on the machine where you allowed to
run the shell, though. I'm not sure whether the resource is
available space on some filesystem or some other resource.
> but is big enough to store small files that
> I wish to exchange. What I imagined was to use a small buffer to
> relay this data to the client.
>
> All that I need to know is how to go about doing this. I am aware of
> simple socket programming and cgi programming. Is there a better way?
> I was looking at XML-RPC too, but wasn't too sure.
This all sounds like a really complicated way to go about it. If it
were me, I would probably use the port forwarding feature that the
SSH protocol offers. You could run an FTP server (though preferably
not, since FTP is an ugly protocol that is hard to use) or WebDAV server
or whatever on the machine behind the firewall, then use port forwarding
so that the mail server can receive connections and then forward them
on to the server. Clients would simply connect to the mail server on
the specified port, then the ssh client (or server, depending on how you
set it up) would relay all the traffic through another TCP connection
over to the file server on whatever port it's listening on.
The advantage of this approach is that you're doing it all at the
TCP level. That means a protocol that uses a single TCP connection
(for one session) will be able to do everything like normal, with
no modifications necessary to how you interact with it. That means
you have to invent a lot less.
Of course, make sure this is all OK with whoever owns the network
that you're using. The firewall probably exists for a reason. By
circumventing it, you could violating some sort of policy.
- Logan
|
|
|
|
|