Skip to content

Commit 9633dbb

Browse files
committed
Adding a lockdown feature to mythweb. We check the user agent (and a get var) to see if it is a search engine or bot or the like. If it is, we lock down the mythweb install until the lockfile is manually removed. The idea is to prevent people from having their installs indexed without their knowledge. It is not perfect, but it is a start. There is a way to disable this feature if the user wants, and it is covered in the updated README file.
git-svn-id: http://svn.mythtv.org/svn/trunk@17580 7dbf422c-18fa-0310-86e9-fd20926502f2
1 parent f89a9e5 commit 9633dbb

File tree

18 files changed

+104
-4
lines changed

18 files changed

+104
-4
lines changed

README

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -135,10 +135,26 @@ A: First, make sure that if you have enabled some form of authentication that
135135
Q: I get a "500 server error" (or some other number) when trying to view
136136
MythWeb.
137137
A: Check your apache logs for details about what caused the error. Usually,
138-
it means that you didn't set up a required module. Read the
138+
it means that you didn't set up a required module. Read the
139139
mythweb.conf.apache file in more detail to make sure you didn't miss
140140
an important setup file.
141141

142+
Q: Why is my MythWeb install locked?
143+
A: Given the absolutely huge number of open mythweb installs, we have added in
144+
a automatic lockdown feature when we detect a bot or the like. This is to
145+
prevent your install from being indexed, and having all your recordings
146+
deleted or someone finding it and setting it to record opera 24x7.
147+
148+
Q: So... how do I unlock the install?
149+
A: You can unlock the install by removing the file the message screen gives
150+
you, but you should secure the install before you do that (read INSTALL)
151+
152+
Q: I don't like you protecting my data... I want the world to mess with my
153+
MythTV install!
154+
A: If you want to disable this feature, set the apache envirnment var
155+
MYTHWEB_LOCKDOWN_DISABLE to true and remove the lockdown file, and
156+
we will no longer try to protect you.
157+
142158
======================
143159
4.0 Submitting Patches
144160
======================
@@ -150,5 +166,3 @@ Please create patches against the most recent version of SVN. I can deal with
150166
other "diff -u" patches, but if there have been any major changes in SVN (there
151167
occasionally are), I won't put much effort into trying to make your patch work,
152168
so please just use SVN.
153-
154-

includes/init.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727

2828
// Define some common stuff
2929
require_once 'includes/defines.php';
30-
// Check out the php version info
30+
// Check out the php version info
3131
require_once 'includes/php_version_check.php';
3232

3333
// Load the error trapping and display routines
@@ -46,6 +46,9 @@
4646
// Load the translation routines so the modules can translate their descriptions
4747
require_once 'includes/translate.php';
4848

49+
// Protect the users!
50+
require_once 'includes/lockdown.php';
51+
4952
// Include a few useful functions
5053
require_once 'includes/css.php';
5154
require_once 'includes/mouseovers.php';

includes/lockdown.php

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
<?php
2+
/**
3+
* To attempt to curve the massive amounts of (unintentionally) open mythweb installs, we are attempting to
4+
* protect the users by having a automatic lockdown if we detect a 'bot' or if it's specifically requested by a user
5+
*
6+
* You can disable this feature with the apache env var of MYTHWEB_LOCKDOWN_DISABLE being set to true
7+
*
8+
* @url $URL: svn+ssh://svn.mythtv.org/var/lib/svn/trunk/mythplugins/mythweb/includes/lockdown.php $
9+
* @date $Date: 2008-03-07 16:21:55 -0800 (Fri, 07 Mar 2008) $
10+
* @version $Revision: 16436 $
11+
* @author $Author: kormoc $
12+
* @license GPL
13+
*
14+
* @package MythWeb
15+
*
16+
/**/
17+
18+
if ($_SERVER['MYTHWEB_LOCKDOWN_DISABLE'] != true) {
19+
if ( stristr('bot', $_SERVER['HTTP_USER_AGENT']) !== false
20+
|| stristr('spider', $_SERVER['HTTP_USER_AGENT']) !== false
21+
|| stristr('crawler', $_SERVER['HTTP_USER_AGENT']) !== false
22+
|| stristr('search', $_SERVER['HTTP_USER_AGENT']) !== false
23+
|| stristr('yahoo', $_SERVER['HTTP_USER_AGENT']) !== false
24+
|| isset($_GET['TRIGGER_MYTHWEB_LOCKDOWN'])
25+
)
26+
touch('lockdown');
27+
}
28+
29+
if ( $_SERVER['MYTHWEB_LOCKDOWN_DISABLE'] != true && file_exists('lockdown'))
30+
tailored_error('lockdown');

modules/_shared/lang/Catalan.lang

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -472,6 +472,8 @@
472472
"LOADING"
473473
"Local Server Statistics"
474474
"Local weather forecast"
475+
"LOCKDOWN_NOTICE"
476+
"LOCKDOWN_NOTICE_2"
475477
"Logs"
476478
Informes
477479
"Low"

modules/_shared/lang/Czech.lang

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -371,6 +371,8 @@
371371
"LOADING"
372372
"Local Server Statistics"
373373
"Local weather forecast"
374+
"LOCKDOWN_NOTICE"
375+
"LOCKDOWN_NOTICE_2"
374376
"Logs"
375377
"Low"
376378
"Low Space"

modules/_shared/lang/Danish.lang

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -459,6 +459,8 @@
459459
"LOADING"
460460
"Local Server Statistics"
461461
"Local weather forecast"
462+
"LOCKDOWN_NOTICE"
463+
"LOCKDOWN_NOTICE_2"
462464
"Logs"
463465
"Low"
464466
Lav

modules/_shared/lang/Dutch.lang

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -456,6 +456,8 @@
456456
"LOADING"
457457
"Local Server Statistics"
458458
"Local weather forecast"
459+
"LOCKDOWN_NOTICE"
460+
"LOCKDOWN_NOTICE_2"
459461
"Logs"
460462
Logboek
461463
"Low"

modules/_shared/lang/English.lang

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -337,6 +337,10 @@
337337
"LOADING"
338338
"Local Server Statistics"
339339
"Local weather forecast"
340+
"LOCKDOWN_NOTICE"
341+
MythWeb has detected a bot accessing this install. We have locked down the install to prevent any issues with bots deleting all your recordings or allowing other people from accessing your mythweb install without your permission. Please secure your install (read the INSTALL and README files) and remove
342+
"LOCKDOWN_NOTICE_2"
343+
to unlock this install. To disable this feature, read the README file.
340344
"Logs"
341345
"Low"
342346
"Low Space"

modules/_shared/lang/English_GB.lang

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -341,6 +341,8 @@
341341
"LOADING"
342342
"Local Server Statistics"
343343
"Local weather forecast"
344+
"LOCKDOWN_NOTICE"
345+
"LOCKDOWN_NOTICE_2"
344346
"Logs"
345347
"Low"
346348
"Low Space"

modules/_shared/lang/Finnish.lang

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -448,6 +448,8 @@
448448
"LOADING"
449449
"Local Server Statistics"
450450
"Local weather forecast"
451+
"LOCKDOWN_NOTICE"
452+
"LOCKDOWN_NOTICE_2"
451453
"Logs"
452454
Lokit
453455
"Low"

0 commit comments

Comments
 (0)