From a0ed0e6bc7809e88ee1272fa9516dd7e3c7e8d2d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timo=20Ter=C3=A4s?= Date: Wed, 24 Nov 2010 16:13:57 +0200 Subject: www: add a set of example pages for block info and captive portal Relatively simple set of pages done in haserl. Fixes #448. --- Makefile | 5 ++- www/Makefile | 7 ++++ www/README | 13 ++++++ www/background.png | Bin 0 -> 976 bytes www/do-login.cgi | 19 +++++++++ www/do-logout.cgi | 6 +++ www/do-override.cgi | 6 +++ www/info.cgi | 44 ++++++++++++++++++++ www/login.cgi | 49 +++++++++++++++++++++++ www/style.css | 113 ++++++++++++++++++++++++++++++++++++++++++++++++++++ www/warning.cgi | 37 +++++++++++++++++ www/warning.png | Bin 0 -> 2748 bytes www/worldmap.png | Bin 0 -> 42493 bytes 13 files changed, 297 insertions(+), 2 deletions(-) create mode 100644 www/Makefile create mode 100644 www/README create mode 100644 www/background.png create mode 100755 www/do-login.cgi create mode 100755 www/do-logout.cgi create mode 100755 www/do-override.cgi create mode 100755 www/info.cgi create mode 100755 www/login.cgi create mode 100644 www/style.css create mode 100755 www/warning.cgi create mode 100644 www/warning.png create mode 100644 www/worldmap.png diff --git a/Makefile b/Makefile index 676b01f..500282a 100644 --- a/Makefile +++ b/Makefile @@ -11,18 +11,19 @@ DESTDIR:= BINDIR:=/usr/bin SBINDIR:=/usr/sbin CONFDIR:=/etc/$(PACKAGE) +WWWDIR:=/usr/share/$(PACKAGE)/www MANDIR:=/usr/share/man DOCDIR:=/usr/share/doc/$(PACKAGE) STATEDIR:=/var/run LIBDIR:=/var/lib/$(PACKAGE) LUALIBDIR:=/usr/lib/lua/5.1 -export DESTDIR BINDIR SBINDIR CONFDIR MANDIR DOCDIR STATEDIR LIBDIR LUALIBDIR +export DESTDIR BINDIR SBINDIR CONFDIR WWWDIR MANDIR DOCDIR STATEDIR LIBDIR LUALIBDIR ## # Top-level rules and targets -targets := src/ man/ +targets := src/ man/ www/ ## # Include all rules and stuff diff --git a/www/Makefile b/www/Makefile new file mode 100644 index 0000000..e9dcac1 --- /dev/null +++ b/www/Makefile @@ -0,0 +1,7 @@ +CGIBIN_FILES = $(wildcard $(src)/*.cgi) +STATIC_FILES = $(wildcard $(src)/*.png $(src)/*.css) + +install: + $(INSTALLDIR) $(DESTDIR)$(WWWDIR)/cgi-bin $(DESTDIR)$(WWWDIR)/static + $(INSTALL) $(CGIBIN_FILES) $(DESTDIR)$(WWWDIR)/cgi-bin + $(INSTALL) $(STATIC_FILES) $(DESTDIR)$(WWWDIR)/static diff --git a/www/README b/www/README new file mode 100644 index 0000000..588c574 --- /dev/null +++ b/www/README @@ -0,0 +1,13 @@ +Here is an example set of captive portal and warning page web pages. +The haserl scripts and other contents in this directory are part of +squark suite and licensed under the GPL with the below mentioned +exceptions. + +warning.png + From Tango Icon library (Public Domain). Credits go to Tango Desktop + Project. + +worldmap.png + Slightly modified version of: + http://www.webresourcesdepot.com/wp-content/uploads/image/free-world-map-black-white.gif + Should be free to use. diff --git a/www/background.png b/www/background.png new file mode 100644 index 0000000..58baf13 Binary files /dev/null and b/www/background.png differ diff --git a/www/do-login.cgi b/www/do-login.cgi new file mode 100755 index 0000000..e4afce8 --- /dev/null +++ b/www/do-login.cgi @@ -0,0 +1,19 @@ +#!/usr/bin/haserl +HTTP/1.0 302 Found +Location: & /dev/null && ok=yes + +if [ "$ok" = "yes" ]; then + squark-auth-ip -i $REMOTE_ADDR -u $POST_username -l + echo -n "info.cgi" +else + echo -n "login.cgi?REASON=fail" +fi ?> + +Moved. diff --git a/www/do-logout.cgi b/www/do-logout.cgi new file mode 100755 index 0000000..34a07e4 --- /dev/null +++ b/www/do-logout.cgi @@ -0,0 +1,6 @@ +#!/usr/bin/haserl +HTTP/1.0 302 Found +Location: login.cgi + +Moved. + diff --git a/www/do-override.cgi b/www/do-override.cgi new file mode 100755 index 0000000..b5ad0f2 --- /dev/null +++ b/www/do-override.cgi @@ -0,0 +1,6 @@ +#!/usr/bin/haserl +HTTP/1.0 302 Found +Location: + +Moved. + diff --git a/www/info.cgi b/www/info.cgi new file mode 100755 index 0000000..b2e86cf --- /dev/null +++ b/www/info.cgi @@ -0,0 +1,44 @@ +#!/usr/bin/haserl +Content-Type: text/html;charset=UTF-8 +Pragma: no-cache +Cache-Control: no-cache + + + + + + Internet User Authentication Required + + + + +
Warning sign
+
+
+

