CGI for authenticating users into a pf table.
Go to file
Dan Ponte bf401c0470 Initial import from webpftable-0.1 2011-11-06 10:05:57 -05:00
Makefile Initial import from webpftable-0.1 2011-11-06 10:05:57 -05:00
README Initial import from webpftable-0.1 2011-11-06 10:05:57 -05:00
webpftable.c Initial import from webpftable-0.1 2011-11-06 10:05:57 -05:00
webpftable.html Initial import from webpftable-0.1 2011-11-06 10:05:57 -05:00

README

1.1 Introduction

webpftable is a (very) simple CGI application that, upon successful authentication against
passwd(5), adds the client's IP address to a pf table.

2.1 Configuration and compilation

The default table name used is "webtable." However, you can set this either directly in
the source file (webpftable.c) by editing the TMPTAB #define, or via environment variables
to the make(1) instance. Observe:

	env DEFS=-DTMPTAB='\"trusted\"' make

will build webpftable such that the table name is "trusted." I apologise for the really
crappy default configuration, but it's nice and simple.
Obviously, to compile webpftable, simply run "make."

2.2 Installation

To install webpftable, simply copy it to your webserver's cgi-bin directory. Note that
either permissions on /dev/pf must allow your webserver's user to write to it, or you
must run the cgi as suid root. This is up to you.

A sample HTML file is included as an example of how the CGI is used. If you make your own,
the CGI takes two parameters in a POST request: login and passwd.

2.3 License

Webpftable is distributed under the following terms:

Copyright (c) 2005-2010 Dan Ponte. All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
   notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
   notice, this list of conditions and the following disclaimer in the
   documentation and/or other materials provided with the distribution.

THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
SUCH DAMAGE.