Skip to content
/ funcgi Public

Containers for Common Gateway Interface (CGI) web application development

License

Notifications You must be signed in to change notification settings

tlcu/funcgi

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

funcgi

Simple web programming.

Frustrated with modern web development worst practices?

Sick of Evil Corp.™ 'services'?

Interested in scaling down to a personal, hackable web?

Have fun with CGI!

Flavors

A number of programming environments are ready to go:

Flavor Description Size (MB)
base barebones BusyBox environment 5.73
Forth the stack based programming language 8.36
Guile scheme dialect / GNU extension language 18.9
Jim small-footprint yet full-featured Tcl dialect 10.1
Lua lightweight, embeddable scripting language 6.09
OCaml an industrial strength programming language 202
Perl 25,000 extensions on CPAN 39.9
Python popular and easy-to-learn 58.6
Ruby 'Ruby is designed to make programmers happy' 24.3
Tcl Tool Command Language, batteries included 15.2

Try it

$ mkdir -p www/cgi-bin
$ echo '#!/bin/sh' > www/cgi-bin/shell
$ echo 'echo "content-type: text/plain"' >> www/cgi-bin/shell
$ echo 'echo ""' >> www/cgi-bin/shell
$ echo 'echo "Hello, World!"' >> www/cgi-bin/shell
$ echo 'echo "$QUERY_STRING"' >> www/cgi-bin/shell
$ docker run --name funcgi \
             --user 4000 \
             --security-opt=no-new-privileges \
             --cap-drop ALL \
             --read-only \
             --tmpfs /tmp \
             --volume "$(pwd)"/www:/var/www/localhost/htdocs \
             --publish 80:1337 tlcu/funcgi:base
$ curl localhost/cgi-bin/shell
Hello, World!
$ curl localhost/cgi-bin/shell?hi!
Hello, World!
hi!

Setup

The following commands will build and launch a container locally:

$ git clone https://github.com/tlcu/funcgi
$ cd funcgi
$ docker build <flavor> -t funcgi:<flavor>
$ ./run.sh <flavor>

Navigating to http://localhost should bring up the demo web page. $ curl localhost/cgi-bin/test should get you a response from the demo shell CGI script.

From here, you can edit and file to the www directory. Executables should go in www/cgi-bin/, static content can go anywhere else.

How This Works

The docker run commands try to constrain the CGI programs: they are ran by an unprivileged user in a read-only filesystem.

Inspired by / derived from / thanks to

License

Code is 0BSD, content is CC BY.

About

Containers for Common Gateway Interface (CGI) web application development

Resources

License

Stars

Watchers

Forks

Packages

No packages published