Login Information

+

+ You are now logged in. You may wish to keep this page open in order to remain + logged in. Click the logout button below when you are finished. +

+

+ Your Session Information: +

+

+ + + + + + +
IP-address:
Username:
Login time:
Last Activity:
Last Override:
+

+

+

+ +
+

+
+
+ + + diff --git a/www/login.cgi b/www/login.cgi new file mode 100755 index 0000000..33be150 --- /dev/null +++ b/www/login.cgi @@ -0,0 +1,49 @@ +#!/usr/bin/haserl +Content-Type: text/html;charset=UTF-8 +Pragma: no-cache +Cache-Control: no-cache + + + + + Internet User Authentication Required + + + +
Warning sign
+
+
+

Internet User Authentication Required

+

+ User authentication is required to access the Internet. Please, + provide your credentials to login. +

+ <% + if [ "$GET_REASON" = "fail" ]; then + echo -n "

Incorrect user name or password. Please try again.

" + fi + %> +

+

+ " /> + + + + + + + + + + + +
User name:
Password:
+ +
+
+

+
+
+ + + diff --git a/www/style.css b/www/style.css new file mode 100644 index 0000000..d2b9aba --- /dev/null +++ b/www/style.css @@ -0,0 +1,113 @@ +* { + font-size: 100%; + margin: 0; + padding: 0; +} + +body { + background-color: #D6D6D6; + background-image: url(background.png); + background-repeat: repeat-x; + font-family: verdana, sans-serif; + font-size: 0.8em; +} + +#warning { + position: absolute; + left: 51px; + top: 15px; +} + +h1 { + padding-bottom: 15px; + margin-bottom: 15px; + border-bottom: 1px solid #878787; + font-family: "Trajan Pro, serif"; + font-size: 1.8em; + font-variant: small-caps; +} + +h2 { + margin-top: 5px; + font-family: "Trajan Pro, serif"; + font-size: 1.2em; + font-style: italic; + font-weight: bold; +} + +p, dt { + margin-top: 12px; +} + +dt { + font-style: italic; +} + +dd { + margin-top: 6px; + margin-left: 6px; +} + + +.badword { + color: red; +} + +.goodword { + color: green; +} + +#blockedreason { + padding: 10px 10px 10px 10px; + margin: 10px 10px 10px 10px; + background-color: #ffaaaa; + font-weight: bold; +} + +.deniedurl { + font-weight: bold; +} + +#fulldeniedurl { + background-color: #D6D6D6; + padding: 10px 10px 10px 10px; + margin: 10px 10px 10px 10px; + display: none; +} + +#toggleurl { + border-bottom: 1px solid; + font-size: 0.8em; + cursor: pointer; + color: blue; +} + +#outer_container { + margin: 0% 80px 0% 80px; + background-color: white; + border-left-style: groove; + border-right-style: groove; + border-bottom-style: groove; + background-image: url(worldmap.png); + background-repeat: no-repeat; + background-position: top center; +} + +#inner_container { + margin-left: 5%; + margin-right: 5%; + padding-top: 80px; + padding-bottom: 80px; + overflow: hidden; + /* It grows out of the "box" in IE */ + word-wrap: break-word; /* Internet Explorer */ +} + + +a { + text-decoration: none; +} + +a:hover { + border-bottom: 1px solid; +} diff --git a/www/warning.cgi b/www/warning.cgi new file mode 100755 index 0000000..5c73fa7 --- /dev/null +++ b/www/warning.cgi @@ -0,0 +1,37 @@ +#!/usr/bin/haserl +Content-Type: text/html;charset=UTF-8 +Pragma: no-cache +Cache-Control: no-cache + + + + + Content Filter Warning + + + +
Warning sign
+
+
+

Content Filter Warning

+

Access to + + has been denied in an attempt to protect you from harmful content. +

+

However, if you are sure that you were blocked in error, you may + override the warnings for a 15 minute period. +

+

Reason for block:

+

User credentials:

+

User IP-address:

+

+

+ + +
+

+
+
+ + + diff --git a/www/warning.png b/www/warning.png new file mode 100644 index 0000000..c52e36e Binary files /dev/null and b/www/warning.png differ diff --git a/www/worldmap.png b/www/worldmap.png new file mode 100644 index 0000000..be2c524 Binary files /dev/null and b/www/worldmap.png differ -- cgit v1.2.3