Monday, June 25, 2012

Plentimon actually does roll dice

Post from the past

RDA server now responds to dice requests

Added dice rolling capabilities to roll up to 100 dice between 2 and 20 sides. Broke login out of chat logic, client test script can now recognize /whisper [name] [text] and /roll [1-100]d[2-20] commands to test relevant capabilities on the server. Server now expects a login message before a timeout or it drops the connection.

Notes from the future

I am pretty much obsessed with finding better ways to generate pseudorandom numbers for the RDA, but if I devoted all my time to that, nothing else would ever get done.  Right now, the dice roller uses the default random number generator for Python, but as soon as I get a plug in framework set up that will change.  The long term goal it to allow pluggable random providers that can be set according to the server admin's whim.

Sunday, June 24, 2012

Login and password

Post from the past

RDA server now requires username and password

Fixed bugs, added login / password checking capabilities, and made a few test scripts to prove everything is working. Will add more comments tomorrow and begin work on a client GUI and dice rolling! (Note from the future: this timeline turned out to be somewhat... optimistic)

Fixed password hashing, added versioning support, added files for use with python's distutils. Oh yeah, and more comments!

Notes from the future

For right now the RDA server has a password that is set when the server is started and which must be supplied by a user when they attempt to log in.  This scheme is similar to Mumble (minus certificates) and I figured it would be a good start for the RDA.

In general I try to handle the plaintext password as little as possible - for instance, in the server's set passwd function, it takes in a plaintext password which is immediately hashed using SHA-256 and stored as a hash.  Likewise on the client, which sends the hashed password in a login message.  A lot of this functionality is provided by Twisted, but in some cases the documentation can be hard to follow.


The login responder, shown above, handles incoming login messages to the server. It first cancels a timer that gets kicked off when a user first attempts to connect to the server - if they don't offer login credentials within the time limit, they will be booted off. Then it makes sure that user is not already logged in, and that the messaging version they are using matches the messaging version the server is using. Finally, we kick off a Twisted deferred to call the authenticate method.


Authenticate is mostly filled with Twisted code which you can read about here: Cred: Pluggable Authentication. It is pretty self explanatory, either the hash matches or the user is kicked with an unauthorized login response.

I am still not happy with the credentials module - it works well enough for now however, so until I wrap my head around how it should change, it is staying as is.

Saturday, June 23, 2012

Time to 'git' some source control

Post from the past

RDA is now using git

Uploaded all starting sandbox code for the RDA to bitbucket. (Note from the future: I picked bitbucket because it allowed me to have private repos. I was somewhat shy about having unfinished, poorly written code out in the open with my name on it... how quickly things change). RDA has been split into multiple projects, with a common submodule to share between them. Hopefully this will make it easier going forward.