Jump to Navigation

Fun with flashpolicy and init

So a while back I set up the front page for the Meat MUD Classic website with an embedded FMud (F for Flash) client that automatically connects to Meat MUD Classic as soon as you open the page, giving instant access to the MUD.  I've wanted this for a while to entice new players - nothing makes getting into a new game easier than having it automagically start working as soon as you open a web page.

I had to take it down, however, due to an annoying tendency for the client to stop working and generating a security related error for no apparent reason - or at least not that I could immediately detect.  Of course when life calls there usually isn't a lot of free time to troubleshoot - and there really wasn't a whole lot of documentation available at the time.  The developer of FMud was also unsure as to how to resolve the issue, although to be completely fair I probably did a very poor job of explaining my problem to him.

So several months go by, and I get a bug up my arse to get this thing working again - and I figure with newer versions of the client available perhaps now I'll have some better success.  Unfortunately the same issue starts to occur - just when I think I have everything working I would try again after waiting a bit and the same security error would return.

Part of the issue at hand is that Adobe decided to add a layer of security to Flash starting with version 9.0 that requires a policy XML file be accessible via a certain defined port (843 by default) before allowing a telnet/socket connection to the server in question.  While annoying, I am also familiar with the vast number of Adobe related exploits out there and this is probably a rather good idea.  The annoying part is that I was starting to come to the conclusion that the policy not remaining accessible to FMud for some reason.

I noticed that the issue cropped up any time I logged out of my shell account on my server - but what was tricky was that I was launching a python script - and when I signed back into the server python was still running and port 843 was still occupied if I attempted to run the script again.  I needed to kill python in order to be able to restart the script.

In addition - I needed to find a way to keep the script running.  Earlier attempts to create an init entry for the script had failed - I was able to set up one to automatically boot Meat MUD Classic a long time ago but for some reason the entries I created would cause the entire server to hang during startup as the policy file sat there, waiting endlessly for a response and preventing other applications from launching.  More than a little irritating.  Inherently, I knew this was the answer I was looking for - if the server automatically launched the policy script I would not need to do it manually, and it would not stop working whenever I logged out.

It finally occurred to me to do a Google search for flashpolicy.py and init - and low and behold I found flashpolicytwistd which just happens to be a Google Code project.  It's a simple and effective flashpolicy server program - it automatically launches in init and I can set it up to start as the server boots up (although I still need to test that everything loads properly when this happens).

So there we have it - in a nutshell a working FMud client that should no longer stop working (I hope).