unbit/uwsgi — pull request #31 by brainbitsca (2012-10-24 09:29:23+00:00)
Title: router_access - plugin to implement hosts_access

A simple access control router using libwrap. Currently only tested on OpenBSD 5.1.

I've used router_authbasic as a guide to write this. Placeholders exist for an
internal ACL scheme. Syntax follows:

router = ^/path access:hosts -- hosts access router using libwrap, works!
router = ^/path access:allow,ipaddr -- internal allow, unimplemented
router = ^/path access:deny,ipaddr -- internal deny, unimplemented

The daemon paramater is 'uwsgi' for hosts_access . For example:

uwsgi.ini: router = ^/secret/ access:hosts
hosts.deny: uwsgi:ALL

-- also included changes suggested by unbit:
Separated header, body output in 403 error and used uwsgi_concat2n to copy strings out of wsgi_req->remote_addr and wsgi_req->host into hosts_ctl().