Topic: Admin stuff in separate directory

Thanks for the great software.  I'm wondering if it would be possible to place the admin pages in a separate directory.  That way users could password protect the directory (via .htaccess file) as an extra precaution against having the forum compromised.  I tried to do this mod myself but had problems with the links resolving correctly.  Are there disadvantages to doing this that would prevent it from being part of the 1.3 release (other than the time required to do it)?

2

Re: Admin stuff in separate directory

Try the search function.
Somebody has done and explained this somewhere here AFAIK

The German PunBB Site:
PunBB-forum.de

Re: Admin stuff in separate directory

Tobi wrote:

Try the search function.
Somebody has done and explained this somewhere here AFAIK

I saw this thread and posted a request for details three weeks ago, but AFAIK, the complete solution has not been posted.

I'd be grateful if someone could fill in the missing details or point me to another more complete discussion.

However, even if a mod exists, I would still think this request has merit.  Here are a couple of reasons I think it should be in the base distribution:

1) Doesn't require moding so upgrades of PunBB are easier
2) Makes it easier to more PunBB installations to be more secure... which makes PunBB more appealing

BTW, this is all predicated on the assumption that .htaccess password protection would improve security.  If someone knowledgable were to tell me that it doesn't help, I'll be happy to shut up.

4

Re: Admin stuff in separate directory

You are right.
Elzar kept this secret so far.

I want to do the same so I'll try to find a solution myself and post it then.
I think it is at least an option for extra security and I agree it should be standard.
Not alone for the security reason but also because it makes the directory structure more readable.

The German PunBB Site:
PunBB-forum.de

5

Re: Admin stuff in separate directory

Completely forgot about it. I'll write it up soon.

6

Re: Admin stuff in separate directory

There's a lot of handwork involved. I found a lot of parts to change, hope that's all.
So, here we go:
1. create a directory "admin" in your pun root and move all file sthere that start with "admin_"
2. open function.php and replace the complete function confirm_referer() with

function confirm_referrer($script)
{
  global $pun_config, $lang_common;
## ADMIN DIR CHANGE 
  if(ereg("/admin/",$_SERVER['HTTP_REFERER'])) {
    $ref_url = $pun_config['o_base_url'].'/admin';
    }
  else $ref_url = $pun_config['o_base_url'];
  if (!preg_match('#^'.preg_quote(str_replace('www.', '', $ref_url)."/".$script, '#').'#i', str_replace('www.', '', (isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : ''))))
    message($lang_common['Bad referrer']);
}

3. still in function.php,
find the function generate_navlinks() (somewhere around line 230)
In this function, replace ALL occurences of

<a href="

with

<a href="' . PUN_ROOT . '

4. Around line 887 in function.php, replace

<link rel="stylesheet" type="text/css" href="style/<?php echo $pun_user['style'].'.css' ?>" />

with

<link rel="stylesheet" type="text/css" href="<?php echo PUN_ROOT ?>style/<?php echo $pun_user['style'].'.css' ?>" />

5. Open ALL admin_ files and replace everywhere

define('PUN_ROOT', './');

with

define('PUN_ROOT', '../');

It's always on top of the scripts.

6. Open header.php and find around line 66

<link rel="stylesheet" type="text/css" href="style/<?php echo $pun_user['style'].'.css'

replace it with

<link rel="stylesheet" type="text/css" href="<?php echo PUN_ROOT ?>style/<?php echo $pun_user['style'].'.css'

7. and around line 70, replace

    echo '<link rel="stylesheet" type="text/css" href="style/imports/base_admin.css" />'."\n";

with

    echo '<link rel="stylesheet" type="text/css" href="'.PUN_ROOT.'style/imports/base_admin.css" />'."\n";

Let's hope that's it. If not let me know.
(It's basically about adding PUN_ROOT before most of the links...)

The German PunBB Site:
PunBB-forum.de

Re: Admin stuff in separate directory

Great.  Thanks Tobi... but I still think it should be considered as part of the standard install for v1.3. smile

8

Re: Admin stuff in separate directory

As I was hacked 10 mn ago ... I think YES for an ADMIN DIR more protected smile

9

Re: Admin stuff in separate directory

someguy wrote:

Great.  Thanks Tobi... but I still think it should be considered as part of the standard install for v1.3. smile

Well, I also think it would be a good idea but then again it's not up to us to decide.. smile
For the time being just spend the 10 minutes and fix it manually.

The German PunBB Site:
PunBB-forum.de