Initial commit
authorZachary Seguin <ztseguin@csclub.uwaterloo.ca>
Sat, 5 Dec 2015 05:57:45 +0000 (00:57 -0500)
committerZachary Seguin <ztseguin@csclub.uwaterloo.ca>
Sat, 5 Dec 2015 06:02:11 +0000 (01:02 -0500)
disable-webspace [new file with mode: 0755]
www/css/disabled.css [new file with mode: 0644]
www/img/csc.png [new file with mode: 0644]
www/img/disabled.png [new file with mode: 0644]
www/img/uwaterloo.png [new file with mode: 0644]
www/index.php [new file with mode: 0644]

diff --git a/disable-webspace b/disable-webspace
new file mode 100755 (executable)
index 0000000..1a69b74
--- /dev/null
@@ -0,0 +1,61 @@
+#!/bin/bash
+
+#
+# CONFIGURATION
+#
+DISABLED_PAGE=/~sysadmin/expired/index.php
+
+#
+# Temporary files
+#
+EXPIRED_USERS=`mktemp "/tmp/expired_users.XXXX"`
+
+#
+# Identify expired accounts
+#
+
+# Get the current term
+YEAR=$(date '+%Y')
+MONTH=$(date '+%m')
+TERM_START_MONTH=$(($MONTH - (($MONTH - 1) % 4)))
+
+# NOTE: This is configured to give 1 months grace period
+if [ ${TERM_START_MONTH} -eq 1 ]; then
+   if [ ${MONTH} = 1 ]; then
+      TERM_FILTER="(!(term=F$((${YEAR} - 1))))(!(term=W${YEAR}))"
+   else
+      TERM_FILTER="(!(term=W${YEAR}))"
+   fi
+elif [ ${TERM_START_MONTH} -eq 5 ]; then
+   if [ ${MONTH} = 5 ]; then
+      TERM_FILTER="(!(term=W${YEAR}))(!(term=W${YEAR}))"
+   else
+      TERM_FILTER="(!(term=S${YEAR}))"
+   fi
+elif [ ${TERM_START_MONTH} -eq 9 ]; then
+   if [ ${MONTH} = 9 ]; then
+      TERM_FILTER="(!(term=S${YEAR}))(!(term=F${YEAR}))"
+   else
+      TERM_FILTER="(!(term=F${YEAR}))"
+   fi
+else
+   echo "Invalid term start month: ${TERM_START_MONTH}" >&2
+   exit 1
+fi
+
+# Find expired accounts
+ldapsearch -xb "ou=People,dc=csclub,dc=uwaterloo,dc=ca" "(&${TERM_FILTER}(objectClass=member))" | grep 'uid:' | awk '{print $2}' | sort -u > ${EXPIRED_USERS}
+
+#
+# Generate Apache config
+#
+for uid in $(cat ${EXPIRED_USERS}); do
+   echo "<Directory /users/${uid}/www>"
+   echo "    AllowOverride None"
+   echo "    RewriteEngine On"
+   echo "    RewriteRule . ${DISABLED_PAGE} [L]"
+   echo "</Directory>"
+   echo ""
+done
+
+rm -f ${EXPIRED_USERS}
diff --git a/www/css/disabled.css b/www/css/disabled.css
new file mode 100644 (file)
index 0000000..6090464
--- /dev/null
@@ -0,0 +1,70 @@
+html {
+   font-family: sans-serif;
+   background: #eee;
+}
+
+a img {
+   border: none;
+}
+
+header {
+   margin: 0 auto;
+   max-width: 500px;
+}
+
+.wrapper {
+   max-width: 750px;
+   background: white;
+   padding: 30px;
+   margin: 30px auto;
+   border-radius: 5px;
+   box-shadow: 1px 1px 6px rgba(0, 0, 0, .5);
+}
+
+.logos .logo {
+   display: block;
+   width: 100%;
+   max-width: 250px;
+   margin: 0 auto;
+   overflow: hidden;
+}
+
+@media (min-width: 800px) {
+   .logos .logo {
+      max-width: 350px;
+   }
+}
+
+.logos .logo img {
+   width: 100%;
+}
+
+
+
+.body {
+   clear: both;
+   max-width: 500px;
+   margin: 0 auto;
+}
+
+.body h1 {
+   border-top: 1px solid black;
+   border-bottom: 1px solid black;
+   text-align: center;
+   padding: 20px 0;
+   text-transform: uppercase;
+}
+
+.body p {
+   padding: 5px 15px;
+   line-height: 1.5em;
+}
+
+ul {
+   list-style: square;
+   line-height: 1.5em;
+}
+
+ul li {
+   margin-bottom: 10px;
+}
diff --git a/www/img/csc.png b/www/img/csc.png
new file mode 100644 (file)
index 0000000..cb31d99
Binary files /dev/null and b/www/img/csc.png differ
diff --git a/www/img/disabled.png b/www/img/disabled.png
new file mode 100644 (file)
index 0000000..8254928
Binary files /dev/null and b/www/img/disabled.png differ
diff --git a/www/img/uwaterloo.png b/www/img/uwaterloo.png
new file mode 100644 (file)
index 0000000..f518188
Binary files /dev/null and b/www/img/uwaterloo.png differ
diff --git a/www/index.php b/www/index.php
new file mode 100644 (file)
index 0000000..1e7173f
--- /dev/null
@@ -0,0 +1,42 @@
+<?php
+   header('status: 503 Expired Website');
+?>
+
+<!doctype html>
+<html lang="en">
+   <head>
+      <base href="https://csclub.uwaterloo.ca/~sysadmin/expired/" />
+      <meta charset="utf-8" />
+      <meta name="viewport" content="width=device-width, initial-scale=1">
+
+      <title>Computer Science Club of the University of Waterloo</title>
+
+      <link href="./css/disabled.css" rel="stylesheet" />
+   </head>
+   <body>
+      <div class="wrapper">
+         <header>
+            <div class="logos">
+               <span class="logo">
+                  <a href="https://uwaterloo.ca/"><img  src="./img/uwaterloo.png"
+                        alt="University of Waterloo"
+                        class="uwaterloo" /></a>
+               </span>
+               <span class="logo">
+                  <a href="https://csclub.uwaterloo.ca/"><img  src="./img/csc.png"
+                        alt="Computer Science Club of the University of Waterloo"
+                        class="csc" /></a>
+               </span>
+            </div>
+         </header>
+         <section class="body">
+            <h1>Parked Website</h1>
+            <p>This is a parking page for the website of a previous <a href="https://csclub.uwaterloo.ca/">Computer Science Club</a> member.</p>
+
+            <p>If you are the owner and would like to continue using our web hosting, please renew your membership to restore access to your website.</p>
+
+            <p>We apologize for any inconvenience this may cause. If you have any questions, please contact <a href="mailto:syscom@csclub.uwaterloo.ca">syscom@csclub.uwaterloo.ca</a>.</p>
+         </section>
+      </div>
+   </body>
+</html>