Skip to main content

Skim milk. Gummy bears. Pure genius.

Quick Start

> python -c "import sdsu; sdsu.main()"

Note that, for Tornado-based servers, Windows users stop the service using CRTL + PAUSE/BREAK.

Overview

The Secure, Dual-use Server Utility, or SDSU, provides:

  • A preconfigured, multi-handler, Tornado-based web server

  • Static file hosting from the /static subdirectory

  • SSL encryption using the certificates stored in /security

  • Login protection (including address whitelisting) from the credentials in /security

  • Secure WebSocket exchange on the same port service as static file hosting, using the /wss path.

The sdsu.main() method takes three parameters that allow users to customize the configuration of a SDSU server before it launches: securityRoot, staticRoot, and wssHandlerCls.

securityRoot

By default, the /security subdirectory contains three files:

  • certificate.pem defines the server’s SSL certificate

  • credentials.csv defines the user table. Each user is defined by an email address (“email”), password (“password”), and whitelist mask (CIDR-style, IPv6 preferred but IPv4 will be translated automatically with a “2002:” prefix.) Password and whitelist mask will be used by the SplashHandler.post() method when verifying credential submissions.

  • key.pem defines the server’s private SSL key.

Users can customize security configurations by creating a new copy of this directory, modifying it’s contents, and passing the new absolute path to sdsu.main() as the securityRoot parameter. For example, you are strongly encouraged to use your own certificates.

staticRoot

The /static subdirectory contains static files that will be served to satisfy HTTP requests. Except for splash.html, all static files are protected by authentication restrictions. Default contents of /static include:

  • index.css, a stylesheet used by index.html and placed here to demonstrate and verify protection of static file contents.

  • index.html, the default landing page for authenticated users.

  • splash.html, which defines the login page for users that have not yet been authenticated. This also serves as a logout page, as upon accessing this resource any existing sessions are cleared.

Users can customize static file contents (and therefore the bulk of their web applications) by creating a new copy of this directory, modifying it’s contents, and passing the new absolute path to sdsu.main() as the staticRoot parameter.

wssHandlerCls

The class sdsu.WssHandler defines the default behavior for secure WebSocket interaction mounted by the server to the path “/wss”. Users can customize WebSocket behaviors by inheriting from this class, then pass the new child class to sdsu.main() as the wssHandlerCls parameter. Typical usage will override one or more of the following methods:

  • on_open()

  • on_message() (by default, simply echoes the message back to the client)

  • on_close()

See class method documentation for more details, including method signatures. Keep in mind that each instance of the WebSocker handler class is unique to a specific client connection; state is not shared between clients.

WebSocket Client

Once a server is running, connection via WebSocket is trivial:

> var wss = new WebSocket("wss://" + window.location.host + "/wss");
> wss.addEventListener("message", console.log);
> wss.send("0");

Metadata

Release files for sdsu 1.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for sdsu 1.0.0
File Size Uploaded
sdsu-1.0.0.tar.gz 10.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for sdsu 1.0.0
File Interpreter ABI Platform
sdsu-1.0.0-py3-none-any.whl Python 3 none any Details

Total release size: 20.9 kB

Release files / sdsu-1.0.0.tar.gz

Download URL sdsu-1.0.0.tar.gz
Size 10.3 kB
Tags Source
SHA-256 checksum
How to use checksums
0c9658e577c1fc57a31131dc9723fd639dfbcea6863ed4433b687bef59cf5a08
BLAKE2b-256 checksum
How to use checksums
f3f3889c4749ee9725bec5d40bf551c27fe51c9c0848edd099d058fef23060eb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.12.1 pkginfo/1.4.2 requests/2.18.4 setuptools/40.6.3 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.6.4

Release files / sdsu-1.0.0-py3-none-any.whl

Download URL sdsu-1.0.0-py3-none-any.whl
Size 10.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
341fc4089f5824400d46f209f0a9d8af0566e8101411b0f6efa1ac4b92b5e72e
BLAKE2b-256 checksum
How to use checksums
a95879d5aa3258dda0c760db4ebe71f7a09e40de4672511ccd9b848f212d59fd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.12.1 pkginfo/1.4.2 requests/2.18.4 setuptools/40.6.3 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.6.4

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page