Initial commit

This commit is contained in:
Zachary Seguin 2015-12-05 00:57:45 -05:00
commit a68f142076
6 changed files with 173 additions and 0 deletions

61
disable-webspace Executable file
View File

@ -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}

70
www/css/disabled.css Normal file
View File

@ -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;
}

BIN
www/img/csc.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.5 KiB

BIN
www/img/disabled.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 74 KiB

BIN
www/img/uwaterloo.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

42
www/index.php Normal file
View File

@ -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>