What? Why? How?
If you are behind a firewall which does not route packets from a local network to the internet, you cannot make your palace (or any other services for that matter) running behind the firewall available to the outside world. When run on the gateway box, the following scripts get around this problem.
To see how this works, consider what I have set up. On my local network, behind the gateway box (virtual.dyc.edu), I have a Mac (evilsprite) running a palace on port 9998 and a web page on port 80. Virtual is not routing packets between its local net and the internet, so to make these services available to the outside, I use the following scripts to map evilsprite's palace service onto port 29998 on virtual, and its web service onto port 20080 on virtual. In other words, to connect to the palace on evilsprite from the internet, one connects to palace://virtual.dyc.edu:29998. Similarly, to get to the web page on evilsprite, one directs one's browser to http://virtual.dyc.edu:20080. (These may not be up right now, but they were when I wrote this.)
In brief, what the perl script does, is it listens on port 20080 (say) for incoming connections. Once a socket connection is established with the remote host, the script then establishes a second socket connection with the local host running its service on port 80 (say). Data is then simply streamed between the two sockets. Multiple connections are handled by forking children processes which take care of established connections, while the parent listens for new ones. Since there may be several services you wish to proxy, there is a start up script (start-proxies) which reads a configuration file (proxies.conf) and for each service to be proxied, starts up a proxying thread (start-service). You can also check the status of what is being proxied (status-proxies), and you can shut off all proxying (stop-proxies).
Here are the perl scripts and configuartion file. You should not have to edit anything except the proxies.conf file to suite your local network setup.
Take off the .txt extension after downloading, and put all the files into the same directory on the gateway box. Then:
The scripts generate logs in the form of evilsprite.80.20080.log for the proxied service mapped from port 80 on evilsprite to 20080 on the gateway box. All connections are logged.
ADDED GOODIE: Here's a Sys V style init script which you can install so that your proxy services start up automatically when rebooting or entering a given runlevel:proxies. The script is installed similarly to the one I wrote for palace, available here.
Happy sys admining, and email comments to email@example.com