Authentication system for Skule.ca
Python Shell PHP
Switch branches/tags
Nothing to show
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
testing
Makefile
README.md
auth_lib.py
rpc_auth_server.py
server_settings.conf
testing.sql

README.md

README

This is the authentication backend that will be used by the Skule student website

To run this on your own server, simply install Twisted, set the appropriate values in the configuration file server_settings.conf, then run rpc_auth_server.py. Included in the testing directory is a sample of the usage of this system.

Note that to use SSL, you will also have to generate SSL certs, change the paths to them in rpc_auth_server, and configure Apache and mod_ssl appropriately.

Generating SSL Certs

$ openssl genrsa -des3 -out server.key 1024
$ openssl req -new -key server.key -out server.csr
$ cp server.key server.key.org
$ openssl rsa -in server.key.org -out server.key
$ openssl x509 -req -days 365 -in server.csr -signkey server.key -out server.crt

Then, you'll want to notify Apache of this:

$ cp server.crt /etc/apache2/server.crt
$ cp server.key /etc/apache2/server.key

and add lines to your Apache configuration, probably something along the line of

SSLCertificateFile "/etc/apache2/server.crt"
SSLCertificateKeyFile "/etc/apache2/server.key"

as well as installing and activating mod_ssl

Generating the database

The database used in the sample code is a SQLite database for ease of testing. To create the database, simply run the following code:

sqlite3 test.db < testing.sql

which will create a database named "test.db" containing the user tables.

Other Considerations

The Python CGI scripts currently use cgitb for debugging purposes. When deploying in a production environment, one will probably want to remove the lines

import cgitb
cgitb.enable()

from the various scripts (namely check.py, create.py, and login.py).